source: libcfa/src/concurrency/stats.hfa@ 04b5cef

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

Minor improvements to alignments and memory layout

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#pragma once
2
3#include <stdint.h>
4
5#if defined(__CFA_NO_STATISTICS__)
6 struct __stats_t;
7 static inline void __init_stats( struct __stats_t * ) {}
8 static inline void __tally_stats( struct __stats_t *, struct __stats_t * ) {}
9 static inline void __print_stats( struct __stats_t * ) {}
10#else
11 struct __attribute__((aligned(64))) __stats_readQ_t {
12 struct {
13 // Push statistic
14 struct {
15 // number of attemps at pushing something
16 volatile uint64_t attempt;
17
18 // number of successes at pushing
19 volatile uint64_t success;
20 } push;
21
22 // Pop statistic
23 struct {
24 // number of reads of the mask
25 // picking an empty __cfa_readyQ_mask_t counts here
26 // but not as an attempt
27 volatile uint64_t probe;
28
29 // number of attemps at poping something
30 volatile uint64_t attempt;
31
32 // number of successes at poping
33 volatile uint64_t success;
34 } pop;
35 } pick;
36 };
37
38 #if defined(HAVE_LINUX_IO_URING_H)
39 struct __attribute__((aligned(64))) __stats_io_t{
40 struct {
41 struct {
42 volatile uint64_t rdy;
43 volatile uint64_t csm;
44 volatile uint64_t avl;
45 volatile uint64_t cnt;
46 } submit_avg;
47 struct {
48 volatile uint64_t val;
49 volatile uint64_t cnt;
50 volatile uint64_t block;
51 } look_avg;
52 struct {
53 volatile uint64_t val;
54 volatile uint64_t cnt;
55 volatile uint64_t block;
56 } alloc_avg;
57 } submit_q;
58 struct {
59 struct {
60 unsigned long long int val;
61 unsigned long long int slow_cnt;
62 unsigned long long int fast_cnt;
63 } completed_avg;
64 } complete_q;
65 };
66 #endif
67
68 struct __attribute__((aligned(128))) __stats_t {
69 __stats_readQ_t ready;
70 #if defined(HAVE_LINUX_IO_URING_H)
71 __stats_io_t io;
72 #endif
73 };
74
75 void __init_stats ( struct __stats_t * );
76 void __tally_stats( struct __stats_t *, struct __stats_t * );
77 void __print_stats( struct __stats_t * );
78#endif
79
Note: See TracBrowser for help on using the repository browser.