Changeset 472 for trunk/lib/perflib


Ignore:
Timestamp:
Jul 12, 2010, 12:22:09 PM (9 years ago)
Author:
cameron
Message:

Remove minimum timestamp overhead in profiler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/perflib/BOM_Profiler.h

    r462 r472  
    9292}
    9393
     94#define SEQ_TIMESTAMP_COUNT 8
     95
    9496void dump_BOM_table(BOM_Table * timer_table) {
    9597  // an array of counts and timings per binary order of magnitude
     
    9799  unsigned int BOM_elems[BIT_COUNT]; 
    98100  timestamp_t BOM_total_time[BIT_COUNT];
    99 
    100   int BOM, b;
     101  int i, BOM, b;
    101102  int this_count;
    102103  int cum_count = 0;
     
    110111  timestamp_t cum_avg;
    111112  timestamp_t accumulated_cycles; 
     113  timestamp_t sequential_stamps[SEQ_TIMESTAMP_COUNT];
     114  timestamp_t timestamp_overhead;
     115
     116/*  Calculate minimum overhead of timestamps.  */
     117
     118  sequential_stamps[0] = read_cycle_counter();
     119  sequential_stamps[1] = read_cycle_counter();
     120  sequential_stamps[2] = read_cycle_counter();
     121  sequential_stamps[3] = read_cycle_counter();
     122  sequential_stamps[4] = read_cycle_counter();
     123  sequential_stamps[5] = read_cycle_counter();
     124  sequential_stamps[6] = read_cycle_counter();
     125  sequential_stamps[7] = read_cycle_counter();
     126  timestamp_overhead = sequential_stamps[1] - sequential_stamps[0];
     127  for (i = 2; i < SEQ_TIMESTAMP_COUNT; i++) {
     128    if (sequential_stamps[i] - sequential_stamps[i-1] < timestamp_overhead)
     129         timestamp_overhead = sequential_stamps[i] - sequential_stamps[i-1];
     130  }
     131//  fprintf(stderr, "timestamp_overhead = %i\n", timestamp_overhead);
     132
    112133
    113134  for (b = 0; b < BIT_COUNT; b++) {
     
    120141  total_entries = timer_table->full ? MAX_TIMER_ENTRIES : timer_table->current_entry;
    121142  for(entry = 0; entry < total_entries; entry++){
    122         accumulated_cycles = timer_table->interval_end[entry] - timer_table->interval_start[entry];
     143        accumulated_cycles = timer_table->interval_end[entry] - timer_table->interval_start[entry] - timestamp_overhead;
    123144        if (accumulated_cycles > 0ULL) {
    124145//        cout << "accumulated_cycles =" << accumulated_cycles << "; elems = " << timer_table->interval_elems[entry] << endl;
Note: See TracChangeset for help on using the changeset viewer.