aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/statistics.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/statistics.h')
-rw-r--r--src/statistics/statistics.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/statistics/statistics.h b/src/statistics/statistics.h
new file mode 100644
index 000000000..6eedd4d34
--- /dev/null
+++ b/src/statistics/statistics.h
@@ -0,0 +1,94 @@
1/*
2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2009 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet 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. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @author Christian Grothoff
23 * @file statistics/statistics.h
24 */
25#ifndef STATISTICS_H
26#define STATISTICS_H
27
28#include "gnunet_common.h"
29
30#define DEBUG_STATISTICS 0
31
32/**
33 * Statistics message. Contains how long the system is up
34 * and one value.
35 *
36 * The struct is be followed by the service name and
37 * name of the statistic, both 0-terminated.
38 */
39struct GNUNET_STATISTICS_ReplyMessage
40{
41 /**
42 * Type: GNUNET_MESSAGE_TYPE_STATISTICS_VALUE
43 */
44 struct GNUNET_MessageHeader header;
45
46 /**
47 * Unique numerical identifier for the value (will
48 * not change during the same client-session). Highest
49 * bit will be set for persistent values.
50 */
51 uint32_t uid GNUNET_PACKED;
52
53 /**
54 * The value.
55 */
56 uint64_t value GNUNET_PACKED;
57
58};
59
60#define GNUNET_STATISTICS_PERSIST_BIT (1<<31)
61
62#define GNUNET_STATISTICS_SETFLAG_ABSOLUTE 0
63
64#define GNUNET_STATISTICS_SETFLAG_RELATIVE 1
65
66#define GNUNET_STATISTICS_SETFLAG_PERSISTENT 2
67
68/**
69 * Message to set a statistic. Followed
70 * by the subsystem name and the name of
71 * the statistic (each 0-terminated).
72 */
73struct GNUNET_STATISTICS_SetMessage
74{
75 /**
76 * Type: GNUNET_MESSAGE_TYPE_STATISTICS_SET
77 */
78 struct GNUNET_MessageHeader header;
79
80 /**
81 * 0 for absolute value, 1 for relative value; 2 to make persistent
82 * (see GNUNET_STATISTICS_SETFLAG_*).
83 */
84 uint32_t flags GNUNET_PACKED;
85
86 /**
87 * Value. Note that if this is a relative value, it will
88 * be signed even though the type given here is unsigned.
89 */
90 uint64_t value GNUNET_PACKED;
91
92};
93
94#endif