]> arthur.barton.de Git - netdata.git/blob - src/common.h
fixed minor issues throughout the code (mainly types); dashboard has now a watermark...
[netdata.git] / src / common.h
1 #ifndef NETDATA_COMMON_H
2 #define NETDATA_COMMON_H 1
3
4 #if defined(HAVE_INTTYPES_H)
5 #include <inttypes.h>
6 #elif defined(HAVE_STDINT_H)
7 #include <stdint.h>
8 #endif
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 #define abs(x) ((x < 0)? -x : x)
13 #define usecdiff(now, last) (((((now)->tv_sec * 1000000ULL) + (now)->tv_usec) - (((last)->tv_sec * 1000000ULL) + (last)->tv_usec)))
14
15 extern uint32_t simple_hash(const char *name);
16 extern void strreverse(char* begin, char* end);
17 extern char *mystrsep(char **ptr, char *s);
18 extern char *trim(char *s);
19
20 extern void *mymmap(const char *filename, size_t size, int flags, int ksm);
21 extern int savememory(const char *filename, void *mem, unsigned long size);
22
23 extern int fd_is_valid(int fd);
24
25 extern char *global_host_prefix;
26 extern int enable_ksm;
27
28 /* Number of ticks per second */
29 #define HZ        myhz
30 extern unsigned int hz;
31 extern void get_HZ(void);
32
33 extern pid_t gettid(void);
34
35 #endif /* NETDATA_COMMON_H */