diff options
| author | 2025-02-27 02:17:53 -0800 | |
|---|---|---|
| committer | 2025-02-27 02:17:53 -0800 | |
| commit | 4defd4f1cd8c88a6d544f7a7cd01825100fbe99e (patch) | |
| tree | 900df9d557261303a6d6cd31458e18cbfa6bf9da | |
| parent | 67f006eab9da3aa2400a304e8b17fabdc3b641fa (diff) | |
| parent | 6d9c6c00c78afb2e5d37f8c1b47b0a4e8772356e (diff) | |
Change the thread / method info format for low overhead traces am: 6d9c6c00c7
Original change: https://android-review.googlesource.com/c/platform/art/+/3510270
Change-Id: If909e07f8c7a273eeaa88310bb6e5f84e626e079
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | runtime/trace_profile.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/runtime/trace_profile.cc b/runtime/trace_profile.cc index 26f80ad60d..cdc08bb6fc 100644 --- a/runtime/trace_profile.cc +++ b/runtime/trace_profile.cc @@ -59,6 +59,8 @@ static constexpr size_t kProfileMagicValue = 0x4C4F4D54; static constexpr size_t kBufSizeForEncodedData = kMinBufSizeForEncodedData * 10; static constexpr size_t kAlwaysOnTraceHeaderSize = 12; +static constexpr size_t kAlwaysOnMethodInfoHeaderSize = 11; +static constexpr size_t kAlwaysOnThreadInfoHeaderSize = 7; bool TraceProfiler::profile_in_progress_ = false; @@ -206,19 +208,26 @@ void DumpThreadMethodInfo(const std::unordered_map<size_t, std::string>& traced_ const std::unordered_set<ArtMethod*>& traced_methods, std::ostringstream& os) REQUIRES_SHARED(Locks::mutator_lock_) { // Dump data about thread information. - os << "\n*threads\n"; for (const auto& it : traced_threads) { - os << it.first << "\t" << it.second << "\n"; + uint8_t thread_header[kAlwaysOnThreadInfoHeaderSize]; + thread_header[0] = kThreadInfoHeaderV2; + Append4LE(thread_header + 1, it.first); + Append2LE(thread_header + 5, it.second.length()); + os.write(reinterpret_cast<char*>(thread_header), kAlwaysOnThreadInfoHeaderSize); + os.write(it.second.c_str(), it.second.length()); } // Dump data about method information. - os << "*methods\n"; for (ArtMethod* method : traced_methods) { - ArtMethod* method_ptr = reinterpret_cast<ArtMethod*>(method); - os << method_ptr << "\t" << GetMethodInfoLine(method); + std::string method_line = GetMethodInfoLine(method); + uint16_t method_line_length = static_cast<uint16_t>(method_line.length()); + uint8_t method_header[kAlwaysOnMethodInfoHeaderSize]; + method_header[0] = kMethodInfoHeaderV2; + Append8LE(method_header + 1, reinterpret_cast<uint64_t>(method)); + Append2LE(method_header + 9, method_line_length); + os.write(reinterpret_cast<char*>(method_header), kAlwaysOnMethodInfoHeaderSize); + os.write(method_line.c_str(), method_line_length); } - - os << "*end"; } } // namespace |