• Home
  • Raw
  • Download

Lines Matching defs:CLG_

48 CommandLineOptions CLG_(clo);
49 Statistics CLG_(stat);
50 Bool CLG_(instrument_state) = True; /* Instrumentation on ? */
53 exec_state CLG_(current_state);
60 static void CLG_(init_statistics)(Statistics* s)
110 CLG_(bb_base) + ii->instr_offset, ii->instr_size);
112 if (!CLG_(current_state).collect) return;
116 CLG_(current_state).cost[ fullOffset(EG_BUS) ]++;
118 if (CLG_(current_state).nonskipped)
119 cost_Bus = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BUS);
121 cost_Bus = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BUS];
139 CLG_(bb_base) + ii->instr_offset, taken);
141 miss = 1 & do_cond_branch_predict(CLG_(bb_base) + ii->instr_offset, taken);
143 if (!CLG_(current_state).collect) return;
147 if (CLG_(current_state).nonskipped)
148 cost_Bc = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BC);
150 cost_Bc = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BC];
153 CLG_(current_state).cost[ fullOffset_Bc ]++;
156 CLG_(current_state).cost[ fullOffset_Bc+1 ]++;
169 CLG_(bb_base) + ii->instr_offset, actual_dst);
171 miss = 1 & do_ind_branch_predict(CLG_(bb_base) + ii->instr_offset, actual_dst);
173 if (!CLG_(current_state).collect) return;
177 if (CLG_(current_state).nonskipped)
178 cost_Bi = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BI);
180 cost_Bi = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BI];
183 CLG_(current_state).cost[ fullOffset_Bi ]++;
186 CLG_(current_state).cost[ fullOffset_Bi+1 ]++;
394 ev->inode->eventset = CLG_(sets).base;
398 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
404 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
409 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
414 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
419 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
466 helperName = CLG_(cachesim).log_1I1Dr_name;
467 helperAddr = CLG_(cachesim).log_1I1Dr;
478 helperName = CLG_(cachesim).log_1I1Dw_name;
479 helperAddr = CLG_(cachesim).log_1I1Dw;
489 helperName = CLG_(cachesim).log_3I0D_name;
490 helperAddr = CLG_(cachesim).log_3I0D;
500 helperName = CLG_(cachesim).log_2I0D_name;
501 helperAddr = CLG_(cachesim).log_2I0D;
509 helperName = CLG_(cachesim).log_1I0D_name;
510 helperAddr = CLG_(cachesim).log_1I0D;
518 helperName = CLG_(cachesim).log_0I1Dr_name;
519 helperAddr = CLG_(cachesim).log_0I1Dr;
529 helperName = CLG_(cachesim).log_0I1Dw_name;
530 helperAddr = CLG_(cachesim).log_0I1Dw;
599 if (!CLG_(clo).simulate_cache) return;
617 if (!CLG_(clo).simulate_cache) return;
638 if (!CLG_(clo).simulate_cache) return;
672 if (!CLG_(clo).simulate_branch) return;
692 if (!CLG_(clo).simulate_branch) return;
709 if (!CLG_(clo).collect_bus) return;
748 CLG_(stat).distinct_instrs++;
808 * Called from CLG_(get_bb)
810 void CLG_(collectBlockInfo)(IRSB* sbIn,
895 VG_(fnptr_to_fnentry)( & CLG_(setup_bbcc) ),
902 IRSB* CLG_(instrument)( VgCallbackClosure* closure,
923 if (! CLG_(instrument_state)) {
957 clgs.bb = CLG_(get_bb)(origAddr, sbIn, &(clgs.seen_before));
1097 * This heuristic is precalculated in CLG_(collectBlockInfo)().
1159 (UWord) &CLG_(current_state).jmps_passed,
1211 (UWord) &CLG_(current_state).jmps_passed,
1266 CLG_(delete_bb)(orig_addr);
1271 /*--- CLG_(fini)() and related function ---*/
1280 for(i = 0; i < CLG_(current_call_stack).sp; i++) {
1281 if (!CLG_(current_call_stack).entry[i].jcc) continue;
1284 CLG_(copy_cost)( CLG_(sets).full,
1285 CLG_(current_call_stack).entry[i].enter_cost,
1286 CLG_(current_state).cost );
1287 CLG_(current_call_stack).entry[i].jcc->call_counter = 0;
1290 CLG_(forall_bbccs)(CLG_(zero_bbcc));
1293 CLG_(copy_cost)( CLG_(sets).full,
1294 t->lastdump_cost, CLG_(current_state).cost );
1297 void CLG_(zero_all_cost)(Bool only_current_thread)
1303 zero_thread_cost(CLG_(get_current_thread)());
1305 CLG_(forall_threads)(zero_thread_cost);
1315 while(CLG_(current_state).sig !=0)
1316 CLG_(post_signal)(CLG_(current_tid),CLG_(current_state).sig);
1319 while(CLG_(current_call_stack).sp>0)
1320 CLG_(pop_call_stack)();
1323 CLG_(init_exec_state)( &CLG_(current_state) );
1324 CLG_(current_fn_stack).top = CLG_(current_fn_stack).bottom;
1330 CLG_(zero_cost)( CLG_(sets).full, CLG_(current_state).cost );
1336 void CLG_(set_instrument_state)(Char* reason, Bool state)
1338 if (CLG_(instrument_state) == state) {
1343 CLG_(instrument_state) = state;
1350 CLG_(forall_threads)(unwind_thread);
1351 CLG_(forall_threads)(zero_state_cost);
1352 (*CLG_(cachesim).clear)();
1368 t = CLG_(current_tid);
1369 CLG_(init_cost_lz)( CLG_(sets).full, &sum );
1370 CLG_(copy_cost_lz)( CLG_(sets).full, &tmp, ti->lastdump_cost );
1371 CLG_(add_diff_cost)( CLG_(sets).full, sum, ti->lastdump_cost,
1373 CLG_(copy_cost)( CLG_(sets).full, ti->lastdump_cost, tmp );
1374 CLG_(sprint_mappingcost)(buf, CLG_(dumpmap), sum);
1376 VG_(gdb_printf)("frames-%d: %d\n", t, CLG_(current_call_stack).sp);
1379 for(i = 0; i < CLG_(current_call_stack).sp; i++) {
1380 ce = CLG_(get_call_entry)(i);
1389 CLG_(copy_cost)( CLG_(sets).full, sum, ce->jcc->cost );
1390 CLG_(copy_cost)( CLG_(sets).full, tmp, ce->enter_cost );
1391 CLG_(add_diff_cost)( CLG_(sets).full, sum,
1392 ce->enter_cost, CLG_(current_state).cost );
1393 CLG_(copy_cost)( CLG_(sets).full, ce->enter_cost, tmp );
1396 CLG_(sprint_mappingcost)(buf + p, CLG_(dumpmap), sum );
1411 Int orig_tid = CLG_(current_tid);
1414 CLG_(instrument_state) ? "on":"off");
1415 if (!CLG_(instrument_state)) return;
1417 VG_(gdb_printf)("executed-bbs: %llu\n", CLG_(stat).bb_executions);
1418 VG_(gdb_printf)("executed-calls: %llu\n", CLG_(stat).call_counter);
1419 VG_(gdb_printf)("distinct-bbs: %d\n", CLG_(stat).distinct_bbs);
1420 VG_(gdb_printf)("distinct-calls: %d\n", CLG_(stat).distinct_jccs);
1421 VG_(gdb_printf)("distinct-functions: %d\n", CLG_(stat).distinct_fns);
1422 VG_(gdb_printf)("distinct-contexts: %d\n", CLG_(stat).distinct_contexts);
1426 CLG_(sprint_eventmapping)(buf+p, CLG_(dumpmap));
1429 VG_(gdb_printf)("part: %d\n", CLG_(get_dump_counter)());
1432 th = CLG_(get_threads)();
1440 CLG_(forall_threads)(dump_state_of_thread_togdb);
1479 CLG_(dump_profile)(req, False);
1483 CLG_(zero_all_cost)(False);
1495 if (!CLG_(instrument_state)) {
1499 thread_info** th = CLG_(get_threads)();
1512 CLG_(instrument_state) ? "on":"off");
1515 CLG_(set_instrument_state)("Command", VG_(strcmp)(arg,"off")!=0);
1526 Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret)
1534 CLG_(dump_profile)("Client Request", True);
1542 CLG_(dump_profile)(buf, True);
1548 CLG_(zero_all_cost)(True);
1553 CLG_(current_state).collect = !CLG_(current_state).collect;
1555 CLG_(current_state).collect ? "ON" : "OFF");
1560 CLG_(set_instrument_state)("Client Request", True);
1565 CLG_(set_instrument_state)("Client Request", False);
1599 void CLG_(pre_syscalltime)(ThreadId tid, UInt syscallno,
1602 if (CLG_(clo).collect_systime) {
1614 void CLG_(post_syscalltime)(ThreadId tid, UInt syscallno,
1617 if (CLG_(clo).collect_systime &&
1618 CLG_(current_state).bbcc) {
1635 CLG_(current_state).cost[o] ++;
1636 CLG_(current_state).cost[o+1] += diff;
1637 if (!CLG_(current_state).bbcc->skipped)
1638 CLG_(init_cost_lz)(CLG_(sets).full,
1639 &(CLG_(current_state).bbcc->skipped));
1640 CLG_(current_state).bbcc->skipped[o] ++;
1641 CLG_(current_state).bbcc->skipped[o+1] += diff;
1664 total = CLG_(total_cost);
1703 (*CLG_(cachesim).finish)();
1707 CLG_(forall_threads)(unwind_thread);
1709 CLG_(dump_profile)(0, False);
1711 CLG_(finish_command)();
1718 CLG_(stat).full_debug_BBs +
1719 CLG_(stat).fn_name_debug_BBs +
1720 CLG_(stat).file_line_debug_BBs +
1721 CLG_(stat).no_debug_BBs;
1725 CLG_(stat).distinct_objs);
1727 CLG_(stat).distinct_files);
1729 CLG_(stat).distinct_fns);
1731 CLG_(stat).distinct_contexts);
1733 CLG_(stat).distinct_bbs);
1735 CLG_(costarray_entries), CLG_(costarray_chunks));
1737 CLG_(stat).distinct_bbccs);
1739 CLG_(stat).distinct_jccs);
1741 CLG_(stat).distinct_skips);
1746 CLG_(stat).full_debug_BBs * 100 / BB_lookups,
1747 CLG_(stat).full_debug_BBs);
1749 CLG_(stat).file_line_debug_BBs * 100 / BB_lookups,
1750 CLG_(stat).file_line_debug_BBs);
1752 CLG_(stat).fn_name_debug_BBs * 100 / BB_lookups,
1753 CLG_(stat).fn_name_debug_BBs);
1755 CLG_(stat).no_debug_BBs * 100 / BB_lookups,
1756 CLG_(stat).no_debug_BBs);
1759 CLG_(stat).bbcc_clones);
1761 CLG_(stat).bb_retranslations);
1763 CLG_(stat).distinct_instrs);
1767 CLG_(stat).cxt_lru_misses);
1769 CLG_(stat).bbcc_lru_misses);
1771 CLG_(stat).jcc_lru_misses);
1773 CLG_(stat).bb_executions);
1775 CLG_(stat).call_counter);
1777 CLG_(stat).jcnd_counter);
1779 CLG_(stat).jump_counter);
1781 CLG_(stat).rec_call_counter);
1783 CLG_(stat).ret_counter);
1788 CLG_(sprint_eventmapping)(buf, CLG_(dumpmap));
1790 CLG_(sprint_mappingcost)(buf, CLG_(dumpmap), CLG_(total_cost));
1795 total = CLG_(total_cost);
1798 if (CLG_(clo).simulate_cache) {
1802 if (CLG_(clo).simulate_branch) {
1815 if (CLG_(clo).simulate_cache)
1816 (*CLG_(cachesim).printstat)(l1, l2, l3);
1818 if (CLG_(clo).simulate_branch)
1824 void CLG_(fini)(Int exitcode)
1841 /* throttle calls to CLG_(run_thread) by number of BBs executed */
1845 CLG_(run_thread)( tid );
1849 void CLG_(post_clo_init)(void)
1854 CLG_DEBUG(1, " dump threads: %s\n", CLG_(clo).separate_threads ? "Yes":"No");
1855 CLG_DEBUG(1, " call sep. : %d\n", CLG_(clo).separate_callers);
1856 CLG_DEBUG(1, " rec. sep. : %d\n", CLG_(clo).separate_recursions);
1858 if (!CLG_(clo).dump_line && !CLG_(clo).dump_instr && !CLG_(clo).dump_bb) {
1860 CLG_(clo).dump_line = True;
1863 CLG_(init_dumps)();
1864 CLG_(init_command)();
1866 (*CLG_(cachesim).post_clo_init)();
1868 CLG_(init_eventsets)();
1869 CLG_(init_statistics)(& CLG_(stat));
1870 CLG_(init_cost_lz)( CLG_(sets).full, &CLG_(total_cost) );
1873 CLG_(init_obj_table)();
1874 CLG_(init_cxt_table)();
1875 CLG_(init_bb_hash)();
1877 CLG_(init_threads)();
1878 CLG_(run_thread)(1);
1880 CLG_(instrument_state) = CLG_(clo).instrument_atstart;
1889 void CLG_(pre_clo_init)(void)
1899 VG_(basic_tool_funcs) (CLG_(post_clo_init),
1900 CLG_(instrument),
1901 CLG_(fini));
1906 VG_(needs_command_line_options)(CLG_(process_cmd_line_option),
1907 CLG_(print_usage),
1908 CLG_(print_debug_usage));
1910 VG_(needs_client_requests)(CLG_(handle_client_request));
1911 VG_(needs_syscall_wrapper)(CLG_(pre_syscalltime),
1912 CLG_(post_syscalltime));
1915 VG_(track_pre_deliver_signal) ( & CLG_(pre_signal) );
1916 VG_(track_post_deliver_signal)( & CLG_(post_signal) );
1918 CLG_(set_clo_defaults)();
1921 VG_DETERMINE_INTERFACE_VERSION(CLG_(pre_clo_init))