-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.h
44 lines (32 loc) · 899 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Copyright (c) 2022 LG Electronics Inc. */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef HEAPTRACE_UTILS_H
#define HEAPTRACE_UTILS_H
#include <cstdio>
#include <cstdarg>
#include <unistd.h>
#include <sys/syscall.h>
#include <string>
#include <chrono>
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
namespace utils {
typedef std::chrono::duration<uint64_t> bytes;
typedef std::chrono::duration<uint64_t, std::kilo> kilobytes;
typedef std::chrono::duration<uint64_t, std::mega> megabytes;
typedef std::chrono::duration<uint64_t, std::giga> gigabytes;
static int gettid(void)
{
return syscall(SYS_gettid);
}
std::string asprintf(const char* fmt, ...);
std::string get_comm_name(void);
struct enum_table {
const char *str;
int val;
};
std::string mmap_prot_string(int prot);
std::string mmap_flags_string(int flags);
} // namespace utils
#endif /* HEAPTRACE_UTILS_H */