| 1 | //===-- memprof_descriptions.h ---------------------------------*- C++ -*-===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file is a part of MemProfiler, a memory profiler. |
| 10 | // |
| 11 | // MemProf-private header for memprof_descriptions.cpp. |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | #ifndef MEMPROF_DESCRIPTIONS_H |
| 14 | #define MEMPROF_DESCRIPTIONS_H |
| 15 | |
| 16 | #include "memprof_allocator.h" |
| 17 | #include "memprof_thread.h" |
| 18 | #include "sanitizer_common/sanitizer_common.h" |
| 19 | #include "sanitizer_common/sanitizer_report_decorator.h" |
| 20 | |
| 21 | namespace __memprof { |
| 22 | |
| 23 | void DescribeThread(MemprofThreadContext *context); |
| 24 | inline void DescribeThread(MemprofThread *t) { |
| 25 | if (t) |
| 26 | DescribeThread(context: t->context()); |
| 27 | } |
| 28 | |
| 29 | class MemprofThreadIdAndName { |
| 30 | public: |
| 31 | explicit MemprofThreadIdAndName(MemprofThreadContext *t); |
| 32 | explicit MemprofThreadIdAndName(u32 tid); |
| 33 | |
| 34 | // Contains "T%tid (%name)" or "T%tid" if the name is empty. |
| 35 | const char *c_str() const { return &name[0]; } |
| 36 | |
| 37 | private: |
| 38 | void Init(u32 tid, const char *tname); |
| 39 | |
| 40 | char name[128]; |
| 41 | }; |
| 42 | |
| 43 | } // namespace __memprof |
| 44 | |
| 45 | #endif // MEMPROF_DESCRIPTIONS_H |
| 46 |