1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_
18 #define SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_
19 
20 enum InplaceSamplerMessageType {
21   START_PROFILING,
22   START_PROFILING_REPLY,
23   THREAD_INFO,
24   MAP_INFO,
25   SAMPLE_INFO,
26   END_PROFILING,
27   END_PROFILING_REPLY,
28 };
29 
30 // Type: START_PROFILING
31 // Direction: simpleperf to inplace_sampler
32 // Data:
33 //   char options[];  // ended by '\0'
34 //
35 // options[] contains space separated options like below:
36 //   freq=4000 # sample at 4000/s.
37 //   signal=14  # use signal 14 to raise sample recording.
38 //   tids=1432,1433  # take samples of thread 1432,1433.
39 
40 
41 // Type: START_PROFILING_REPLY
42 // Direction: inplace_sampler to simpleperf
43 // Data:
44 //   char reply[]; // ended by '\0'
45 // reply[] contains a string, which is either 'ok' or 'error'
46 
47 // Type: THREAD_INFO
48 // Direction: inplace_sampler to simpleperf
49 // Data:
50 //  uint64_t time;
51 //  uint32_t tid;
52 //  char thread_name[];  // ended by '\0'
53 
54 // Type: MAP_INFO
55 // Direction: inplace_sampler to simpleperf
56 // Data:
57 //  uint64_t time;
58 //  uint64_t start;
59 //  uint64_t len;
60 //  uint64_t pgoff;
61 //  char[] dso;  // ended by '\0'
62 
63 // Type: SAMPLE_INFO
64 // Direction: inplace_sampler to simpleperf
65 // Data:
66 //  uint64_t time;
67 //  uint32_t tid;
68 //  uint32_t period;
69 //  uint32_t ip_nr;
70 //  uint64_t ip[ip_nr];
71 
72 // Type: END_PROFILING
73 // Direction: simpleperf to inplace_sampler
74 // Data:
75 //   None.
76 
77 // Type: END_PROFILING_REPLY
78 // Direction: inplace_sampler to simpleperf
79 // Data:
80 //   uint64_t used_cpu_time;
81 //   uint64_t lost_samples;
82 
83 
84 #endif  // SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_
85