void on_sender_open(proton::sender &sender) override { if (sender.source().dynamic()) { std::string addr = generate_address(); sender.open(proton::sender_options().source(proton::source_options().address(addr))); senders[addr] = sender; } }
int main(int argc, char *argv[]) { int predictions = 0; int mispredictions = 0; int index_width = atoi(argv[1]); int max_entries = 1; max_entries <<= index_width; //since bhsr is only 4-bit, we'll mask out the remaining bits. int bhsr_mask = maskgen(4); //allocate memory for table entries, ensure they start at 0 table_entry *table = calloc(max_entries, sizeof(table_entry)); char *pc = malloc(9); char *current_counter; int bht_address; int taken; int pc_mask = maskgen(index_width); char *bhsr; //process file, update total number of predictions read and mispredictions. while(!feof(stdin)) { scanf("%s %d",pc,&taken); predictions++; // printf("%d: scanned %s, %d\n",predictions,pc,taken); bht_address = generate_address(pc, pc_mask); current_counter = &(table[bht_address]).pht[(table->bhsr)]; // printf("%d: scanned %s, %d, counter: %d\n",predictions,pc,taken, *current_counter); bhsr = &table->bhsr; *bhsr <<= 1; *bhsr &= bhsr_mask; // printf("BHSR: %d\n",*bhsr); if(taken) { // printf("Taken loop entered\n"); if(*current_counter < 2) { mispredictions++; } if(*current_counter < 3) { (*current_counter)++;} (*bhsr)++; // printf("New bhsr value: %d\n",*bhsr); } else { if(*current_counter > 1) { mispredictions++; } if(*current_counter > 0) { (*current_counter)--; } } } //file processing complete, let's crunch some numbers! float percent_mispredict = (float)mispredictions/predictions; percent_mispredict *= 100; printf("Percent mispredicted: %0.2f\n",percent_mispredict); return 0; }
void RegisterNameForm::newKey() { gpm::public_key_t pub; gpm::private_key_t priv; std::string gen = generate_address( pub, priv ); get_keychain().set( encode_address(pub), gpm::key_info( pub, priv ) ); get_keychain().sync(); m_ui->key_name->insertItem( 0, gen.c_str() ); }
int main(int argc, char *argv[]) { int predictions = 0; int mispredictions = 0; int max_entries = 1; int index_width = atoi(argv[1]); max_entries = max_entries << index_width; //allocate memory for counters, ensure they start at 0 char *counters = calloc(max_entries,sizeof(char)); char *pc = malloc(9); char *current_counter; int bht_address; int taken; int mask = maskgen(index_width); //process file, update total number of predictions read and mispredictions. while(!feof(stdin)) { scanf("%s %d",pc,&taken); predictions++; // printf("%d: scanned %s, %d\n",predictions,pc,taken); bht_address = generate_address(pc, mask); current_counter = &counters[bht_address]; // printf("%d: scanned %s, %d, counter: %d\n",predictions,pc,taken, *current_counter); if(taken) { if(*current_counter < 2) { mispredictions++; } if(*current_counter < 3) { (*current_counter)++;} } else { if(*current_counter > 1) { mispredictions++; } if(*current_counter > 0) { (*current_counter)--; } } } //file processing complete, let's crunch some numbers! float percent_mispredict = (float)mispredictions/predictions; percent_mispredict *= 100; printf("Percent mispredicted: %0.2f\n",percent_mispredict); return 0; }
LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); }
void on_sender_open(proton::sender &sender) override { if (sender.remote_source().dynamic()) { sender.local_source().address(generate_address()); senders[sender.local_source().address()] = sender; } }