Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tracy option for profiling on recipes #134

Merged
merged 11 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0
7.4.1
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: greut/eclint-action@v0
- uses: jidicula/[email protected]
with: { clang-format-version: "18" }
with: { clang-format-version: "19" }

test-windows:
if: >-
Expand Down
10 changes: 9 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 3,
)

bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "nlohmann_json", version = "3.11.3")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_pkg", version = "0.10.1")
Expand All @@ -19,8 +19,10 @@ bazel_dep(name = "docopt.cpp", version = "0.6.2")
bazel_dep(name = "boost.process", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.algorithm", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.url", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.regex", version = "1.83.0.bcr.1")
bazel_dep(name = "yaml-cpp", version = "0.8.0")
bazel_dep(name = "libarchive", version = "3.7.4.bcr.2")
bazel_dep(name = "tracy", version = "0.11.1")

bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True)
Expand All @@ -35,6 +37,12 @@ git_override(
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)

git_override(
module_name = "tracy",
commit = "b75f30a3823bc290b4d2359234d10ff69855d046",
remote = "https://github.com/seaube/tracy.git",
)

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True)
llvm.toolchain(llvm_version = "17.0.6")
use_repo(llvm, "llvm_toolchain")
Expand Down
4 changes: 4 additions & 0 deletions ecsact/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ cc_binary(
"//ecsact/cli/commands:build",
"//ecsact/cli/commands:recipe-bundle",
],
data = [
"@tracy//:tracy_srcs",
],
)

2 changes: 1 addition & 1 deletion ecsact/cli/commands/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cc_library(
],
)


cc_library(
name = "codegen",
srcs = ["codegen.cc"],
Expand Down Expand Up @@ -94,6 +93,7 @@ cc_library(
"@ecsact_interpret",
"@docopt.cpp//:docopt",
"@magic_enum",
"@boost.regex",
],
)

Expand Down
4 changes: 2 additions & 2 deletions ecsact/cli/commands/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ auto start_async_benchmark(
return result_message;
}

auto start_core_benchmark(const common_benchmark_options& options
) -> std::optional<benchmark_result_message> {
auto start_core_benchmark(const common_benchmark_options& options)
-> std::optional<benchmark_result_message> {
auto result_message = benchmark_result_message{};

const auto create_reg_fn = get_or_exit<decltype(ecsact_create_registry)>(
Expand Down
7 changes: 5 additions & 2 deletions ecsact/cli/commands/build.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ecsact/cli/commands/build.hh"

#include <iostream>
#include <memory>
#include <format>
#include <filesystem>
Expand Down Expand Up @@ -30,7 +31,7 @@ constexpr auto USAGE = R"docopt(Ecsact Build Command

Usage:
ecsact build (-h | --help)
ecsact build <files>... --recipe=<name>... --output=<path> [--allow-unresolved-imports] [--format=<type>] [--temp_dir=<path>] [--compiler_config=<path>] [--report_filter=<filter>] [--debug]
ecsact build <files>... --recipe=<name>... --output=<path> [--allow-unresolved-imports] [--format=<type>] [--temp_dir=<path>] [--compiler_config=<path>] [--report_filter=<filter>] [--debug] [--tracy]

Options:
<files> Ecsact files used to build Ecsact Runtime
Expand All @@ -40,7 +41,8 @@ constexpr auto USAGE = R"docopt(Ecsact Build Command
--compiler_config=<path> Optionally specify the compiler by name or path
-f --format=<type> The format used to report progress of the build [default: text]
--report_filter=<filter> Filtering out report logs [default: none]
--debug Compile with debug symbols
--debug Compile with debug symbols
--tracy Enable the tracy profiler
)docopt";

// TODO(zaucy): Add this documentation to docopt (msvc regex fails)
Expand Down Expand Up @@ -302,6 +304,7 @@ auto ecsact::cli::detail::build_command( //
.work_dir = work_dir,
.output_path = output_path,
.debug = args["--debug"].asBool(),
.tracy = args["--debug"].asBool(),
.additional_plugin_dirs = additional_plugin_dirs,
};
auto runtime_output_path =
Expand Down
13 changes: 12 additions & 1 deletion ecsact/cli/commands/build/recipe/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ cc_library(
],
)

cc_library(
name = "cook_runfiles",
copts = copts,
hdrs = ["cook_runfiles.hh"],
srcs = ["cook_runfiles.cc"],
deps = [
"@bazel_tools//tools/cpp/runfiles",
"//ecsact/cli:report",
]
)

cc_library(
name = "cook",
copts = copts,
Expand All @@ -43,6 +54,7 @@ cc_library(
}),
deps = [
":integrity",
":cook_runfiles",
"//ecsact/cli:report",
"//ecsact/cli/detail:argv0",
"//ecsact/cli/detail:download",
Expand All @@ -62,7 +74,6 @@ cc_library(
] + select({
"//:use_sdk_version_enabled": [],
"//:use_sdk_version_disabled": [
"@bazel_tools//tools/cpp/runfiles",
],
}),
data = select({
Expand Down
Loading