CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
// Copyright (c) Advanced Micro Devices, Inc.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include "common/join.hpp"
|
|
|
|
#include <timemory/log/color.hpp>
|
|
#include <timemory/utility/backtrace.hpp>
|
|
|
|
#include <cstdint>
|
|
#include <iosfwd>
|
|
#include <ostream>
|
|
#include <string>
|
|
|
|
struct log_entry;
|
|
|
|
void
|
|
print_log_entries(std::ostream& = std::cerr, std::int64_t _count = 10,
|
|
const std::function<bool(const log_entry&)>& _cond = {},
|
|
const std::function<void()>& _prelude = {},
|
|
const char* _color = tim::log::color::warning(),
|
|
bool _color_entries = true);
|
|
|
|
struct log_entry
|
|
{
|
|
struct source_location
|
|
{
|
|
const char* function = nullptr;
|
|
const char* file = nullptr;
|
|
int line = 0;
|
|
};
|
|
|
|
log_entry(std::string _msg);
|
|
log_entry(source_location _loc, std::string _msg);
|
|
|
|
std::string as_string(const char* _color = tim::log::color::info(),
|
|
const char* _src = tim::log::color::source(),
|
|
const char* _end = tim::log::color::end()) const;
|
|
|
|
static log_entry& add_log_entry(log_entry&&);
|
|
|
|
log_entry& force(bool _v = true)
|
|
{
|
|
m_forced = _v;
|
|
return *this;
|
|
}
|
|
|
|
bool forced() const { return m_forced; }
|
|
|
|
private:
|
|
bool m_forced = false; // if should always be displayed
|
|
source_location m_location = {};
|
|
std::string m_message = {};
|
|
tim::unwind::stack<4> m_backtrace = {};
|
|
|
|
friend void print_log_entries(std::ostream&, std::int64_t,
|
|
std::function<bool(const log_entry&)>, const char*,
|
|
bool);
|
|
};
|
|
|
|
#define ROCPROFSYS_ADD_LOG_ENTRY(...) \
|
|
log_entry::add_log_entry( \
|
|
{ log_entry::source_location{ __FUNCTION__, __FILE__, __LINE__ }, \
|
|
::rocprofsys::join(" ", __VA_ARGS__) })
|