summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-02-27 12:55:31 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-03-10 16:28:59 +0100
commit860c684582eaac0c94d6004dd9afeaccc43bc4ff (patch)
treedc03ce312532f4865ab46302afdd8f9497870758 /src
parentbe1e3354a3479a6ad4d265122fe4fa20bcbf9787 (diff)
downloadjustbuild-860c684582eaac0c94d6004dd9afeaccc43bc4ff.tar.gz
just-mr: support --profile in invocation logging
Support passing on an invocation-specific --profile option when launching just. This allows routine profiling of builds.
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/cli.hpp1
-rw-r--r--src/other_tools/just_mr/launch.cpp10
-rw-r--r--src/other_tools/just_mr/rc.cpp5
3 files changed, 16 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index f9b32f53..96760b0d 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -96,6 +96,7 @@ struct InvocationLogArguments {
std::optional<std::string> metadata{std::nullopt};
std::optional<std::string> graph_file{std::nullopt};
std::optional<std::string> graph_file_plain{std::nullopt};
+ std::optional<std::string> profile{std::nullopt};
};
struct MultiRepoJustSubCmdsArguments {
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp
index 1c08688e..76272213 100644
--- a/src/other_tools/just_mr/launch.cpp
+++ b/src/other_tools/just_mr/launch.cpp
@@ -318,6 +318,16 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
cmd.emplace_back("--dump-plain-graph");
cmd.emplace_back(*log_dir / *invocation_log.graph_file_plain);
}
+ if (invocation_log.profile) {
+ if (not IsValidFileName(*invocation_log.profile)) {
+ Logger::Log(LogLevel::Error,
+ "Invalid file name for option --profile: {}",
+ nlohmann::json(*invocation_log.profile).dump());
+ std::exit(kExitClargsError);
+ }
+ cmd.emplace_back("--profile");
+ cmd.emplace_back(*log_dir / *invocation_log.profile);
+ }
}
// add (remaining) args given by user as clargs
for (auto it = just_cmd_args.additional_just_args.begin() +
diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp
index 6bfda2c5..67ef3e24 100644
--- a/src/other_tools/just_mr/rc.cpp
+++ b/src/other_tools/just_mr/rc.cpp
@@ -620,6 +620,11 @@ namespace {
if (graph_file_plain->IsString()) {
clargs->invocation_log.graph_file = graph_file_plain->String();
}
+ auto profile =
+ invocation_log->Get("--profile", Expression::none_t{});
+ if (profile->IsString()) {
+ clargs->invocation_log.profile = profile->String();
+ }
}
}
// read config lookup order