diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2016-03-30 21:40:42 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2016-03-30 21:40:42 +0000 |
commit | 9ce153ce7167c11adba8ac225edc7a707e97c6eb (patch) | |
tree | 9f6e849cce2dcc7e5b4e9e6252c843dc2d0787a2 /src/common.h | |
download | netdata-9ce153ce7167c11adba8ac225edc7a707e97c6eb.tar.xz netdata-9ce153ce7167c11adba8ac225edc7a707e97c6eb.zip |
Imported Upstream version 1.0.0upstream/1.0.0
Diffstat (limited to 'src/common.h')
-rwxr-xr-x | src/common.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h new file mode 100755 index 00000000..9d8836f8 --- /dev/null +++ b/src/common.h @@ -0,0 +1,35 @@ +#ifndef NETDATA_COMMON_H +#define NETDATA_COMMON_H 1 + +#if defined(HAVE_INTTYPES_H) +#include <inttypes.h> +#elif defined(HAVE_STDINT_H) +#include <stdint.h> +#endif +#include <sys/types.h> +#include <unistd.h> + +#define abs(x) ((x < 0)? -x : x) +#define usecdiff(now, last) (((((now)->tv_sec * 1000000ULL) + (now)->tv_usec) - (((last)->tv_sec * 1000000ULL) + (last)->tv_usec))) + +extern uint32_t simple_hash(const char *name); +extern void strreverse(char* begin, char* end); +extern char *mystrsep(char **ptr, char *s); +extern char *trim(char *s); + +extern void *mymmap(const char *filename, size_t size, int flags, int ksm); +extern int savememory(const char *filename, void *mem, unsigned long size); + +extern int fd_is_valid(int fd); + +extern char *global_host_prefix; +extern int enable_ksm; + +/* Number of ticks per second */ +#define HZ myhz +extern unsigned int hz; +extern void get_HZ(void); + +extern pid_t gettid(void); + +#endif /* NETDATA_COMMON_H */ |