Changeset 8464edf
- Timestamp:
- May 5, 2021, 4:53:25 PM (2 years ago)
- Branches:
- ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 938885d3
- Parents:
- 45b9b21
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r45b9b21 r8464edf 171 171 preemption_scope scope = { this }; 172 172 173 __STATS( unsigned long long last_tally = rdtscl(); )174 175 173 // if we need to run some special setup, now is the time to do it. 176 174 if(this->init.thrd) { … … 258 256 // Are we done? 259 257 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP; 260 261 #if !defined(__CFA_NO_STATISTICS__)262 unsigned long long curr = rdtscl();263 if(curr > (last_tally + 500000000)) {264 __tally_stats(this->cltr->stats, __cfaabi_tls.this_stats);265 last_tally = curr;266 }267 #endif268 258 269 259 if(this->io.pending && !this->io.dirty) { … … 918 908 } 919 909 910 static void crawl_list( cluster * cltr, dlist(processor, processor) & list, unsigned count ) { 911 /* paranoid */ verify( cltr->stats ); 912 913 processor * it = &list`first; 914 for(unsigned i = 0; i < count; i++) { 915 /* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count); 916 /* paranoid */ verify( it->local_data->this_stats ); 917 __tally_stats( cltr->stats, it->local_data->this_stats ); 918 it = &(*it)`next; 919 } 920 } 921 922 void crawl_cluster_stats( cluster & this ) { 923 // Stop the world, otherwise stats could get really messed-up 924 // this doesn't solve all problems but does solve many 925 // so it's probably good enough 926 uint_fast32_t last_size = ready_mutate_lock(); 927 928 crawl_list(&this, this.procs.actives, this.procs.total - this.procs.idle); 929 crawl_list(&this, this.procs.idles , this.procs.idle ); 930 931 // Unlock the RWlock 932 ready_mutate_unlock( last_size ); 933 } 934 935 920 936 void print_stats_now( cluster & this, int flags ) { 937 crawl_cluster_stats( this ); 921 938 __print_stats( this.stats, this.print_stats, "Cluster", this.name, (void*)&this ); 922 939 }
Note: See TracChangeset
for help on using the changeset viewer.