Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

46
libs/platform/trace.hpp Normal file
View file

@ -0,0 +1,46 @@
#pragma once
#include "base/macros.hpp"
#include <cstdint>
#include <memory>
namespace platform
{
class TraceImpl;
// API is inspired by https://developer.android.com/ndk/reference/group/tracing
class Trace
{
public:
static Trace & Instance() noexcept;
void BeginSection(char const * name) noexcept;
void EndSection() noexcept;
void SetCounter(char const * name, int64_t value) noexcept;
private:
Trace();
~Trace();
std::unique_ptr<TraceImpl> m_impl;
DISALLOW_COPY_AND_MOVE(Trace);
};
class TraceSection
{
public:
inline TraceSection(char const * section) noexcept { Trace::Instance().BeginSection(section); }
inline ~TraceSection() noexcept { Trace::Instance().EndSection(); }
};
} // namespace platform
#if defined(ENABLE_TRACE) && defined(OMIM_OS_ANDROID)
#define TRACE_SECTION(section) platform::TraceSection ___section(section)
#define TRACE_COUNTER(name, value) platform::Trace::Instance().SetCounter(name, value)
#else
#define TRACE_SECTION(section) static_cast<void>(0)
#define TRACE_COUNTER(name, value) static_cast<void>(0)
#endif