inplace_sampler_lib.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #ifndef SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_
  17. #define SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_
  18. enum InplaceSamplerMessageType {
  19. START_PROFILING,
  20. START_PROFILING_REPLY,
  21. THREAD_INFO,
  22. MAP_INFO,
  23. SAMPLE_INFO,
  24. END_PROFILING,
  25. END_PROFILING_REPLY,
  26. };
  27. // Type: START_PROFILING
  28. // Direction: simpleperf to inplace_sampler
  29. // Data:
  30. // char options[]; // ended by '\0'
  31. //
  32. // options[] contains space separated options like below:
  33. // freq=4000 # sample at 4000/s.
  34. // signal=14 # use signal 14 to raise sample recording.
  35. // tids=1432,1433 # take samples of thread 1432,1433.
  36. // Type: START_PROFILING_REPLY
  37. // Direction: inplace_sampler to simpleperf
  38. // Data:
  39. // char reply[]; // ended by '\0'
  40. // reply[] contains a string, which is either 'ok' or 'error'
  41. // Type: THREAD_INFO
  42. // Direction: inplace_sampler to simpleperf
  43. // Data:
  44. // uint64_t time;
  45. // uint32_t tid;
  46. // char thread_name[]; // ended by '\0'
  47. // Type: MAP_INFO
  48. // Direction: inplace_sampler to simpleperf
  49. // Data:
  50. // uint64_t time;
  51. // uint64_t start;
  52. // uint64_t len;
  53. // uint64_t pgoff;
  54. // char[] dso; // ended by '\0'
  55. // Type: SAMPLE_INFO
  56. // Direction: inplace_sampler to simpleperf
  57. // Data:
  58. // uint64_t time;
  59. // uint32_t tid;
  60. // uint32_t period;
  61. // uint32_t ip_nr;
  62. // uint64_t ip[ip_nr];
  63. // Type: END_PROFILING
  64. // Direction: simpleperf to inplace_sampler
  65. // Data:
  66. // None.
  67. // Type: END_PROFILING_REPLY
  68. // Direction: inplace_sampler to simpleperf
  69. // Data:
  70. // uint64_t used_cpu_time;
  71. // uint64_t lost_samples;
  72. #endif // SIMPLE_PERF_INPLACE_SAMPLER_LIB_H_