source: libcfa/src/concurrency/stats.hfa@ 2b96031

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 2b96031 was 3bd4293, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added stat for unparks that can migrate

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[8834751]1#pragma once
2
[73f4d08]3// #define CFA_STATS_ARRAY 10000
4
[8834751]5#include <stdint.h>
6
[b7664a03]7enum {
8 CFA_STATS_READY_Q = 0x01,
9 CFA_STATS_IO = 0x02,
10};
11
[8834751]12#if defined(__CFA_NO_STATISTICS__)
13 struct __stats_t;
14 static inline void __init_stats( struct __stats_t * ) {}
15 static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {}
[1b033b8]16 static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {}
[8834751]17#else
[d2fadeb]18 struct __stats_readyQ_pop_t {
19 // number of attemps at poping something
20 volatile uint64_t attempt;
[69fbc61]21
[d2fadeb]22 // number of successes at poping
23 volatile uint64_t success;
[8834751]24
[d2fadeb]25 // number of attempts failed due to the lock being held
26 volatile uint64_t elock;
[52769ba]27
[d2fadeb]28 // number of attempts failed due to the queue being empty (lock held)
29 volatile uint64_t eempty;
[52769ba]30
[d2fadeb]31 // number of attempts failed due to the queue looking empty (lock not held)
32 volatile uint64_t espec;
33 };
[8834751]34
[d2fadeb]35 struct __attribute__((aligned(64))) __stats_readyQ_t {
36 // Push statistic
37 struct {
[fd1f65e]38 struct {
[d2fadeb]39 // number of attemps at pushing something to preferred queues
[fd1f65e]40 volatile uint64_t attempt;
41
[d2fadeb]42 // number of successes at pushing to preferred queues
[fd1f65e]43 volatile uint64_t success;
[d2fadeb]44 }
45 // Stats for local queue within cluster
46 local,
[fd1f65e]47
[d2fadeb]48 // Stats for non-local queues within cluster
49 share,
[fd1f65e]50
[d2fadeb]51 // Stats from outside cluster
52 extrn;
53 } push;
[fd1f65e]54
[d2fadeb]55 // Pop statistic
56 struct {
57 // pop from local queue
58 __stats_readyQ_pop_t local;
[8834751]59
[d2fadeb]60 // pop before looking at local queue
61 __stats_readyQ_pop_t help;
[8834751]62
[d2fadeb]63 // pop from some other queue
64 __stats_readyQ_pop_t steal;
[52769ba]65
[d2fadeb]66 // pop when searching queues sequentially
67 __stats_readyQ_pop_t search;
68 } pop;
[52769ba]69
[29cb302]70 struct {
71 volatile uint64_t migration;
[3bd4293]72 volatile uint64_t extunpark;
[ec43cf9]73 volatile int64_t threads; // number of threads in the system, includes only local change
[29cb302]74 } threads;
[68f36f4]75 struct {
76 volatile uint64_t halts;
77 volatile uint64_t cancels;
78 volatile uint64_t wakes;
79 volatile uint64_t exits;
80 } sleep;
[8834751]81 };
82
[5751a56]83 #if defined(CFA_HAVE_LINUX_IO_URING_H)
[8834751]84 struct __attribute__((aligned(64))) __stats_io_t{
85 struct {
[d60d30e]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;
[8834751]92 struct {
[d60d30e]93 volatile uint64_t fast;
94 volatile uint64_t slow;
95 } submit;
96 struct {
97 volatile uint64_t external;
98 } flush;
99 struct {
[dddb3dd0]100 volatile uint64_t drain;
[d60d30e]101 volatile uint64_t completed;
[dddb3dd0]102 volatile uint64_t flush;
103 volatile uint64_t submitted;
[d60d30e]104 struct {
105 volatile uint64_t busy;
106 } errors;
107 } calls;
[150d21a]108 struct {
109 volatile uint64_t sleeps;
110 } poller;
[8834751]111 };
112 #endif
113
[73f4d08]114 #if defined(CFA_STATS_ARRAY)
115 struct __stats_elem_t {
116 long long int ts;
117 int64_t value;
118 };
119 #endif
120
[37ba662]121 struct __attribute__((aligned(128))) __stats_t {
[d2fadeb]122 __stats_readyQ_t ready;
[5751a56]123 #if defined(CFA_HAVE_LINUX_IO_URING_H)
[8834751]124 __stats_io_t io;
125 #endif
[73f4d08]126
127 #if defined(CFA_STATS_ARRAY)
128 struct {
129 __stats_elem_t * values;
130 volatile size_t cnt;
131 } array;
132 #endif
133
[8834751]134 };
135
136 void __init_stats ( struct __stats_t * );
137 void __tally_stats( struct __stats_t *, struct __stats_t * );
[1b033b8]138 void __print_stats( struct __stats_t *, int, const char *, const char *, void * );
[73f4d08]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
[8834751]146#endif
147
Note: See TracBrowser for help on using the repository browser.