Skip to content
Open
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
13 changes: 13 additions & 0 deletions src/codechecker.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ load(
"per_file_test",
)

def _codechecker_resource_set(_os_name, input_count):
"""
Requests thread count based on number of input files.

If requested thread count is higher than available
bazel schedules the job to run alone.
This may not work with remote machines.
"""
return {
"cpu": input_count, # analysis is run for most input files
}
Comment on lines +46 to +56

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! And this may actually help to improve performance!
But we should be sure... Need measurement results


def get_platform_alias(platform):
"""
Get platform alias for full platform names being used
Expand Down Expand Up @@ -139,6 +151,7 @@ def _codechecker_impl(ctx):
# arguments = [ctx.outputs.codechecker_script.path],
mnemonic = "CodeChecker",
progress_message = "CodeChecker %s" % str(ctx.label),
resource_set = _codechecker_resource_set,
# use_default_shell_env = True,
)

Expand Down
1 change: 1 addition & 0 deletions src/per_file_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def _run_codechecker() -> None:
+ ["--skip", SKIP_FILE]
+ ["--config", CONFIG_FILE]
+ [COMPILE_COMMANDS_ABSOLUTE]
+ ["-j 1"] # Analysis of a single file should use a single thread!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this has no much sense for per-file :)
And I would not recommend doing changes "just for the case" too.

)
log(f"CodeChecker command: {' '.join(codechecker_cmd)}\n")
log("===-----------------------------------------------------===\n")
Expand Down
Loading