23 #include <sys/types.h> 39 #define CORE_L2_MISS_CYCLES 200 40 #define CORE_L2_HIT_CYCLES 14.5 41 #define CORE_L1_DTLB_MISS_CYCLES 10 42 #define CORE_LCP_STALL_CYCLES 6 43 #define CORE_UNKNOWN_ADDR_STORE_CYCLES 5 44 #define CORE_OVERLAPPING_CYCLES 6 45 #define CORE_SPAN_ACROSS_CACHE_LINE_CYCLES 20 48 #define I7_L1_DTLB_WALK_COMPLETED_CYCLES 35 49 #define I7_L1_ITLB_WALK_COMPLETED_CYCLES 35 50 #define I7_L2_HIT_CYCLES 6 51 #define I7_L3_UNSHARED_HIT_CYCLES 35 52 #define I7_OTHER_CORE_L2_HIT_CYCLES 60 53 #define I7_OTHER_CORE_L2_HITM_CYCLES 75 54 #define I7_L3_MISS_LOCAL_DRAM_HIT_CYCLES 225 // average of 200 (not modified) and 225-250 (modified) 55 #define I7_L3_MISS_REMOTE_DRAM_HIT_CYCLES 360 // average of 350 (not modified) and 370 (modified) 56 #define I7_L3_MISS_REMOTE_CACHE_HIT_CYCLES 180 57 #define I7_IFETCH_L3_MISS_LOCAL_DRAM_HIT 200 58 #define I7_IFETCH_L3_MISS_REMOTE_DRAM_HIT 350 59 #define I7_IFETCH_L2_MISS_L3_HIT_NO_SNOOP 35 60 #define I7_IFETCH_L2_MISS_L3_HIT_SNOOP 60 61 #define I7_IFETCH_L2_MISS_L3_HITM 75 62 #define I7_IFETCH_L3_MISS_REMOTE_CACHE_FWD 180 64 #define MAX_MODULES 1000 66 #define EXPECTED_CPI 0.25 68 #define MAX_FILENAME_LENGTH 1024 69 #define MAX_SAMPLE_INDEX_LENGTH 10000 70 #define MAX_SYM_LENGTH 15000 71 #define MAX_SYM_MOD_LENGTH 20000 72 #define MAX_LIB_LENGTH 5000 73 #define MAX_LIB_MOD_LENGTH 7000 74 #define MAX_SIMPLE_SYM_LENGTH 300 75 #define MAX_SIMPLE_SYM_MOD_LENGTH 500 76 #define MAX_SIMPLE_LIB_LENGTH 300 77 #define MAX_SIMPLE_LIB_MOD_LENGTH 500 78 #define MAX_LINE_LENGTH 20000 79 #define MAX_EVENT_NAME_LENGTH 150 80 #define MAX_MODULE_NAME_LENGTH 250 81 #define MAX_VALUE_STRING_LENGTH 250 82 #define MAX_ARCH_NAME_LENGTH 20 83 #define MAX_CMASK_STR_LENGTH 5 84 #define MAX_INV_STR_LENGTH 5 85 #define MAX_SP_STR_LENGTH 50 87 #define PIPE_BUFFER_LENGTH 1000 92 pipe = popen( cmd,
"r" );
94 printf(
"Cannot open pipe. Exiting...\n" );
100 while ( !feof(
pipe ) ) {
124 if ( !isspace( *srcbuffer++ ) ) {
return false; }
125 while ( isspace( *srcbuffer ) ) { srcbuffer++; }
126 *destbuffer = srcbuffer;
137 bool skipString(
const char* strptr,
const char* srcbuffer,
const char** dstbuffer ) {
138 if ( strncmp( srcbuffer, strptr, strlen( strptr ) ) ) {
return false; }
139 *dstbuffer = srcbuffer + strlen( strptr );
147 FileInfo(
void ) : NAME(
"<dynamically generated>" ) {}
149 if ( useGdb ) { this->createOffsetMap(); }
153 if ( m_symbolCache.empty() ) {
return 0; }
155 SymbolCache::iterator i = lower_bound( m_symbolCache.begin(), m_symbolCache.end(), offset,
CacheItemComparator() );
156 if ( i->OFFSET == offset ) {
return i->NAME.c_str(); }
158 if ( i == m_symbolCache.begin() ) {
return m_symbolCache.begin()->NAME.c_str(); }
162 return i->NAME.c_str();
166 SymbolCache::iterator i = upper_bound( m_symbolCache.begin(), m_symbolCache.end(), offset,
CacheItemComparator() );
167 if ( i == m_symbolCache.end() ) {
return 0; }
192 bool matched =
false;
193 while ( objdump.output() ) {
203 if ( !objdump.output() )
break;
204 if ( line.
empty() )
continue;
205 const char* lineptr = line.
c_str();
207 if ( !
skipString(
"LOAD", lineptr, &lineptr ) )
continue;
209 if ( !
skipString(
"off", lineptr, &lineptr ) )
continue;
211 int initialBase = strtol( lineptr, &endptr, 16 );
212 if ( lineptr == endptr )
continue;
215 if ( !
skipString(
"vaddr", lineptr, &lineptr ) )
continue;
217 int finalBase = strtol( lineptr, &endptr, 16 );
218 if ( lineptr == endptr )
continue;
219 vmbase = finalBase - initialBase;
224 fprintf( stderr,
"Cannot determine VM base address for %s\n", NAME.
c_str() );
225 fprintf( stderr,
"Error while running `objdump -p %s`\n", NAME.
c_str() );
230 while (
nm.output() ) {
233 if ( !
nm.output() )
break;
234 if ( line.
empty() )
continue;
238 int address = strtol( begin, &endptr, 10 );
239 if ( endptr == begin )
continue;
240 if ( *endptr++ !=
' ' )
continue;
241 if ( isspace( *endptr++ ) )
continue;
242 if ( *endptr++ !=
' ' )
continue;
243 char* symbolName = endptr;
244 while ( *endptr && !isspace( *endptr ) ) endptr++;
245 if ( *endptr != 0 )
continue;
247 if ( symbolName[0] ==
'.' )
continue;
252 int offset = address - vmbase;
253 if ( m_symbolCache.
size() && ( m_symbolCache.
back().OFFSET == offset ) )
254 m_symbolCache.
back().NAME = symbolName;
275 core_caa_events.
push_back(
"BRANCH_INSTRUCTIONS_RETIRED" );
276 core_caa_events.
push_back(
"ILD_STALL" );
277 core_caa_events.
push_back(
"INST_RETIRED:LOADS" );
278 core_caa_events.
push_back(
"INST_RETIRED:OTHER" );
279 core_caa_events.
push_back(
"INST_RETIRED:STORES" );
280 core_caa_events.
push_back(
"INSTRUCTIONS_RETIRED" );
281 core_caa_events.
push_back(
"LOAD_BLOCK:OVERLAP_STORE" );
282 core_caa_events.
push_back(
"LOAD_BLOCK:STA" );
283 core_caa_events.
push_back(
"LOAD_BLOCK:UNTIL_RETIRE" );
284 core_caa_events.
push_back(
"MEM_LOAD_RETIRED:DTLB_MISS" );
285 core_caa_events.
push_back(
"MEM_LOAD_RETIRED:L1D_LINE_MISS" );
286 core_caa_events.
push_back(
"MEM_LOAD_RETIRED:L2_LINE_MISS" );
287 core_caa_events.
push_back(
"MISPREDICTED_BRANCH_RETIRED" );
290 core_caa_events.
push_back(
"RS_UOPS_DISPATCHED CMASK=1 INV=1" );
291 core_caa_events.
push_back(
"SIMD_COMP_INST_RETIRED:PACKED_SINGLE:PACKED_DOUBLE" );
292 core_caa_events.
push_back(
"UNHALTED_CORE_CYCLES" );
299 nhm_caa_events.
push_back(
"ARITH:CYCLES_DIV_BUSY" );
300 nhm_caa_events.
push_back(
"BR_INST_EXEC:ANY" );
301 nhm_caa_events.
push_back(
"BR_INST_EXEC:DIRECT_NEAR_CALL" );
302 nhm_caa_events.
push_back(
"BR_INST_EXEC:INDIRECT_NEAR_CALL" );
303 nhm_caa_events.
push_back(
"BR_INST_EXEC:INDIRECT_NON_CALL" );
304 nhm_caa_events.
push_back(
"BR_INST_EXEC:NEAR_CALLS" );
305 nhm_caa_events.
push_back(
"BR_INST_EXEC:NON_CALLS" );
306 nhm_caa_events.
push_back(
"BR_INST_EXEC:RETURN_NEAR" );
307 nhm_caa_events.
push_back(
"BR_INST_RETIRED:ALL_BRANCHES" );
308 nhm_caa_events.
push_back(
"BR_INST_RETIRED:CONDITIONAL" );
309 nhm_caa_events.
push_back(
"BR_INST_RETIRED:NEAR_CALL" );
310 nhm_caa_events.
push_back(
"BR_MISP_EXEC:ANY" );
311 nhm_caa_events.
push_back(
"CPU_CLK_UNHALTED:THREAD_P" );
312 nhm_caa_events.
push_back(
"DTLB_LOAD_MISSES:WALK_COMPLETED" );
313 nhm_caa_events.
push_back(
"INST_RETIRED:ANY_P" );
314 nhm_caa_events.
push_back(
"ITLB_MISSES:WALK_COMPLETED" );
315 nhm_caa_events.
push_back(
"L2_RQSTS:IFETCH_HIT" );
316 nhm_caa_events.
push_back(
"L2_RQSTS:IFETCH_MISS" );
317 nhm_caa_events.
push_back(
"MEM_INST_RETIRED:LOADS" );
318 nhm_caa_events.
push_back(
"MEM_INST_RETIRED:STORES" );
319 nhm_caa_events.
push_back(
"MEM_LOAD_RETIRED:L2_HIT" );
320 nhm_caa_events.
push_back(
"MEM_LOAD_RETIRED:L3_MISS" );
321 nhm_caa_events.
push_back(
"MEM_LOAD_RETIRED:L3_UNSHARED_HIT" );
322 nhm_caa_events.
push_back(
"MEM_LOAD_RETIRED:OTHER_CORE_L2_HIT_HITM" );
323 nhm_caa_events.
push_back(
"MEM_UNCORE_RETIRED:LOCAL_DRAM" );
324 nhm_caa_events.
push_back(
"MEM_UNCORE_RETIRED:OTHER_CORE_L2_HITM" );
325 nhm_caa_events.
push_back(
"MEM_UNCORE_RETIRED:REMOTE_CACHE_LOCAL_HOME_HIT" );
326 nhm_caa_events.
push_back(
"MEM_UNCORE_RETIRED:REMOTE_DRAM" );
327 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:LOCAL_DRAM" );
328 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:OTHER_CORE_HITM" );
329 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:OTHER_CORE_HIT_SNP" );
330 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:REMOTE_CACHE_FWD" );
331 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:REMOTE_DRAM" );
332 nhm_caa_events.
push_back(
"OFFCORE_RESPONSE_0:DMND_IFETCH:UNCORE_HIT" );
333 nhm_caa_events.
push_back(
"RESOURCE_STALLS:ANY" );
334 nhm_caa_events.
push_back(
"SSEX_UOPS_RETIRED:PACKED_DOUBLE" );
335 nhm_caa_events.
push_back(
"SSEX_UOPS_RETIRED:PACKED_SINGLE" );
336 nhm_caa_events.
push_back(
"UOPS_DECODED:MS CMASK=1" );
337 nhm_caa_events.
push_back(
"UOPS_ISSUED:ANY CMASK=1 INV=1" );
338 nhm_caa_events.
push_back(
"ITLB_MISS_RETIRED" );
339 nhm_caa_events.
push_back(
"UOPS_RETIRED:ANY" );
344 if ( find( C_events.
begin(), C_events.
end(), ( *it ) ) == C_events.
end() ) {
345 fprintf( stderr,
"ERROR: Cannot find event %s!!!\naborting...\n", ( *it ).c_str() );
354 if ( find( C_events.
begin(), C_events.
end(), ( *it ) ) == C_events.
end() ) {
355 fprintf( stderr,
"ERROR: Cannot find event %s!!!\naborting...\n", ( *it ).c_str() );
363 core_caa_events_displ.
push_back(
"Total Cycles" );
364 core_caa_events_displ.
push_back(
"Stalled Cycles" );
365 core_caa_events_displ.
push_back(
"% of Total Cycles" );
366 core_caa_events_displ.
push_back(
"Instructions Retired" );
367 core_caa_events_displ.
push_back(
"CPI" );
369 core_caa_events_displ.
push_back(
"iMargin" );
370 core_caa_events_displ.
push_back(
"iFactor" );
372 core_caa_events_displ.
push_back(
"Counted Stalled Cycles" );
374 core_caa_events_displ.
push_back(
"L2 Miss Impact" );
375 core_caa_events_displ.
push_back(
"L2 Miss % of counted Stalled Cycles" );
377 core_caa_events_displ.
push_back(
"L2 Hit Impact" );
378 core_caa_events_displ.
push_back(
"L2 Hit % of counted Stalled Cycles" );
380 core_caa_events_displ.
push_back(
"L1 DTLB Miss Impact" );
381 core_caa_events_displ.
push_back(
"L1 DTLB Miss % of counted Stalled Cycles" );
383 core_caa_events_displ.
push_back(
"LCP Stalls Impact" );
384 core_caa_events_displ.
push_back(
"LCP Stalls % of counted Stalled Cycles" );
386 core_caa_events_displ.
push_back(
"Store-Fwd Stalls Impact" );
387 core_caa_events_displ.
push_back(
"Store-Fwd Stalls % of counted Stalled Cycles" );
389 core_caa_events_displ.
push_back(
"Loads Blocked by Unknown Address Store Impact" );
390 core_caa_events_displ.
push_back(
"Loads Blocked % of Store-Fwd Stalls Cycles" );
391 core_caa_events_displ.
push_back(
"Loads Overlapped with Stores Impact" );
392 core_caa_events_displ.
push_back(
"Loads Overlapped % of Store-Fwd Stalls Cycles" );
393 core_caa_events_displ.
push_back(
"Loads Spanning across Cache Lines Impact" );
394 core_caa_events_displ.
push_back(
"Loads Spanning % of Store-Fwd Stalls Cycles" );
396 core_caa_events_displ.
push_back(
"Load Instructions" );
397 core_caa_events_displ.
push_back(
"Load % of all Instructions" );
398 core_caa_events_displ.
push_back(
"Store Instructions" );
399 core_caa_events_displ.
push_back(
"Store % of all Instructions" );
400 core_caa_events_displ.
push_back(
"Branch Instructions" );
401 core_caa_events_displ.
push_back(
"Branch % of all Instructions" );
402 core_caa_events_displ.
push_back(
"Packed SIMD Computational Instructions" );
403 core_caa_events_displ.
push_back(
"Packed SIMD % of all Instructions" );
404 core_caa_events_displ.
push_back(
"Other Instructions" );
405 core_caa_events_displ.
push_back(
"Other % of all Instructions" );
407 core_caa_events_displ.
push_back(
"ITLB Miss Rate in %" );
408 core_caa_events_displ.
push_back(
"% of Mispredicted Branches" );
414 ( it->second )[
"Total Cycles"] = ( it->second )[
"UNHALTED_CORE_CYCLES"];
415 ( it->second )[
"Stalled Cycles"] = ( it->second )[
"RS_UOPS_DISPATCHED CMASK=1 INV=1"];
416 ( it->second )[
"L2 Miss Impact"] = ( it->second )[
"MEM_LOAD_RETIRED:L2_LINE_MISS"] *
CORE_L2_MISS_CYCLES;
417 ( it->second )[
"L2 Hit Impact"] =
418 ( ( it->second )[
"MEM_LOAD_RETIRED:L1D_LINE_MISS"] - ( it->second )[
"MEM_LOAD_RETIRED:L2_LINE_MISS"] ) *
422 ( it->second )[
"Loads Blocked by Unknown Address Store Impact"] =
424 ( it->second )[
"Loads Overlapped with Stores Impact"] =
426 ( it->second )[
"Loads Spanning across Cache Lines Impact"] =
428 ( it->second )[
"Store-Fwd Stalls Impact"] = ( it->second )[
"Loads Blocked by Unknown Address Store Impact"] +
429 ( it->second )[
"Loads Overlapped with Stores Impact"] +
430 ( it->second )[
"Loads Spanning across Cache Lines Impact"];
431 ( it->second )[
"Counted Stalled Cycles"] =
432 ( it->second )[
"L2 Miss Impact"] + ( it->second )[
"L2 Hit Impact"] + ( it->second )[
"LCP Stalls Impact"] +
433 ( it->second )[
"L1 DTLB Miss Impact"] + ( it->second )[
"Store-Fwd Stalls Impact"];
434 ( it->second )[
"Instructions Retired"] = ( it->second )[
"INSTRUCTIONS_RETIRED"];
435 ( it->second )[
"ITLB Miss Rate in %"] =
436 ( ( it->second )[
"ITLB_MISS_RETIRED"] / ( it->second )[
"INSTRUCTIONS_RETIRED"] ) * 100;
437 ( it->second )[
"Branch Instructions"] = ( it->second )[
"BRANCH_INSTRUCTIONS_RETIRED"];
438 ( it->second )[
"Load Instructions"] = ( it->second )[
"INST_RETIRED:LOADS"];
439 ( it->second )[
"Store Instructions"] = ( it->second )[
"INST_RETIRED:STORES"];
440 ( it->second )[
"Other Instructions"] = ( it->second )[
"INST_RETIRED:OTHER"] -
441 ( it->second )[
"SIMD_COMP_INST_RETIRED:PACKED_SINGLE:PACKED_DOUBLE"] -
442 ( it->second )[
"BRANCH_INSTRUCTIONS_RETIRED"];
443 ( it->second )[
"% of Mispredicted Branches"] =
444 ( ( it->second )[
"MISPREDICTED_BRANCH_RETIRED"] / ( it->second )[
"BRANCH_INSTRUCTIONS_RETIRED"] ) * 100;
445 ( it->second )[
"Packed SIMD Computational Instructions"] =
446 ( it->second )[
"SIMD_COMP_INST_RETIRED:PACKED_SINGLE:PACKED_DOUBLE"];
447 ( it->second )[
"Counted Instructions Retired"] =
448 ( it->second )[
"Branch Instructions"] + ( it->second )[
"Load Instructions"] +
449 ( it->second )[
"Store Instructions"] + ( it->second )[
"Other Instructions"] +
450 ( it->second )[
"Packed SIMD Computational Instructions"];
451 ( it->second )[
"CPI"] = ( it->second )[
"UNHALTED_CORE_CYCLES"] / ( it->second )[
"INSTRUCTIONS_RETIRED"];
453 double localPerformanceImprovement = ( it->second )[
"CPI"] /
EXPECTED_CPI;
454 double cyclesAfterImprovement = ( it->second )[
"UNHALTED_CORE_CYCLES"] / localPerformanceImprovement;
455 double totalCyclesAfterImprovement = totalCycles - ( it->second )[
"UNHALTED_CORE_CYCLES"] + cyclesAfterImprovement;
456 ( it->second )[
"iMargin"] = 100 - ( totalCyclesAfterImprovement / totalCycles ) * 100;
458 ( it->second )[
"% of Total Cycles"] =
459 ( it->second )[
"RS_UOPS_DISPATCHED CMASK=1 INV=1"] * 100 / ( it->second )[
"UNHALTED_CORE_CYCLES"];
460 ( it->second )[
"L2 Miss % of counted Stalled Cycles"] =
461 ( it->second )[
"L2 Miss Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles"];
462 ( it->second )[
"L2 Hit % of counted Stalled Cycles"] =
463 ( it->second )[
"L2 Hit Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles"];
464 ( it->second )[
"L1 DTLB Miss % of counted Stalled Cycles"] =
465 ( it->second )[
"L1 DTLB Miss Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles"];
466 ( it->second )[
"LCP Stalls % of counted Stalled Cycles"] =
467 ( it->second )[
"LCP Stalls Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles"];
468 ( it->second )[
"Store-Fwd Stalls % of counted Stalled Cycles"] =
469 ( it->second )[
"Store-Fwd Stalls Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles"];
470 ( it->second )[
"Loads Blocked % of Store-Fwd Stalls Cycles"] =
471 ( it->second )[
"Loads Blocked by Unknown Address Store Impact"] * 100 /
472 ( it->second )[
"Store-Fwd Stalls Impact"];
473 ( it->second )[
"Loads Overlapped % of Store-Fwd Stalls Cycles"] =
474 ( it->second )[
"Loads Overlapped with Stores Impact"] * 100 / ( it->second )[
"Store-Fwd Stalls Impact"];
475 ( it->second )[
"Loads Spanning % of Store-Fwd Stalls Cycles"] =
476 ( it->second )[
"Loads Spanning across Cache Lines Impact"] * 100 / ( it->second )[
"Store-Fwd Stalls Impact"];
478 ( it->second )[
"Load % of all Instructions"] =
479 ( it->second )[
"INST_RETIRED:LOADS"] * 100 / ( it->second )[
"Counted Instructions Retired"];
480 ( it->second )[
"Store % of all Instructions"] =
481 ( it->second )[
"INST_RETIRED:STORES"] * 100 / ( it->second )[
"Counted Instructions Retired"];
482 ( it->second )[
"Branch % of all Instructions"] =
483 ( it->second )[
"BRANCH_INSTRUCTIONS_RETIRED"] * 100 / ( it->second )[
"Counted Instructions Retired"];
484 ( it->second )[
"Packed SIMD % of all Instructions"] =
485 ( it->second )[
"SIMD_COMP_INST_RETIRED:PACKED_SINGLE:PACKED_DOUBLE"] * 100 /
486 ( it->second )[
"Counted Instructions Retired"];
487 ( it->second )[
"Other % of all Instructions"] =
488 ( it->second )[
"Other Instructions"] * 100 / ( it->second )[
"Counted Instructions Retired"];
493 nhm_caa_events_displ.
push_back(
"Total Cycles" );
494 nhm_caa_events_displ.
push_back(
"Instructions Retired" );
497 nhm_caa_events_displ.
push_back(
"iMargin" );
498 nhm_caa_events_displ.
push_back(
"iFactor" );
500 nhm_caa_events_displ.
push_back(
"Stalled Cycles" );
501 nhm_caa_events_displ.
push_back(
"% of Total Cycles" );
502 nhm_caa_events_displ.
push_back(
"Total Counted Stalled Cycles" );
504 nhm_caa_events_displ.
push_back(
"Instruction Starvation % of Total Cycles" );
505 nhm_caa_events_displ.
push_back(
"# of Instructions per Call" );
506 nhm_caa_events_displ.
push_back(
"% of Total Cycles spent handling FP exceptions" );
508 nhm_caa_events_displ.
push_back(
"Counted Stalled Cycles due to Load Ops" );
510 nhm_caa_events_displ.
push_back(
"L2 Hit Impact" );
511 nhm_caa_events_displ.
push_back(
"L2 Hit % of Load Stalls" );
513 nhm_caa_events_displ.
push_back(
"L3 Unshared Hit Impact" );
514 nhm_caa_events_displ.
push_back(
"L3 Unshared Hit % of Load Stalls" );
516 nhm_caa_events_displ.
push_back(
"L2 Other Core Hit Impact" );
517 nhm_caa_events_displ.
push_back(
"L2 Other Core Hit % of Load Stalls" );
519 nhm_caa_events_displ.
push_back(
"L2 Other Core Hit Modified Impact" );
520 nhm_caa_events_displ.
push_back(
"L2 Other Core Hit Modified % of Load Stalls" );
522 nhm_caa_events_displ.
push_back(
"L3 Miss -> Local DRAM Hit Impact" );
523 nhm_caa_events_displ.
push_back(
"L3 Miss -> Remote DRAM Hit Impact" );
524 nhm_caa_events_displ.
push_back(
"L3 Miss -> Remote Cache Hit Impact" );
525 nhm_caa_events_displ.
push_back(
"L3 Miss -> Total Impact" );
526 nhm_caa_events_displ.
push_back(
"L3 Miss % of Load Stalls" );
528 nhm_caa_events_displ.
push_back(
"L1 DTLB Miss Impact" );
529 nhm_caa_events_displ.
push_back(
"L1 DTLB Miss % of Load Stalls" );
531 nhm_caa_events_displ.
push_back(
"Cycles spent during DIV & SQRT Ops" );
532 nhm_caa_events_displ.
push_back(
"DIV & SQRT Ops % of counted Stalled Cycles" );
534 nhm_caa_events_displ.
push_back(
"Total L2 IFETCH misses" );
535 nhm_caa_events_displ.
push_back(
"% of L2 IFETCH misses" );
537 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by Local DRAM" );
538 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by L3 (Modified)" );
539 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by L3 (Clean Snoop)" );
540 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by Remote L2" );
541 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by Remote DRAM" );
542 nhm_caa_events_displ.
push_back(
"% of IFETCHes served by L3 (No Snoop)" );
544 nhm_caa_events_displ.
push_back(
"Total L2 IFETCH miss Impact" );
546 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by Local DRAM" );
547 nhm_caa_events_displ.
push_back(
"Local DRAM IFECTHes % Impact" );
549 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by L3 (Modified)" );
550 nhm_caa_events_displ.
push_back(
"L3 (Modified) IFECTHes % Impact" );
552 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by L3 (Clean Snoop)" );
553 nhm_caa_events_displ.
push_back(
"L3 (Clean Snoop) IFECTHes % Impact" );
555 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by Remote L2" );
556 nhm_caa_events_displ.
push_back(
"Remote L2 IFECTHes % Impact" );
558 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by Remote DRAM" );
559 nhm_caa_events_displ.
push_back(
"Remote DRAM IFECTHes % Impact" );
561 nhm_caa_events_displ.
push_back(
"Cycles IFETCH served by L3 (No Snoop)" );
562 nhm_caa_events_displ.
push_back(
"L3 (No Snoop) IFECTHes % Impact" );
564 nhm_caa_events_displ.
push_back(
"Total Branch Instructions Executed" );
565 nhm_caa_events_displ.
push_back(
"% of Mispredicted Branches" );
567 nhm_caa_events_displ.
push_back(
"Direct Near Calls % of Total Branches Executed" );
568 nhm_caa_events_displ.
push_back(
"Indirect Near Calls % of Total Branches Executed" );
569 nhm_caa_events_displ.
push_back(
"Indirect Near Non-Calls % of Total Branches Executed" );
570 nhm_caa_events_displ.
push_back(
"All Near Calls % of Total Branches Executed" );
571 nhm_caa_events_displ.
push_back(
"All Non Calls % of Total Branches Executed" );
572 nhm_caa_events_displ.
push_back(
"All Returns % of Total Branches Executed" );
574 nhm_caa_events_displ.
push_back(
"Total Branch Instructions Retired" );
575 nhm_caa_events_displ.
push_back(
"Conditionals % of Total Branches Retired" );
576 nhm_caa_events_displ.
push_back(
"Near Calls % of Total Branches Retired" );
578 nhm_caa_events_displ.
push_back(
"L1 ITLB Miss Impact" );
579 nhm_caa_events_displ.
push_back(
"ITLB Miss Rate in %" );
581 nhm_caa_events_displ.
push_back(
"Branch Instructions" );
582 nhm_caa_events_displ.
push_back(
"Branch % of all Instructions" );
584 nhm_caa_events_displ.
push_back(
"Load Instructions" );
585 nhm_caa_events_displ.
push_back(
"Load % of all Instructions" );
587 nhm_caa_events_displ.
push_back(
"Store Instructions" );
588 nhm_caa_events_displ.
push_back(
"Store % of all Instructions" );
590 nhm_caa_events_displ.
push_back(
"Other Instructions" );
591 nhm_caa_events_displ.
push_back(
"Other % of all Instructions" );
593 nhm_caa_events_displ.
push_back(
"Packed UOPS Retired" );
594 nhm_caa_events_displ.
push_back(
"Packed % of all UOPS Retired" );
600 ( it->second )[
"Total Cycles"] = ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"];
602 ( it->second )[
"L2 Hit Impact"] = ( it->second )[
"MEM_LOAD_RETIRED:L2_HIT"] *
I7_L2_HIT_CYCLES;
603 ( it->second )[
"L3 Unshared Hit Impact"] =
605 if ( ( it->second )[
"MEM_LOAD_RETIRED:OTHER_CORE_L2_HIT_HITM"] >
606 ( it->second )[
"MEM_UNCORE_RETIRED:OTHER_CORE_L2_HITM"] ) {
607 ( it->second )[
"L2 Other Core Hit Impact"] = ( ( it->second )[
"MEM_LOAD_RETIRED:OTHER_CORE_L2_HIT_HITM"] -
608 ( it->second )[
"MEM_UNCORE_RETIRED:OTHER_CORE_L2_HITM"] ) *
611 ( it->second )[
"L2 Other Core Hit Impact"] = 0.0;
613 ( it->second )[
"L2 Other Core Hit Modified Impact"] =
615 ( it->second )[
"L3 Miss -> Local DRAM Hit Impact"] =
617 ( it->second )[
"L3 Miss -> Remote DRAM Hit Impact"] =
619 ( it->second )[
"L3 Miss -> Remote Cache Hit Impact"] =
621 ( it->second )[
"L3 Miss -> Total Impact"] = ( it->second )[
"L3 Miss -> Local DRAM Hit Impact"] +
622 ( it->second )[
"L3 Miss -> Remote DRAM Hit Impact"] +
623 ( it->second )[
"L3 Miss -> Remote Cache Hit Impact"];
624 ( it->second )[
"L1 DTLB Miss Impact"] =
626 ( it->second )[
"Counted Stalled Cycles due to Load Ops"] =
627 ( it->second )[
"L3 Miss -> Total Impact"] + ( it->second )[
"L2 Hit Impact"] +
628 ( it->second )[
"L1 DTLB Miss Impact"] + ( it->second )[
"L3 Unshared Hit Impact"] +
629 ( it->second )[
"L2 Other Core Hit Modified Impact"] + ( it->second )[
"L2 Other Core Hit Impact"];
630 ( it->second )[
"Cycles spent during DIV & SQRT Ops"] = ( it->second )[
"ARITH:CYCLES_DIV_BUSY"];
631 ( it->second )[
"Total Counted Stalled Cycles"] =
632 ( it->second )[
"Counted Stalled Cycles due to Load Ops"] + ( it->second )[
"Cycles spent during DIV & SQRT Ops"];
633 ( it->second )[
"Stalled Cycles"] =
634 ( it->second )[
"Total Counted Stalled Cycles"];
635 ( it->second )[
"% of Total Cycles"] =
636 ( it->second )[
"Stalled Cycles"] * 100 / ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"];
637 ( it->second )[
"L3 Miss % of Load Stalls"] =
638 ( it->second )[
"L3 Miss -> Total Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
639 ( it->second )[
"L2 Hit % of Load Stalls"] =
640 ( it->second )[
"L2 Hit Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
641 ( it->second )[
"L1 DTLB Miss % of Load Stalls"] =
642 ( it->second )[
"L1 DTLB Miss Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
643 ( it->second )[
"L3 Unshared Hit % of Load Stalls"] =
644 ( it->second )[
"L3 Unshared Hit Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
645 ( it->second )[
"L2 Other Core Hit % of Load Stalls"] =
646 ( it->second )[
"L2 Other Core Hit Impact"] * 100 / ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
647 ( it->second )[
"L2 Other Core Hit Modified % of Load Stalls"] =
648 ( it->second )[
"L2 Other Core Hit Modified Impact"] * 100 /
649 ( it->second )[
"Counted Stalled Cycles due to Load Ops"];
650 ( it->second )[
"DIV & SQRT Ops % of counted Stalled Cycles"] =
651 ( it->second )[
"Cycles spent during DIV & SQRT Ops"] * 100 / ( it->second )[
"Total Counted Stalled Cycles"];
653 ( it->second )[
"Cycles IFETCH served by Local DRAM"] =
655 ( it->second )[
"Cycles IFETCH served by L3 (Modified)"] =
657 ( it->second )[
"Cycles IFETCH served by L3 (Clean Snoop)"] =
659 ( it->second )[
"Cycles IFETCH served by Remote L2"] =
661 ( it->second )[
"Cycles IFETCH served by Remote DRAM"] =
663 ( it->second )[
"Cycles IFETCH served by L3 (No Snoop)"] =
665 ( it->second )[
"Total L2 IFETCH miss Impact"] =
666 ( it->second )[
"Cycles IFETCH served by Local DRAM"] + ( it->second )[
"Cycles IFETCH served by L3 (Modified)"] +
667 ( it->second )[
"Cycles IFETCH served by L3 (Clean Snoop)"] +
668 ( it->second )[
"Cycles IFETCH served by Remote L2"] + ( it->second )[
"Cycles IFETCH served by Remote DRAM"] +
669 ( it->second )[
"Cycles IFETCH served by L3 (No Snoop)"];
670 ( it->second )[
"Local DRAM IFECTHes % Impact"] =
671 ( it->second )[
"Cycles IFETCH served by Local DRAM"] * 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
672 ( it->second )[
"L3 (Modified) IFECTHes % Impact"] =
673 ( it->second )[
"Cycles IFETCH served by L3 (Modified)"] * 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
674 ( it->second )[
"L3 (Clean Snoop) IFECTHes % Impact"] = ( it->second )[
"Cycles IFETCH served by L3 (Clean Snoop)"] *
675 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
676 ( it->second )[
"Remote L2 IFECTHes % Impact"] =
677 ( it->second )[
"Cycles IFETCH served by Remote L2"] * 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
678 ( it->second )[
"Remote DRAM IFECTHes % Impact"] =
679 ( it->second )[
"Cycles IFETCH served by Remote DRAM"] * 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
680 ( it->second )[
"L3 (No Snoop) IFECTHes % Impact"] =
681 ( it->second )[
"Cycles IFETCH served by L3 (No Snoop)"] * 100 / ( it->second )[
"Total L2 IFETCH miss Impact"];
682 ( it->second )[
"Total L2 IFETCH misses"] = ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
683 ( it->second )[
"% of IFETCHes served by Local DRAM"] =
684 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:LOCAL_DRAM"] * 100 / ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
685 ( it->second )[
"% of IFETCHes served by L3 (Modified)"] =
686 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:OTHER_CORE_HITM"] * 100 / ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
687 ( it->second )[
"% of IFETCHes served by L3 (Clean Snoop)"] =
688 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:OTHER_CORE_HIT_SNP"] * 100 /
689 ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
690 ( it->second )[
"% of IFETCHes served by Remote L2"] =
691 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:REMOTE_CACHE_FWD"] * 100 /
692 ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
693 ( it->second )[
"% of IFETCHes served by Remote DRAM"] =
694 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:REMOTE_DRAM"] * 100 / ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
695 ( it->second )[
"% of IFETCHes served by L3 (No Snoop)"] =
696 ( it->second )[
"OFFCORE_RESPONSE_0:DMND_IFETCH:UNCORE_HIT"] * 100 / ( it->second )[
"L2_RQSTS:IFETCH_MISS"];
697 ( it->second )[
"% of L2 IFETCH misses"] =
698 ( it->second )[
"L2_RQSTS:IFETCH_MISS"] * 100 /
699 ( ( it->second )[
"L2_RQSTS:IFETCH_MISS"] + ( it->second )[
"L2_RQSTS:IFETCH_HIT"] );
700 ( it->second )[
"L1 ITLB Miss Impact"] =
703 ( it->second )[
"Total Branch Instructions Executed"] = ( it->second )[
"BR_INST_EXEC:ANY"];
704 ( it->second )[
"% of Mispredicted Branches"] =
705 ( it->second )[
"BR_MISP_EXEC:ANY"] * 100 / ( it->second )[
"BR_INST_EXEC:ANY"];
706 ( it->second )[
"Direct Near Calls % of Total Branches Executed"] =
707 ( it->second )[
"BR_INST_EXEC:DIRECT_NEAR_CALL"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
708 ( it->second )[
"Indirect Near Calls % of Total Branches Executed"] =
709 ( it->second )[
"BR_INST_EXEC:INDIRECT_NEAR_CALL"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
710 ( it->second )[
"Indirect Near Non-Calls % of Total Branches Executed"] =
711 ( it->second )[
"BR_INST_EXEC:INDIRECT_NON_CALL"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
712 ( it->second )[
"All Near Calls % of Total Branches Executed"] =
713 ( it->second )[
"BR_INST_EXEC:NEAR_CALLS"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
714 ( it->second )[
"All Non Calls % of Total Branches Executed"] =
715 ( it->second )[
"BR_INST_EXEC:NON_CALLS"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
716 ( it->second )[
"All Returns % of Total Branches Executed"] =
717 ( it->second )[
"BR_INST_EXEC:RETURN_NEAR"] * 100 / ( it->second )[
"Total Branch Instructions Executed"];
718 ( it->second )[
"Total Branch Instructions Retired"] = ( it->second )[
"BR_INST_RETIRED:ALL_BRANCHES"];
719 ( it->second )[
"Conditionals % of Total Branches Retired"] =
720 ( it->second )[
"BR_INST_RETIRED:CONDITIONAL"] * 100 / ( it->second )[
"Total Branch Instructions Retired"];
721 ( it->second )[
"Near Calls % of Total Branches Retired"] =
722 ( it->second )[
"BR_INST_RETIRED:NEAR_CALL"] * 100 / ( it->second )[
"Total Branch Instructions Retired"];
724 ( it->second )[
"Instruction Starvation % of Total Cycles"] =
725 ( ( it->second )[
"UOPS_ISSUED:ANY CMASK=1 INV=1"] - ( it->second )[
"RESOURCE_STALLS:ANY"] ) * 100 /
726 ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"];
727 ( it->second )[
"% of Total Cycles spent handling FP exceptions"] =
728 ( it->second )[
"UOPS_DECODED:MS CMASK=1"] * 100 / ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"];
729 ( it->second )[
"# of Instructions per Call"] =
730 ( it->second )[
"INST_RETIRED:ANY_P"] / ( it->second )[
"BR_INST_EXEC:NEAR_CALLS"];
732 ( it->second )[
"Instructions Retired"] = ( it->second )[
"INST_RETIRED:ANY_P"];
733 ( it->second )[
"ITLB Miss Rate in %"] =
734 ( ( it->second )[
"ITLB_MISS_RETIRED"] / ( it->second )[
"INST_RETIRED:ANY_P"] ) * 100;
736 ( it->second )[
"Branch Instructions"] = ( it->second )[
"BR_INST_RETIRED:ALL_BRANCHES"];
737 ( it->second )[
"Load Instructions"] = ( it->second )[
"MEM_INST_RETIRED:LOADS"];
738 ( it->second )[
"Store Instructions"] = ( it->second )[
"MEM_INST_RETIRED:STORES"];
739 ( it->second )[
"Other Instructions"] =
740 ( it->second )[
"Instructions Retired"] - ( it->second )[
"MEM_INST_RETIRED:LOADS"] -
741 ( it->second )[
"MEM_INST_RETIRED:STORES"] - ( it->second )[
"BR_INST_RETIRED:ALL_BRANCHES"];
742 ( it->second )[
"Packed UOPS Retired"] =
743 ( it->second )[
"SSEX_UOPS_RETIRED:PACKED_DOUBLE"] + ( it->second )[
"SSEX_UOPS_RETIRED:PACKED_SINGLE"];
744 ( it->second )[
"CPI"] = ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"] / ( it->second )[
"INST_RETIRED:ANY_P"];
746 double localPerformanceImprovement = ( it->second )[
"CPI"] /
EXPECTED_CPI;
747 double cyclesAfterImprovement = ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"] / localPerformanceImprovement;
748 double totalCyclesAfterImprovement =
749 totalCycles - ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"] + cyclesAfterImprovement;
750 ( it->second )[
"iMargin"] = 100 - ( totalCyclesAfterImprovement / totalCycles ) * 100;
752 ( it->second )[
"Load % of all Instructions"] =
753 ( it->second )[
"MEM_INST_RETIRED:LOADS"] * 100 / ( it->second )[
"INST_RETIRED:ANY_P"];
754 ( it->second )[
"Store % of all Instructions"] =
755 ( it->second )[
"MEM_INST_RETIRED:STORES"] * 100 / ( it->second )[
"INST_RETIRED:ANY_P"];
756 ( it->second )[
"Branch % of all Instructions"] =
757 ( it->second )[
"BR_INST_RETIRED:ALL_BRANCHES"] * 100 / ( it->second )[
"INST_RETIRED:ANY_P"];
758 ( it->second )[
"Other % of all Instructions"] =
759 ( it->second )[
"Other Instructions"] * 100 / ( it->second )[
"INST_RETIRED:ANY_P"];
761 ( it->second )[
"Packed % of all UOPS Retired"] =
762 ( it->second )[
"Packed UOPS Retired"] * 100 / ( it->second )[
"UOPS_RETIRED:ANY"];
782 total_num_samples = 0;
789 void init(
const char*
name,
const char* architecture,
const char* event_name,
unsigned int c_mask,
790 unsigned int inv_mask,
unsigned int smpl_period ) {
799 total_num_samples = total;
808 samples[index] += value;
811 bool get_max(
char* index,
unsigned int& value ) {
813 [](
const auto& lhs,
const auto& rhs ) {
return lhs.second < rhs.second; } );
814 if ( max_pos == samples.
end() )
return false;
815 strcpy( index, ( max_pos->first ).c_str() );
816 value = max_pos->second;
817 samples.
erase( max_pos );
831 for (
int i = 0; i <
n; i++ ) {
834 strcat( s_mod,
"<" );
837 strcat( s_mod,
">" );
840 strcat( s_mod,
"&" );
843 strcat( s_mod,
""" );
849 strcat( s_mod, to_app );
860 char* operator_string_begin =
const_cast<char*
>( strstr( demangled_symbol,
"operator" ) );
861 if ( operator_string_begin != NULL ) {
862 char* operator_string_end = operator_string_begin + 8;
863 while ( *operator_string_end ==
' ' ) operator_string_end++;
864 if ( strstr( operator_string_end,
"delete[]" ) == operator_string_end ) {
865 operator_string_end += 8;
866 *operator_string_end =
'\0';
867 }
else if ( strstr( operator_string_end,
"delete" ) == operator_string_end ) {
868 operator_string_end += 6;
869 *operator_string_end =
'\0';
870 }
else if ( strstr( operator_string_end,
"new[]" ) == operator_string_end ) {
871 operator_string_end += 5;
872 *operator_string_end =
'\0';
873 }
else if ( strstr( operator_string_end,
"new" ) == operator_string_end ) {
874 operator_string_end += 3;
875 *operator_string_end =
'\0';
876 }
else if ( strstr( operator_string_end,
">>=" ) == operator_string_end ) {
877 operator_string_end += 3;
878 *operator_string_end =
'\0';
879 }
else if ( strstr( operator_string_end,
"<<=" ) == operator_string_end ) {
880 operator_string_end += 3;
881 *operator_string_end =
'\0';
882 }
else if ( strstr( operator_string_end,
"->*" ) == operator_string_end ) {
883 operator_string_end += 3;
884 *operator_string_end =
'\0';
885 }
else if ( strstr( operator_string_end,
"<<" ) == operator_string_end ) {
886 operator_string_end += 2;
887 *operator_string_end =
'\0';
888 }
else if ( strstr( operator_string_end,
">>" ) == operator_string_end ) {
889 operator_string_end += 2;
890 *operator_string_end =
'\0';
891 }
else if ( strstr( operator_string_end,
">=" ) == operator_string_end ) {
892 operator_string_end += 2;
893 *operator_string_end =
'\0';
894 }
else if ( strstr( operator_string_end,
"<=" ) == operator_string_end ) {
895 operator_string_end += 2;
896 *operator_string_end =
'\0';
897 }
else if ( strstr( operator_string_end,
"==" ) == operator_string_end ) {
898 operator_string_end += 2;
899 *operator_string_end =
'\0';
900 }
else if ( strstr( operator_string_end,
"!=" ) == operator_string_end ) {
901 operator_string_end += 2;
902 *operator_string_end =
'\0';
903 }
else if ( strstr( operator_string_end,
"|=" ) == operator_string_end ) {
904 operator_string_end += 2;
905 *operator_string_end =
'\0';
906 }
else if ( strstr( operator_string_end,
"&=" ) == operator_string_end ) {
907 operator_string_end += 2;
908 *operator_string_end =
'\0';
909 }
else if ( strstr( operator_string_end,
"^=" ) == operator_string_end ) {
910 operator_string_end += 2;
911 *operator_string_end =
'\0';
912 }
else if ( strstr( operator_string_end,
"%=" ) == operator_string_end ) {
913 operator_string_end += 2;
914 *operator_string_end =
'\0';
915 }
else if ( strstr( operator_string_end,
"/=" ) == operator_string_end ) {
916 operator_string_end += 2;
917 *operator_string_end =
'\0';
918 }
else if ( strstr( operator_string_end,
"*=" ) == operator_string_end ) {
919 operator_string_end += 2;
920 *operator_string_end =
'\0';
921 }
else if ( strstr( operator_string_end,
"-=" ) == operator_string_end ) {
922 operator_string_end += 2;
923 *operator_string_end =
'\0';
924 }
else if ( strstr( operator_string_end,
"+=" ) == operator_string_end ) {
925 operator_string_end += 2;
926 *operator_string_end =
'\0';
927 }
else if ( strstr( operator_string_end,
"&&" ) == operator_string_end ) {
928 operator_string_end += 2;
929 *operator_string_end =
'\0';
930 }
else if ( strstr( operator_string_end,
"||" ) == operator_string_end ) {
931 operator_string_end += 2;
932 *operator_string_end =
'\0';
933 }
else if ( strstr( operator_string_end,
"[]" ) == operator_string_end ) {
934 operator_string_end += 2;
935 *operator_string_end =
'\0';
936 }
else if ( strstr( operator_string_end,
"()" ) == operator_string_end ) {
937 operator_string_end += 2;
938 *operator_string_end =
'\0';
939 }
else if ( strstr( operator_string_end,
"++" ) == operator_string_end ) {
940 operator_string_end += 2;
941 *operator_string_end =
'\0';
942 }
else if ( strstr( operator_string_end,
"--" ) == operator_string_end ) {
943 operator_string_end += 2;
944 *operator_string_end =
'\0';
945 }
else if ( strstr( operator_string_end,
"->" ) == operator_string_end ) {
946 operator_string_end += 2;
947 *operator_string_end =
'\0';
948 }
else if ( strstr( operator_string_end,
"<" ) == operator_string_end ) {
949 operator_string_end += 1;
950 *operator_string_end =
'\0';
951 }
else if ( strstr( operator_string_end,
">" ) == operator_string_end ) {
952 operator_string_end += 1;
953 *operator_string_end =
'\0';
954 }
else if ( strstr( operator_string_end,
"~" ) == operator_string_end ) {
955 operator_string_end += 1;
956 *operator_string_end =
'\0';
957 }
else if ( strstr( operator_string_end,
"!" ) == operator_string_end ) {
958 operator_string_end += 1;
959 *operator_string_end =
'\0';
960 }
else if ( strstr( operator_string_end,
"+" ) == operator_string_end ) {
961 operator_string_end += 1;
962 *operator_string_end =
'\0';
963 }
else if ( strstr( operator_string_end,
"-" ) == operator_string_end ) {
964 operator_string_end += 1;
965 *operator_string_end =
'\0';
966 }
else if ( strstr( operator_string_end,
"*" ) == operator_string_end ) {
967 operator_string_end += 1;
968 *operator_string_end =
'\0';
969 }
else if ( strstr( operator_string_end,
"/" ) == operator_string_end ) {
970 operator_string_end += 1;
971 *operator_string_end =
'\0';
972 }
else if ( strstr( operator_string_end,
"%" ) == operator_string_end ) {
973 operator_string_end += 1;
974 *operator_string_end =
'\0';
975 }
else if ( strstr( operator_string_end,
"^" ) == operator_string_end ) {
976 operator_string_end += 1;
977 *operator_string_end =
'\0';
978 }
else if ( strstr( operator_string_end,
"&" ) == operator_string_end ) {
979 operator_string_end += 1;
980 *operator_string_end =
'\0';
981 }
else if ( strstr( operator_string_end,
"|" ) == operator_string_end ) {
982 operator_string_end += 1;
983 *operator_string_end =
'\0';
984 }
else if ( strstr( operator_string_end,
"," ) == operator_string_end ) {
985 operator_string_end += 1;
986 *operator_string_end =
'\0';
987 }
else if ( strstr( operator_string_end,
"=" ) == operator_string_end ) {
988 operator_string_end += 1;
989 *operator_string_end =
'\0';
991 return operator_string_begin;
993 char* end_of_demangled_name =
const_cast<char*
>( strrchr( demangled_symbol,
')' ) );
994 if ( end_of_demangled_name != NULL ) {
997 while ( pars > 0 && end_of_demangled_name != demangled_symbol ) {
998 c = *( --end_of_demangled_name );
1001 }
else if ( c ==
'(' ) {
1006 return demangled_symbol;
1008 char* end_of_func_name = end_of_demangled_name;
1009 if ( end_of_func_name != NULL ) {
1010 *end_of_func_name =
'\0';
1011 char c = *( --end_of_func_name );
1014 while ( pars > 0 && end_of_func_name != demangled_symbol ) {
1015 c = *( --end_of_func_name );
1018 }
else if ( c ==
'<' ) {
1022 *end_of_func_name =
'\0';
1024 c = *( --end_of_func_name );
1025 while ( isalnum( c ) || c ==
'_' || c ==
'~' ) { c = *( --end_of_func_name ); }
1026 return ++end_of_func_name;
1028 return demangled_symbol;
1042 strcpy( module_filename, dir );
1043 strcat( module_filename,
"/HTML/" );
1044 strcat( module_filename, module_name );
1045 strcat( module_filename,
".html" );
1048 strcpy( event, ( cur_module->
get_event() ).c_str() );
1051 if ( result == modules_tot_samples.
end() )
1053 if ( ( !strcmp( event,
"UNHALTED_CORE_CYCLES" ) && !nehalem ) ||
1054 ( !strcmp( event,
"CPU_CLK_UNHALTED:THREAD_P" ) && nehalem ) ) {
1055 modules_tot_samples.
insert(
1060 module_file = fopen( module_filename,
"w" );
1061 if ( module_file == NULL ) {
1062 fprintf( stderr,
"ERROR: Cannot create file %s!!!\naborting...\n", module_filename );
1065 fprintf( module_file,
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" " 1066 "\"http://www.w3.org/TR/html4/loose.dtd\">\n" );
1067 fprintf( module_file,
"<html>\n" );
1068 fprintf( module_file,
"<head>\n" );
1069 fprintf( module_file,
"<title>\n" );
1070 fprintf( module_file,
"%s\n", module_name );
1071 fprintf( module_file,
"</title>\n" );
1072 fprintf( module_file,
"</head>\n" );
1073 fprintf( module_file,
"<body>\n" );
1074 fprintf( module_file,
"<h2>%s</h2><br/>Events Sampled:<br/>\n", module_name );
1075 fprintf( module_file,
"<ul>\n" );
1077 fprintf( module_file,
"<li><a href=\"#%s\">%s</a></li>\n", it->c_str(), it->c_str() );
1079 fprintf( module_file,
"</ul>\n" );
1082 if ( ( !strcmp( event,
"UNHALTED_CORE_CYCLES" ) && !nehalem ) ||
1083 ( !strcmp( event,
"CPU_CLK_UNHALTED:THREAD_P" ) && nehalem ) ) {
1086 module_file = fopen( module_filename,
"a" );
1090 strcpy( event_str, event );
1092 sprintf( event_str + strlen( event_str ),
" CMASK=%d", cur_module->
get_c_mask() );
1095 sprintf( event_str + strlen( event_str ),
" INV=%d", cur_module->
get_inv_mask() );
1097 fprintf( module_file,
"<a name=\"%s\"><a>\n", event_str );
1098 fprintf( module_file,
"<table cellpadding=\"5\">\n" );
1099 fprintf( module_file,
"<tr bgcolor=\"#EEEEEE\">\n" );
1100 fprintf( module_file,
1101 "<th colspan=\"6\" align=\"left\">%s -- cmask: %u -- invmask: %u -- Total Samples: %u -- " 1102 "Sampling Period: %d</th>\n",
1105 fprintf( module_file,
"</tr>\n" );
1106 fprintf( module_file,
"<tr bgcolor=\"#EEEEEE\">\n" );
1107 fprintf( module_file,
"<th align=\"left\">Samples</th>\n" );
1108 fprintf( module_file,
"<th align=\"left\">Percentage</th>\n" );
1109 fprintf( module_file,
"<th align=\"left\">Symbol Name</th>\n" );
1110 fprintf( module_file,
"<th align=\"left\">Library Name</th>\n" );
1111 fprintf( module_file,
"<th align=\"left\">Complete Signature</th>\n" );
1112 fprintf( module_file,
"<th align=\"left\">Library Pathname</th>\n" );
1113 fprintf( module_file,
"</tr>\n" );
1114 for (
int j = 0; j < 20; j++ ) {
1136 bool res = cur_module->
get_max( index, value );
1138 char* sym_end = strchr( index,
'%' );
1139 if ( sym_end == NULL )
1141 fprintf( stderr,
"ERROR: Invalid sym and lib name! : %s\naborting...\n", index );
1144 memcpy( sym, index, strlen( index ) - strlen( sym_end ) );
1145 strcpy( lib, sym_end + 1 );
1148 strcpy( temp, sym );
1149 strcpy( simple_sym, (
func_name( temp ) ) );
1150 if ( strrchr( lib,
'/' ) != NULL && *( strrchr( lib,
'/' ) + 1 ) !=
'\0' ) {
1151 strcpy( simple_lib, strrchr( lib,
'/' ) + 1 );
1153 strcpy( simple_lib, lib );
1156 fprintf( module_file,
"<tr bgcolor=\"#FFFFCC\">\n" );
1158 fprintf( module_file,
"<tr bgcolor=\"#CCFFCC\">\n" );
1160 fprintf( module_file,
"<td style=\"font-family:monospace;font-size:large;color:DarkBlue\">%u</td>\n", value );
1161 fprintf( module_file,
"<td style=\"font-family:monospace;font-size:large;color:DarkBlue\">%f%%</td>\n",
1167 fprintf( module_file,
"<td style=\"font-family:courier;\">%s</td>\n", simple_sym_mod );
1168 fprintf( module_file,
"<td style=\"font-family:courier;\">%s</td>\n", simple_lib_mod );
1169 fprintf( module_file,
"<td style=\"font-family:courier;\">%s</td>\n", sym_mod );
1170 fprintf( module_file,
"<td style=\"font-family:courier;\">%s</td>\n</tr>\n", lib_mod );
1172 fprintf( module_file,
"</table><br/><br/>\n" );
1173 int res = fclose( module_file );
1175 fprintf( stderr,
"ERROR: Cannot close file %s!!!\naborting...\n", module_filename );
1202 unsigned int module_num = 0;
1206 strcpy( path_name, dir );
1207 strcat( path_name,
"/" );
1208 strcat( path_name, filename );
1209 gzFile res_file = gzopen( path_name,
"rb" );
1211 if ( res_file != NULL ) {
1214 if ( line[strlen( line ) - 1] ==
'\n' ) line[strlen( line ) - 1] =
'\0';
1216 sscanf( line,
"%s %s %u %u %u", arch, event, &cmask, &inv, &sp );
1217 if ( !strcmp( arch,
"NHM" ) )
1223 if ( line[strlen( line ) - 1] ==
'\n' ) line[strlen( line ) - 1] =
'\0';
1224 if ( strchr( line,
' ' ) == NULL )
1226 if ( module_num > 0 ) {
1228 cur_module->
clear();
1231 char* end_sym = strchr( line,
'%' );
1232 if ( end_sym == NULL )
1234 fprintf( stderr,
"ERROR: Invalid module name. \nLINE: %s\naborting...\n", line );
1238 memcpy( cur_module_name, line, strlen( line ) - strlen( end_sym ) );
1239 cur_module->
init( cur_module_name, arch, event, cmask, inv, sp );
1240 cur_module->
set_total( atoi( end_sym + 1 ) );
1244 unsigned int value = 0, libOffset = 0;
1254 sscanf( line,
"%s %s %u %u", symbol, libName, &libOffset, &value );
1255 char realPathName_s[FILENAME_MAX];
1256 bzero( realPathName_s, FILENAME_MAX );
1257 char* realPathName = realpath( libName, realPathName_s );
1258 if ( realPathName != NULL && strlen( realPathName ) > 0 ) {
1260 result = libsInfo.
find( realPathName );
1261 if ( result == libsInfo.
end() ) { libsInfo[realPathName] =
FileInfo( realPathName,
true ); }
1262 const char* temp_sym = libsInfo[realPathName].symbolByOffset( libOffset );
1263 if ( temp_sym != NULL && strlen( temp_sym ) > 0 ) {
1265 char* demangled_symbol = abi::__cxa_demangle( temp_sym, NULL, NULL, &status );
1266 if ( status == 0 ) {
1267 strcpy( final_sym, demangled_symbol );
1268 free( demangled_symbol );
1270 strcpy( final_sym, temp_sym );
1273 strcpy( final_sym,
"???" );
1275 strcpy( final_lib, realPathName );
1277 strcpy( final_sym, symbol );
1278 strcpy( final_lib, libName );
1282 strcpy( index, final_sym );
1283 strcat( index,
"%" );
1284 strcat( index, final_lib );
1290 cur_module->
clear();
1291 gzclose( res_file );
1294 fprintf( stderr,
"ERROR: Unable to open input file: %s\naborting...\n", filename );
1316 strcpy( path_name, dir );
1317 strcat( path_name,
"/" );
1318 strcat( path_name, filename );
1319 gzFile res_file = gzopen( path_name,
"rb" );
1320 if ( res_file != NULL ) {
1323 if ( line[strlen( line ) - 1] ==
'\n' ) line[strlen( line ) - 1] =
'\0';
1325 sscanf( line,
"%s %s %s %s %s\n", arch, event, cmask_str, inv_str, sp_str );
1327 if ( atoi( cmask_str ) > 0 ) {
1328 event_str +=
" CMASK=";
1329 event_str += cmask_str;
1331 if ( atoi( inv_str ) > 0 ) {
1332 event_str +=
" INV=";
1333 event_str += inv_str;
1338 fprintf( stderr,
"ERROR: Unable to open input file: %s\naborting...\n", filename );
1349 i != modules_tot_samples.
end(); i++ ) {
1351 strcpy( module_filename, dir );
1352 strcat( module_filename,
"/HTML/" );
1353 strcat( module_filename, ( i->first ).c_str() );
1354 strcat( module_filename,
".html" );
1355 FILE* module_file = fopen( module_filename,
"a" );
1356 if ( module_file == NULL ) {
1357 fprintf( stderr,
"ERROR: Unable to append to file: %s\naborting...\n", module_filename );
1360 fprintf( module_file,
"</body>\n</html>\n" );
1361 if ( fclose( module_file ) ) {
1362 fprintf( stderr,
"ERROR: Cannot close file %s!!!\naborting...\n", module_filename );
1389 int number_of_modules = 0;
1391 int no_of_values = 0;
1394 strcpy( path_name, dir );
1395 strcat( path_name,
"/" );
1396 strcat( path_name, filename );
1397 FILE* fp = fopen( path_name,
"r" );
1398 int stat = fscanf( fp,
"%s %s %s %s %s\n", arch, event, cmask_str, inv_str, sp_str );
1403 if ( !strcmp( arch,
"NHM" ) )
1408 if ( atoi( cmask_str ) > 0 ) {
1409 event_str +=
" CMASK=";
1410 event_str += cmask_str;
1412 if ( atoi( inv_str ) > 0 ) {
1413 event_str +=
" INV=";
1414 event_str += inv_str;
1417 while ( fscanf( fp,
"%s\n", line ) != EOF ) {
1418 if ( isalpha( line[0] ) )
1420 if ( number_of_modules > 0 ) {
1421 C_modules[cur_module_name][event_str] = (double)cur_sum / no_of_values;
1425 strcpy( cur_module_name, line );
1426 number_of_modules++;
1427 }
else if ( isdigit( line[0] ) )
1429 cur_sum += strtol( line, NULL, 10 );
1433 C_modules[cur_module_name][event_str] = (double)cur_sum / no_of_values;
1435 return number_of_modules;
1441 "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" );
1442 fprintf( fp,
"<html>\n" );
1443 fprintf( fp,
"<head>\n" );
1444 fprintf( fp,
"<title>\n" );
1445 fprintf( fp,
"Analysis Result\n" );
1446 fprintf( fp,
"</title>\n" );
1447 fprintf( fp,
"<script src=\"sorttable.js\"></script>\n" );
1448 fprintf( fp,
"<style>\ntable.sortable thead " 1449 "{\nbackground-color:#eee;\ncolor:#666666;\nfont-weight:bold;\ncursor:default;\nfont-family:courier;\n}" 1451 fprintf( fp,
"</head>\n" );
1452 fprintf( fp,
"<body link=\"black\">\n" );
1453 fprintf( fp,
"<h1>RESULTS:</h1><br/>Click for detailed symbol view...<p/>\n" );
1454 fprintf( fp,
"<table class=\"sortable\" cellpadding=\"5\">\n" );
1455 fprintf( fp,
"<tr>\n" );
1456 fprintf( fp,
"<th>MODULE NAME</th>\n" );
1458 if ( strlen( it->c_str() ) == 0 )
1459 fprintf( fp,
"<th bgcolor=\"#FFFFFF\"> </th>\n" );
1461 fprintf( fp,
"<th>%s</th>\n", ( *it ).c_str() );
1463 fprintf( fp,
"</tr>\n" );
1472 fprintf( fp,
"<tr bgcolor=\"#FFFFCC\">\n" );
1474 fprintf( fp,
"<tr bgcolor=\"#CCFFCC\">\n" );
1475 fprintf( fp,
"<td style=\"font-family:monospace;font-size:large;color:Black\"><a href=\"%s.html\">%s</a></td>\n",
1476 ( it->first ).c_str(), ( it->first ).c_str() );
1478 if ( strlen( jt->c_str() ) == 0 ) {
1479 fprintf( fp,
"<td bgcolor=\"#FFFFFF\"> </td>" );
1481 if ( ( it->second ).find( *jt ) == ( it->second ).
end() ) {
1482 fprintf( stderr,
"ERROR: Cannot find derivate value \"%s\"!!!\naborting...\n", ( *jt ).c_str() );
1485 fprintf( fp,
"<td style=\"font-family:monospace;font-size:large;color:DarkBlue\" align=\"right\">%.2f</td>\n",
1486 ( it->second )[*jt] );
1489 fprintf( fp,
"</tr>\n" );
1495 fprintf( fp,
"</table>\n</body>\n</html>\n" );
1500 fprintf( fp,
"MODULE NAME" );
1502 if ( strlen( it->c_str() ) == 0 ) {
1504 fprintf( fp,
",%s", ( *it ).c_str() );
1506 fprintf( fp,
"\n" );
1513 fprintf( fp,
"%s", ( it->first ).c_str() );
1515 if ( strlen( jt->c_str() ) == 0 ) {
1517 if ( ( it->second ).find( *jt ) == ( it->second ).
end() ) {
1518 fprintf( stderr,
"ERROR: Cannot find derivate value \"%s\"!!!\naborting...\n", ( *jt ).c_str() );
1521 fprintf( fp,
",%.2f", ( it->second )[*jt] );
1524 fprintf( fp,
"\n" );
1537 double counter_value;
1540 counter_value = ( it->second )[field];
1541 if ( max < counter_value ) max = counter_value;
1543 if ( value > 0 && max > 0 && normalizeTo > 0 ) {
1544 return 1. * value / max * normalizeTo;
1559 1. -
normalize(
"Packed % of all UOPS Retired", ( it->second )[
"Packed % of all UOPS Retired"], 1 );
1560 double misspnorm =
normalize(
"% of Mispredicted Branches", ( it->second )[
"% of Mispredicted Branches"], 1 );
1561 double stallnorm =
normalize(
"Stalled Cycles", ( it->second )[
"Stalled Cycles"], 1 );
1562 ( it->second )[
"iFactor"] = stallnorm * ( simdnorm + misspnorm + stallnorm );
1568 1. -
normalize(
"Packed SIMD % of all Instructions", ( it->second )[
"Packed SIMD % of all Instructions"], 1 );
1569 double misspnorm =
normalize(
"% of Mispredicted Branches", ( it->second )[
"% of Mispredicted Branches"], 1 );
1570 double stallnorm =
normalize(
"Stalled Cycles", ( it->second )[
"Stalled Cycles"], 1 );
1571 ( it->second )[
"iFactor"] = stallnorm * ( simdnorm + misspnorm + stallnorm );
1585 sum += ( it->second )[
"CPU_CLK_UNHALTED:THREAD_P"];
1590 sum += ( it->second )[
"UNHALTED_CORE_CYCLES"];
1600 if ( argc < 2 || argc > 4 ) {
1601 printf(
"\n\nUsage: %s DIRECTORY [--caa] [--csv]\n\n", argv[0] );
1607 for (
int i = 2; i <
argc; i++ ) {
1608 if ( !strcmp( argv[i],
"--caa" ) ) caa =
true;
1609 if ( !strcmp( argv[i],
"--csv" ) ) csv =
true;
1613 strcpy( dir, argv[1] );
1615 strcat( dir,
"/HTML" );
1616 int res = mkdir( dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
1618 fprintf( stderr,
"ERROR: Cannot create directory %s\naborting...\n", dir );
1624 struct dirent* dirp;
1625 int num_of_modules = 0;
1626 if ( ( dp = opendir( argv[1] ) ) == NULL ) {
1627 printf(
"Error(%d) opening %s\n", errno, argv[1] );
1630 while ( ( dirp = readdir( dp ) ) != NULL ) {
1631 if ( strstr( dirp->d_name,
"_S_" ) != NULL && strstr( dirp->d_name,
".txt.gz" ) != NULL && !csv ) {
1633 fprintf( stderr,
"ERROR: Cannot read file %s\naborting...\n", dirp->d_name );
1639 sort( S_events.
begin(), S_events.
end() );
1640 if ( ( dp = opendir( argv[1] ) ) == NULL ) {
1641 printf(
"Error(%d) opening %s\n", errno, argv[1] );
1644 while ( ( dirp = readdir( dp ) ) != NULL ) {
1645 if ( strstr( dirp->d_name,
"_S_" ) != NULL && strstr( dirp->d_name,
".txt.gz" ) != NULL && !csv ) {
1647 fprintf( stderr,
"ERROR: Cannot read file %s\naborting...\n", dirp->d_name );
1650 }
else if ( strstr( dirp->d_name,
"_C_" ) != NULL && strstr( dirp->d_name,
".txt" ) != NULL ) {
1652 if ( res > num_of_modules ) { num_of_modules = res; }
1659 fprintf( stderr,
"ERROR: Cannot finalize HTML pages!!!\naborting...\n" );
1667 sprintf( filepath,
"%s/HTML/index.html", argv[1] );
1669 sprintf( filepath,
"%s/results.csv", argv[1] );
1670 FILE* fp = fopen( filepath,
"w" );
1672 fprintf( stderr,
"ERROR: Cannot create file index.html!!!\naborting...\n" );
1681 fprintf( stderr,
"(core) ERROR: One or more events for CAA missing!\naborting...\n" );
1698 fprintf( stderr,
"(nehalem) ERROR: One or more events for CAA missing!\naborting...\n" );
1729 sprintf( src,
"sorttable.js" );
1730 sprintf( dst,
"%s/HTML/sorttable.js", argv[1] );
1731 int fd_src = open( src, O_RDONLY );
1732 if ( fd_src == -1 ) {
1733 fprintf( stderr,
"ERROR: Cannot open file \"%s\"!\naborting...\n", src );
1736 int fd_dst = open( dst, O_WRONLY | O_CREAT | O_TRUNC, 0644 );
1737 if ( fd_dst == -1 ) {
1738 fprintf( stderr,
"ERROR: Cannot open file \"%s\" (%s)!\naborting...\n", dst, strerror( errno ) );
1742 while (
read( fd_src, &c, 1 ) ) {
1743 if ( write( fd_dst, &c, 1 ) == -1 ) {
#define MAX_EVENT_NAME_LENGTH
std::map< std::string, unsigned int > samples
unsigned int get_inv_mask()
#define I7_L3_UNSHARED_HIT_CYCLES
const char * func_name(const char *demangled_symbol)
const char * symbolByOffset(Offset offset)
bool skipString(const char *strptr, const char *srcbuffer, const char **dstbuffer)
#define MAX_SAMPLE_INDEX_LENGTH
#define CORE_UNKNOWN_ADDR_STORE_CYCLES
#define CORE_LCP_STALL_CYCLES
void put_C_footer(FILE *fp)
void put_S_module(S_module *cur_module, const char *dir)
double sum(double x, double y, double z)
#define I7_L3_MISS_REMOTE_DRAM_HIT_CYCLES
void init_core_caa_events_displ()
void put_C_modules(FILE *fp, std::vector< std::string > &columns)
void init_core_caa_events()
def read(f, regex='.*', skipevents=0)
#define I7_IFETCH_L2_MISS_L3_HITM
int read_S_file(const char *dir, const char *filename)
std::vector< CacheItem > SymbolCache
#define I7_IFETCH_L3_MISS_REMOTE_CACHE_FWD
bool check_for_nhm_caa_events()
unsigned int get_smpl_period()
std::istringstream & output(void)
#define MAX_ARCH_NAME_LENGTH
void add_sample(const char *index, unsigned int value)
#define I7_OTHER_CORE_L2_HITM_CYCLES
double normalize(std::string field, double value, double normalizeTo)
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
#define CORE_L1_DTLB_MISS_CYCLES
FileInfo(const std::string &name, bool useGdb)
#define CORE_OVERLAPPING_CYCLES
void calc_post_deriv_values()
void calc_nhm_deriv_values(double totalCycles)
#define MAX_SIMPLE_SYM_LENGTH
void init_nhm_caa_events_displ()
#define MAX_LIB_MOD_LENGTH
int finalize_S_html_pages(const char *dir)
void put_C_header(FILE *fp, std::vector< std::string > &columns)
#define MAX_SIMPLE_LIB_MOD_LENGTH
void init_nhm_caa_events()
#define I7_L1_ITLB_WALK_COMPLETED_CYCLES
void calc_core_deriv_values(double totalCycles)
#define MAX_SP_STR_LENGTH
Offset next(Offset offset)
void init(const char *name, const char *architecture, const char *event_name, unsigned int c_mask, unsigned int inv_mask, unsigned int smpl_period)
#define I7_L3_MISS_LOCAL_DRAM_HIT_CYCLES
unsigned int total_num_samples
void set_total(unsigned int total)
#define I7_OTHER_CORE_L2_HIT_CYCLES
void html_special_chars(const char *s, char *s_mod)
#define MAX_CMASK_STR_LENGTH
#define I7_L3_MISS_REMOTE_CACHE_HIT_CYCLES
#define CORE_SPAN_ACROSS_CACHE_LINE_CYCLES
int read_S_events(const char *dir, const char *filename)
#define I7_IFETCH_L2_MISS_L3_HIT_NO_SNOOP
#define I7_L1_DTLB_WALK_COMPLETED_CYCLES
bool operator()(const int &a, const CacheItem &b) const
#define I7_IFETCH_L3_MISS_LOCAL_DRAM_HIT
#define MAX_FILENAME_LENGTH
#define CORE_L2_MISS_CYCLES
void put_C_header_csv(FILE *fp, std::vector< std::string > &columns)
#define PIPE_BUFFER_LENGTH
void createOffsetMap(void)
#define MAX_SIMPLE_SYM_MOD_LENGTH
SymbolCache m_symbolCache
#define MAX_INV_STR_LENGTH
bool check_for_core_caa_events()
#define I7_IFETCH_L3_MISS_REMOTE_DRAM_HIT
PipeReader(const char *cmd)
bool operator()(const CacheItem &a, const int &b) const
void put_C_modules_csv(FILE *fp, std::vector< std::string > &columns)
unsigned int get_total_num_samples()
#define MAX_MODULE_NAME_LENGTH
AttribStringParser::Iterator begin(const AttribStringParser &parser)
#define MAX_SIMPLE_LIB_LENGTH
bool skipWhitespaces(const char *srcbuffer, const char **destbuffer)
#define I7_IFETCH_L2_MISS_L3_HIT_SNOOP
bool get_max(char *index, unsigned int &value)
int read_C_file(const char *dir, const char *filename)
int main(int argc, char *argv[])
std::string get_module_name()
#define CORE_L2_HIT_CYCLES
#define MAX_SYM_MOD_LENGTH
unsigned int get_c_mask()