Files
TheRock/rocm-systems/projects/rocprofiler-systems/source/bin/common/json_config.hpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

75 lines
1.9 KiB
C++

// Copyright (c) Advanced Micro Devices, Inc.
// SPDX-License-Identifier: MIT
#pragma once
#include <nlohmann/json.hpp>
#include <map>
#include <optional>
#include <string>
#include <string_view>
namespace rocprofsys
{
namespace json_config
{
[[nodiscard]] std::string
json_value_to_string(const nlohmann::json& val);
/**
* Resolves a JSON config into a flat map of ROCPROFSYS_* env vars.
*/
[[nodiscard]] std::map<std::string, std::string>
resolve_config(const nlohmann::json& config);
struct config_metadata
{
std::string name;
std::string description;
std::string use_case;
std::string category;
std::string cli_flag;
};
[[nodiscard]] std::optional<config_metadata>
get_config_metadata(const nlohmann::json& config);
/**
* Expands a comma-separated list of ROCm domain shorthand names.
* E.g., "hip,kernel" -> "hip_runtime_api,kernel_dispatch"
*/
[[nodiscard]] std::string
expand_rocm_domains(const std::string& domains_str);
/**
* Expands parallel runtime shorthand names to env var suffixes.
* Returns a map of ROCPROFSYS_USE_* env vars to enable.
*/
[[nodiscard]] std::map<std::string, std::string>
expand_parallel_runtimes(const std::string& runtimes_str);
/**
* Expands GPU metrics shorthand. Empty or "all" means default metrics.
*/
[[nodiscard]] std::string
expand_gpu_metrics(const std::string& metrics_str);
/**
* Converts a map of ROCPROFSYS_* env vars back to JSON schema format.
*/
[[nodiscard]] nlohmann::json
env_vars_to_json_schema(const std::map<std::string, std::string>& env_map);
/**
* Exports the configuration as a formatted JSON string.
*/
[[nodiscard]] std::string
export_config_as_json(const std::map<std::string, std::string>& env_vars,
const std::string& preset_name = "",
std::string_view tool_name = "", int indent = 4);
} // namespace json_config
} // namespace rocprofsys