| 84 | ~statistics_logger () { fclose(my_file); } |
| 85 | |
| 86 | void record( const statistics_counters& c, size_t id ) { |
| 87 | spin_mutex::scoped_lock lock(my_mutex); |
| 88 | counters_to_dump = &c; |
| 89 | #if __TBB_STATISTICS_TOTALS_ONLY |
| 90 | if ( id == arena_counters_total ) { |
| 91 | dump( "%-*s", IDColumnWidth, "Tot" ); |
| 92 | process_groups( &statistics_logger::print_field_values ); |
| 93 | } |
| 94 | #else /* !__TBB_STATISTICS_TOTALS_ONLY */ |
| 95 | const char* idString = NULL; |
| 96 | switch ( id ) { |
| 97 | case 0: |
| 98 | idString = "M"; break; |
| 99 | case workers_counters_total: |
| 100 | idString = "Wtot"; break; |
| 101 | case arena_counters_total: |
| 102 | idString = "Tot"; break; |
| 103 | default: |
| 104 | dump( "W%-*u", IDColumnWidth - 1, id ); |
| 105 | } |
| 106 | if ( idString ) |
| 107 | dump( "%-*s", IDColumnWidth, idString ); |
| 108 | process_groups( &statistics_logger::print_field_values ); |
| 109 | #endif /* !__TBB_STATISTICS_TOTALS_ONLY */ |
| 110 | } |
| 111 | private: |
| 112 | static const size_t IDColumnWidth = 5; |
| 113 | static const size_t StatisticsColumnWidth = 10; |