- File:
-
- 1 edited
-
libcfa/src/concurrency/stats.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/stats.hfa
rb7664a03 r3bd4293 1 1 #pragma once 2 3 // #define CFA_STATS_ARRAY 10000 2 4 3 5 #include <stdint.h> … … 14 16 static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {} 15 17 #else 18 struct __stats_readyQ_pop_t { 19 // number of attemps at poping something 20 volatile uint64_t attempt; 16 21 17 struct __attribute__((aligned(64))) __stats_readQ_t { 22 // number of successes at poping 23 volatile uint64_t success; 24 25 // number of attempts failed due to the lock being held 26 volatile uint64_t elock; 27 28 // number of attempts failed due to the queue being empty (lock held) 29 volatile uint64_t eempty; 30 31 // number of attempts failed due to the queue looking empty (lock not held) 32 volatile uint64_t espec; 33 }; 34 35 struct __attribute__((aligned(64))) __stats_readyQ_t { 36 // Push statistic 18 37 struct { 19 // Push statistic20 38 struct { 21 // number of attemps at pushing something 39 // number of attemps at pushing something to preferred queues 22 40 volatile uint64_t attempt; 23 41 24 // number of successes at pushing 42 // number of successes at pushing to preferred queues 25 43 volatile uint64_t success; 44 } 45 // Stats for local queue within cluster 46 local, 26 47 27 // number of attemps at pushing something to preferred queues28 volatile uint64_t local;48 // Stats for non-local queues within cluster 49 share, 29 50 30 // number of successes at pushing to preferred queues31 volatile uint64_t lsuccess;32 } push;51 // Stats from outside cluster 52 extrn; 53 } push; 33 54 34 // Pop statistic 35 struct { 36 // number of reads of the mask 37 // picking an empty __cfa_readyQ_mask_t counts here 38 // but not as an attempt 39 volatile uint64_t probe; 55 // Pop statistic 56 struct { 57 // pop from local queue 58 __stats_readyQ_pop_t local; 40 59 41 // number of attemps at poping something42 volatile uint64_t attempt;60 // pop before looking at local queue 61 __stats_readyQ_pop_t help; 43 62 44 // number of successes at poping45 volatile uint64_t success;63 // pop from some other queue 64 __stats_readyQ_pop_t steal; 46 65 47 // number of attemps at poping something to preferred queues 48 volatile uint64_t local; 66 // pop when searching queues sequentially 67 __stats_readyQ_pop_t search; 68 } pop; 49 69 50 // number of successes at poping to preferred queues51 volatile uint64_t lsuccess;52 } pop;53 } pick;54 70 struct { 55 71 volatile uint64_t migration; 72 volatile uint64_t extunpark; 73 volatile int64_t threads; // number of threads in the system, includes only local change 56 74 } threads; 57 75 struct { … … 66 84 struct __attribute__((aligned(64))) __stats_io_t{ 67 85 struct { 86 volatile uint64_t fast; 87 volatile uint64_t slow; 88 volatile uint64_t fail; 89 volatile uint64_t revoke; 90 volatile uint64_t block; 91 } alloc; 92 struct { 93 volatile uint64_t fast; 94 volatile uint64_t slow; 95 } submit; 96 struct { 97 volatile uint64_t external; 98 } flush; 99 struct { 100 volatile uint64_t drain; 101 volatile uint64_t completed; 102 volatile uint64_t flush; 103 volatile uint64_t submitted; 68 104 struct { 69 volatile uint64_t rdy; 70 volatile uint64_t csm; 71 volatile uint64_t avl; 72 volatile uint64_t cnt; 73 } submit_avg; 74 struct { 75 volatile uint64_t val; 76 volatile uint64_t cnt; 77 volatile uint64_t block; 78 } look_avg; 79 struct { 80 volatile uint64_t val; 81 volatile uint64_t cnt; 82 volatile uint64_t block; 83 } alloc_avg; 84 volatile uint64_t helped; 85 volatile uint64_t leader; 86 volatile uint64_t busy; 87 } submit_q; 105 volatile uint64_t busy; 106 } errors; 107 } calls; 88 108 struct { 89 struct { 90 volatile uint64_t val; 91 volatile uint64_t cnt; 92 } completed_avg; 93 volatile uint64_t blocks; 94 } complete_q; 109 volatile uint64_t sleeps; 110 } poller; 111 }; 112 #endif 113 114 #if defined(CFA_STATS_ARRAY) 115 struct __stats_elem_t { 116 long long int ts; 117 int64_t value; 95 118 }; 96 119 #endif 97 120 98 121 struct __attribute__((aligned(128))) __stats_t { 99 __stats_read Q_t ready;122 __stats_readyQ_t ready; 100 123 #if defined(CFA_HAVE_LINUX_IO_URING_H) 101 124 __stats_io_t io; 102 125 #endif 126 127 #if defined(CFA_STATS_ARRAY) 128 struct { 129 __stats_elem_t * values; 130 volatile size_t cnt; 131 } array; 132 #endif 133 103 134 }; 104 135 … … 106 137 void __tally_stats( struct __stats_t *, struct __stats_t * ); 107 138 void __print_stats( struct __stats_t *, int, const char *, const char *, void * ); 139 #if defined(CFA_STATS_ARRAY) 140 void __push_stat ( struct __stats_t *, int64_t value, bool external, const char * name, void * handle); 141 void __flush_stat( struct __stats_t *, const char *, void * ); 142 #else 143 static inline void __push_stat ( struct __stats_t *, int64_t, bool, const char *, void * ) {} 144 static inline void __flush_stat( struct __stats_t *, const char *, void * ) {} 145 #endif 108 146 #endif 109 147
Note:
See TracChangeset
for help on using the changeset viewer.