StarPU Internal Handbook
datastats.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  *
5  * StarPU is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; either version 2.1 of the License, or (at
8  * your option) any later version.
9  *
10  * StarPU is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15  */
16 
17 #ifndef __DATASTATS_H__
18 #define __DATASTATS_H__
19 
22 #include <starpu.h>
23 #include <common/config.h>
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #pragma GCC visibility push(hidden)
28 
29 extern int _starpu_enable_stats;
30 
31 void _starpu_datastats_init();
32 
33 static inline int starpu_enable_stats(void)
34 {
35  return _starpu_enable_stats;
36 }
37 
38 void __starpu_msi_cache_hit(unsigned node);
39 void __starpu_msi_cache_miss(unsigned node);
40 
41 #define _starpu_msi_cache_hit(node) do { \
42  if (starpu_enable_stats()) \
43  __starpu_msi_cache_hit(node); \
44 } while (0)
45 
46 #define _starpu_msi_cache_miss(node) do { \
47  if (starpu_enable_stats()) \
48  __starpu_msi_cache_miss(node); \
49 } while (0)
50 
51 void _starpu_display_msi_stats(FILE *stream);
52 
53 void __starpu_allocation_cache_hit(unsigned node STARPU_ATTRIBUTE_UNUSED);
54 void __starpu_data_allocation_inc_stats(unsigned node STARPU_ATTRIBUTE_UNUSED);
55 
56 #define _starpu_allocation_cache_hit(node) do { \
57  if (starpu_enable_stats()) \
58  __starpu_allocation_cache_hit(node); \
59 } while (0)
60 
61 #define _starpu_data_allocation_inc_stats(node) do { \
62  if (starpu_enable_stats()) \
63  __starpu_data_allocation_inc_stats(node); \
64 } while (0)
65 
66 void _starpu_display_alloc_cache_stats(FILE *stream);
67 
68 #pragma GCC visibility pop
69 
70 #endif // __DATASTATS_H__