brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · e88ea44 Raw
46 lines · c
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-exception6//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_H14#define MEMPROF_DESCRIPTIONS_H15 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 21namespace __memprof {22 23void DescribeThread(MemprofThreadContext *context);24inline void DescribeThread(MemprofThread *t) {25  if (t)26    DescribeThread(t->context());27}28 29class MemprofThreadIdAndName {30public: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 37private:38  void Init(u32 tid, const char *tname);39 40  char name[128];41};42 43} // namespace __memprof44 45#endif // MEMPROF_DESCRIPTIONS_H46