perf: Clean up perf_{session,alloc} management
[akaros.git] / kern / include / ros / profiler_records.h
1 /* Copyright (c) 2015 Google Inc
2  * Davide Libenzi <dlibenzi@google.com>
3  * See LICENSE for details.
4  */
5
6 #pragma once
7
8 #include <sys/types.h>
9
10 #define PROF_DOM_SHIFT (8 * sizeof(uint64_t) - 4)
11 #define PROF_INFO_MASK (((uint64_t) 1 << PROF_DOM_SHIFT) - 1)
12
13 #define PROF_MKINFO(dom, dinfo)                                                         \
14         (((uint64_t) (dom) << PROF_DOM_SHIFT) | ((dinfo) & PROF_INFO_MASK))
15
16 #define PROF_INFO_DOM(i) ((uint64_t) (i) >> PROF_DOM_SHIFT)
17 #define PROF_INFO_DATA(i) ((i) & PROF_INFO_MASK)
18
19 #define PROF_DOM_TIMER 1
20 #define PROF_DOM_PMU 2
21
22 #define PROFTYPE_KERN_TRACE64   1
23
24 struct proftype_kern_trace64 {
25         uint64_t info;
26         uint64_t tstamp;
27         uint16_t cpu;
28         uint16_t num_traces;
29         uint64_t trace[0];
30 } __attribute__((packed));
31
32 #define PROFTYPE_USER_TRACE64   2
33
34 struct proftype_user_trace64 {
35         uint64_t info;
36         uint64_t tstamp;
37         uint32_t pid;
38         uint16_t cpu;
39         uint16_t num_traces;
40         uint64_t trace[0];
41 } __attribute__((packed));
42
43 #define PROFTYPE_PID_MMAP64             3
44
45 struct proftype_pid_mmap64 {
46         uint64_t tstamp;
47         uint64_t addr;
48         uint64_t size;
49         uint64_t offset;
50         uint32_t pid;
51         uint8_t path[0];
52 } __attribute__((packed));
53
54 #define PROFTYPE_NEW_PROCESS    4
55
56 struct proftype_new_process {
57         uint64_t tstamp;
58         uint32_t pid;
59         uint8_t path[0];
60 } __attribute__((packed));