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 extern int _starpu_enable_stats;
28 
29 void _starpu_datastats_init();
30 
31 static inline int starpu_enable_stats(void)
32 {
33  return _starpu_enable_stats;
34 }
35 
36 void __starpu_msi_cache_hit(unsigned node);
37 void __starpu_msi_cache_miss(unsigned node);
38 
39 #define _starpu_msi_cache_hit(node) do { \
40  if (starpu_enable_stats()) \
41  __starpu_msi_cache_hit(node); \
42 } while (0)
43 
44 #define _starpu_msi_cache_miss(node) do { \
45  if (starpu_enable_stats()) \
46  __starpu_msi_cache_miss(node); \
47 } while (0)
48 
49 void _starpu_display_msi_stats(FILE *stream);
50 
51 void __starpu_allocation_cache_hit(unsigned node STARPU_ATTRIBUTE_UNUSED);
52 void __starpu_data_allocation_inc_stats(unsigned node STARPU_ATTRIBUTE_UNUSED);
53 
54 #define _starpu_allocation_cache_hit(node) do { \
55  if (starpu_enable_stats()) \
56  __starpu_allocation_cache_hit(node); \
57 } while (0)
58 
59 #define _starpu_data_allocation_inc_stats(node) do { \
60  if (starpu_enable_stats()) \
61  __starpu_data_allocation_inc_stats(node); \
62 } while (0)
63 
64 void _starpu_display_alloc_cache_stats(FILE *stream);
65 
66 #endif // __DATASTATS_H__