- Timestamp:
- Jun 25, 2020, 2:30:46 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 566fde0
- Parents:
- 8e27ac45
- Location:
- libcfa/src/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r8e27ac45 r69fbc61 241 241 242 242 #if !defined(__CFA_NO_STATISTICS__) 243 print_stats = false;243 print_stats = 0; 244 244 print_halts = false; 245 245 #endif … … 281 281 282 282 #if !defined(__CFA_NO_STATISTICS__) 283 print_stats = false;283 print_stats = 0; 284 284 stats = alloc(); 285 285 __init_stats( stats ); … … 297 297 298 298 #if !defined(__CFA_NO_STATISTICS__) 299 if( this.print_stats) {300 __print_stats( this.stats, t rue, this.name, (void*)&this );299 if( 0 != this.print_stats ) { 300 __print_stats( this.stats, this.print_stats, true, this.name, (void*)&this ); 301 301 } 302 302 free( this.stats ); … … 568 568 #if !defined(__CFA_NO_STATISTICS__) 569 569 __tally_stats(proc->cltr->stats, &local_stats); 570 if( proc->print_stats) {571 __print_stats( &local_stats, true, proc->name, (void*)proc );570 if( 0 != proc->print_stats ) { 571 __print_stats( &local_stats, proc->print_stats, true, proc->name, (void*)proc ); 572 572 } 573 573 #endif -
libcfa/src/concurrency/kernel.hfa
r8e27ac45 r69fbc61 106 106 107 107 #if !defined(__CFA_NO_STATISTICS__) 108 boolprint_stats;108 int print_stats; 109 109 bool print_halts; 110 110 #endif … … 207 207 208 208 #if !defined(__CFA_NO_STATISTICS__) 209 bool print_stats;210 209 struct __stats_t * stats; 210 int print_stats; 211 211 #endif 212 212 }; … … 229 229 230 230 #if !defined(__CFA_NO_STATISTICS__) 231 static inline void print_stats_at_exit( cluster & this ) {232 this.print_stats = true;231 static inline void print_stats_at_exit( cluster & this, int flags ) { 232 this.print_stats |= flags; 233 233 } 234 234 235 static inline void print_stats_at_exit( processor & this ) {236 this.print_stats = true;235 static inline void print_stats_at_exit( processor & this, int flags ) { 236 this.print_stats |= flags; 237 237 } 238 238 -
libcfa/src/concurrency/stats.cfa
r8e27ac45 r69fbc61 73 73 } 74 74 75 void __print_stats( struct __stats_t * stats, bool cluster, const char * name, void * id ) with( *stats ) {75 void __print_stats( struct __stats_t * stats, int flags, bool cluster, const char * name, void * id ) with( *stats ) { 76 76 77 double push_sur = (100.0 * ((double)ready.pick.push.success) / ready.pick.push.attempt); 78 double pop_sur = (100.0 * ((double)ready.pick.pop .success) / ready.pick.pop .attempt); 77 if( flags & CFA_STATS_READY_Q ) { 78 double push_sur = (100.0 * ((double)ready.pick.push.success) / ready.pick.push.attempt); 79 double pop_sur = (100.0 * ((double)ready.pick.pop .success) / ready.pick.pop .attempt); 79 80 80 double push_len = ((double)ready.pick.push.attempt) / ready.pick.push.success;81 double pop_len = ((double)ready.pick.pop .attempt) / ready.pick.pop .success;81 double push_len = ((double)ready.pick.push.attempt) / ready.pick.push.success; 82 double pop_len = ((double)ready.pick.pop .attempt) / ready.pick.pop .success; 82 83 83 double lpush_sur = (100.0 * ((double)ready.pick.push.lsuccess) / ready.pick.push.local);84 double lpop_sur = (100.0 * ((double)ready.pick.pop .lsuccess) / ready.pick.pop .local);84 double lpush_sur = (100.0 * ((double)ready.pick.push.lsuccess) / ready.pick.push.local); 85 double lpop_sur = (100.0 * ((double)ready.pick.pop .lsuccess) / ready.pick.pop .local); 85 86 86 double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess; 87 double lpop_len = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess; 87 double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess; 88 double lpop_len = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess; 89 90 __cfaabi_bits_print_safe( STDOUT_FILENO, 91 "----- %s \"%s\" (%p) - Ready Q Stats -----\n" 92 "- total threads run : %'15lu\n" 93 "- total threads scheduled: %'15lu\n" 94 "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 95 "- pop average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 96 "- local push avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 97 "- local pop avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 98 "- thread migrations : %'15lu\n" 99 "- Idle Sleep -\n" 100 "-- halts : %'15lu\n" 101 "-- cancelled halts : %'15lu\n" 102 "-- schedule wake : %'15lu\n" 103 "-- wake on exit : %'15lu\n" 104 "\n" 105 , cluster ? "Cluster" : "Processor", name, id 106 , ready.pick.pop.success 107 , ready.pick.push.success 108 , push_len, push_sur, ready.pick.push.attempt 109 , pop_len , pop_sur , ready.pick.pop .attempt 110 , lpush_len, lpush_sur, ready.pick.push.local 111 , lpop_len , lpop_sur , ready.pick.pop .local 112 , ready.threads.migration 113 , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits 114 ); 115 } 88 116 89 117 #if defined(HAVE_LINUX_IO_URING_H) 90 double avgrdy = ((double)io.submit_q.submit_avg.rdy) / io.submit_q.submit_avg.cnt; 91 double avgcsm = ((double)io.submit_q.submit_avg.csm) / io.submit_q.submit_avg.cnt; 92 double avgavl = ((double)io.submit_q.submit_avg.avl) / io.submit_q.submit_avg.cnt; 118 if( flags & CFA_STATS_IO ) { 119 double avgrdy = ((double)io.submit_q.submit_avg.rdy) / io.submit_q.submit_avg.cnt; 120 double avgcsm = ((double)io.submit_q.submit_avg.csm) / io.submit_q.submit_avg.cnt; 121 double avgavl = ((double)io.submit_q.submit_avg.avl) / io.submit_q.submit_avg.cnt; 93 122 94 double lavgv = 0; 95 double lavgb = 0; 96 if(io.submit_q.look_avg.cnt != 0) { 97 lavgv = ((double)io.submit_q.look_avg.val ) / io.submit_q.look_avg.cnt; 98 lavgb = ((double)io.submit_q.look_avg.block) / io.submit_q.look_avg.cnt; 123 double lavgv = 0; 124 double lavgb = 0; 125 if(io.submit_q.look_avg.cnt != 0) { 126 lavgv = ((double)io.submit_q.look_avg.val ) / io.submit_q.look_avg.cnt; 127 lavgb = ((double)io.submit_q.look_avg.block) / io.submit_q.look_avg.cnt; 128 } 129 130 double aavgv = 0; 131 double aavgb = 0; 132 if(io.submit_q.alloc_avg.cnt != 0) { 133 aavgv = ((double)io.submit_q.alloc_avg.val ) / io.submit_q.alloc_avg.cnt; 134 aavgb = ((double)io.submit_q.alloc_avg.block) / io.submit_q.alloc_avg.cnt; 135 } 136 137 __cfaabi_bits_print_safe( STDOUT_FILENO, 138 "----- %s \"%s\" (%p) - I/O Stats -----\n" 139 "- total submit calls : %'15lu\n" 140 "- avg ready entries : %'18.2lf\n" 141 "- avg submitted entries : %'18.2lf\n" 142 "- avg available entries : %'18.2lf\n" 143 "- total ready search : %'15lu\n" 144 "- avg ready search len : %'18.2lf\n" 145 "- avg ready search block : %'18.2lf\n" 146 "- total alloc search : %'15lu\n" 147 "- avg alloc search len : %'18.2lf\n" 148 "- avg alloc search block : %'18.2lf\n" 149 "- total wait calls : %'15lu (%'lu slow, %'lu fast)\n" 150 "- avg completion/wait : %'18.2lf\n" 151 "\n" 152 , cluster ? "Cluster" : "Processor", name, id 153 , io.submit_q.submit_avg.cnt 154 , avgrdy, avgcsm, avgavl 155 , io.submit_q.look_avg.cnt 156 , lavgv, lavgb 157 , io.submit_q.alloc_avg.cnt 158 , aavgv, aavgb 159 , io.complete_q.completed_avg.slow_cnt + io.complete_q.completed_avg.fast_cnt 160 , io.complete_q.completed_avg.slow_cnt, io.complete_q.completed_avg.fast_cnt 161 , ((double)io.complete_q.completed_avg.val) / (io.complete_q.completed_avg.slow_cnt + io.complete_q.completed_avg.fast_cnt) 162 ); 99 163 } 100 101 double aavgv = 0;102 double aavgb = 0;103 if(io.submit_q.alloc_avg.cnt != 0) {104 aavgv = ((double)io.submit_q.alloc_avg.val ) / io.submit_q.alloc_avg.cnt;105 aavgb = ((double)io.submit_q.alloc_avg.block) / io.submit_q.alloc_avg.cnt;106 }107 #endif108 109 __cfaabi_bits_print_safe( STDOUT_FILENO,110 "----- %s \"%s\" (%p) - Ready Q Stats -----\n"111 "- total threads run : %'15lu\n"112 "- total threads scheduled: %'15lu\n"113 "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"114 "- pop average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"115 "- local push avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"116 "- local pop avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n"117 "- thread migrations : %'15lu\n"118 "- Idle Sleep -\n"119 "-- halts : %'15lu\n"120 "-- cancelled halts : %'15lu\n"121 "-- schedule wake : %'15lu\n"122 "-- wake on exit : %'15lu\n"123 "\n"124 , cluster ? "Cluster" : "Processor", name, id125 , ready.pick.pop.success126 , ready.pick.push.success127 , push_len, push_sur, ready.pick.push.attempt128 , pop_len , pop_sur , ready.pick.pop .attempt129 , lpush_len, lpush_sur, ready.pick.push.local130 , lpop_len , lpop_sur , ready.pick.pop .local131 , ready.threads.migration132 , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits133 );134 #if defined(HAVE_LINUX_IO_URING_H)135 __cfaabi_bits_print_safe( STDOUT_FILENO,136 "----- %s \"%s\" (%p) - I/O Stats -----\n"137 "- total submit calls : %'15lu\n"138 "- avg ready entries : %'18.2lf\n"139 "- avg submitted entries : %'18.2lf\n"140 "- avg available entries : %'18.2lf\n"141 "- total ready search : %'15lu\n"142 "- avg ready search len : %'18.2lf\n"143 "- avg ready search block : %'18.2lf\n"144 "- total alloc search : %'15lu\n"145 "- avg alloc search len : %'18.2lf\n"146 "- avg alloc search block : %'18.2lf\n"147 "- total wait calls : %'15lu (%'lu slow, %'lu fast)\n"148 "- avg completion/wait : %'18.2lf\n"149 "\n"150 , cluster ? "Cluster" : "Processor", name, id151 , io.submit_q.submit_avg.cnt152 , avgrdy, avgcsm, avgavl153 , io.submit_q.look_avg.cnt154 , lavgv, lavgb155 , io.submit_q.alloc_avg.cnt156 , aavgv, aavgb157 , io.complete_q.completed_avg.slow_cnt + io.complete_q.completed_avg.fast_cnt158 , io.complete_q.completed_avg.slow_cnt, io.complete_q.completed_avg.fast_cnt159 , ((double)io.complete_q.completed_avg.val) / (io.complete_q.completed_avg.slow_cnt + io.complete_q.completed_avg.fast_cnt)160 );161 164 #endif 162 165 } -
libcfa/src/concurrency/stats.hfa
r8e27ac45 r69fbc61 7 7 static inline void __init_stats( struct __stats_t * ) {} 8 8 static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {} 9 static inline void __print_stats( struct __stats_t *, bool, const char *, void * ) {}9 static inline void __print_stats( struct __stats_t *, int, bool, const char *, void * ) {} 10 10 #else 11 enum { 12 CFA_STATS_READY_Q = 0x01, 13 #if defined(HAVE_LINUX_IO_URING_H) 14 CFA_STATS_IO = 0x02, 15 #endif 16 }; 17 11 18 struct __attribute__((aligned(64))) __stats_readQ_t { 12 19 struct { … … 96 103 void __init_stats ( struct __stats_t * ); 97 104 void __tally_stats( struct __stats_t *, struct __stats_t * ); 98 void __print_stats( struct __stats_t *, bool, const char *, void * );105 void __print_stats( struct __stats_t *, int, bool, const char *, void * ); 99 106 #endif 100 107
Note: See TracChangeset
for help on using the changeset viewer.