Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Delete support for compiler performance stats collection.
Browse files Browse the repository at this point in the history
This wasn't used frequently enough to rationalize being so deeply woven into the build rules. A better approach might be to use an aspect that runs the same actions in parallel but with the necessary stats flags and collects the data files; while this would double the actions executed, it's better code-health wise. But I don't have any plans to do that in the near-term.

PiperOrigin-RevId: 363887607
  • Loading branch information
allevato authored and swiple-rules-gardener committed Mar 19, 2021
1 parent 027e180 commit 4234e38
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 454 deletions.
8 changes: 0 additions & 8 deletions swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ bzl_library(
],
)

bzl_library(
name = "stats",
srcs = ["stats.bzl"],
deps = [
"//swift/internal:build_defs",
],
)

bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
Expand Down
35 changes: 0 additions & 35 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ load(":derived_files.bzl", "derived_files")
load(
":feature_names.bzl",
"SWIFT_FEATURE_CACHEABLE_SWIFTMODULES",
"SWIFT_FEATURE_COMPILE_STATS",
"SWIFT_FEATURE_COVERAGE",
"SWIFT_FEATURE_DBG",
"SWIFT_FEATURE_DEBUG_PREFIX_MAP",
Expand Down Expand Up @@ -177,14 +176,6 @@ def compile_action_configs(
actions = [swift_action_names.COMPILE],
configurators = [_emit_objc_header_path_configurator],
),

# Configure the location where compiler performance statistics are
# dumped.
swift_toolchain_config.action_config(
actions = [swift_action_names.COMPILE],
configurators = [_stats_output_dir_configurator],
features = [SWIFT_FEATURE_COMPILE_STATS],
),
]

#### Compilation-mode-related flags
Expand Down Expand Up @@ -1062,10 +1053,6 @@ def _module_name_configurator(prerequisites, args):
"""Adds the module name flag to the command line."""
args.add("-module-name", prerequisites.module_name)

def _stats_output_dir_configurator(prerequisites, args):
"""Adds the compile stats output directory path to the command line."""
args.add("-stats-output-dir", prerequisites.stats_directory.path)

def _source_files_configurator(prerequisites, args):
"""Adds source files to the command line and required inputs."""
args.add_all(prerequisites.source_files)
Expand Down Expand Up @@ -1303,9 +1290,6 @@ def compile(
* `precompiled_module`: A `File` representing the explicit module
(`.pcm`) of the Clang module for the generated header, or `None` if
no explicit module was generated.
* `stats_directory`: A `File` representing the directory that contains
the timing statistics emitted by the compiler. If no stats were
requested, this field will be None.
* `swiftdoc`: The `.swiftdoc` file that was produced by the compiler.
* `swiftinterface`: The `.swiftinterface` file that was produced by
the compiler. If no interface file was produced (because the
Expand Down Expand Up @@ -1337,7 +1321,6 @@ def compile(
compile_outputs.swiftinterface_file,
compile_outputs.generated_header_file,
compile_outputs.indexstore_directory,
compile_outputs.stats_directory,
]) + compile_outputs.object_files + other_outputs

# Merge the providers from our dependencies so that we have one each for
Expand Down Expand Up @@ -1479,7 +1462,6 @@ def compile(
post_compile_results.additional_object_files
),
precompiled_module = precompiled_module,
stats_directory = compile_outputs.stats_directory,
swiftdoc = compile_outputs.swiftdoc_file,
swiftinterface = compile_outputs.swiftinterface_file,
swiftmodule = compile_outputs.swiftmodule_file,
Expand Down Expand Up @@ -1669,17 +1651,6 @@ def _declare_compile_outputs(
else:
swiftinterface_file = None

if is_feature_enabled(
feature_configuration = feature_configuration,
feature_name = SWIFT_FEATURE_COMPILE_STATS,
):
stats_directory = derived_files.stats_directory(
actions = actions,
target_name = target_name,
)
else:
stats_directory = None

# If requested, generate the Swift header for this library so that it can be
# included by Objective-C code that depends on it.
if generated_header_name:
Expand Down Expand Up @@ -1781,7 +1752,6 @@ def _declare_compile_outputs(
indexstore_directory = indexstore_directory,
object_files = object_files,
output_file_map = output_file_map,
stats_directory = stats_directory,
swiftdoc_file = swiftdoc_file,
swiftinterface_file = swiftinterface_file,
swiftmodule_file = swiftmodule_file,
Expand Down Expand Up @@ -2147,11 +2117,6 @@ def output_groups_from_compilation_outputs(compilation_outputs):
compilation_outputs.indexstore,
])

if compilation_outputs.stats_directory:
output_groups["swift_compile_stats_direct"] = depset([
compilation_outputs.stats_directory,
])

if compilation_outputs.swiftinterface:
output_groups["swiftinterface"] = depset([
compilation_outputs.swiftinterface,
Expand Down
13 changes: 0 additions & 13 deletions swift/internal/derived_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,6 @@ def _static_archive(actions, alwayslink, link_name):
extension = "lo" if alwayslink else "a"
return actions.declare_file("lib{}.{}".format(link_name, extension))

def _stats_directory(actions, target_name):
"""Declares a directory that will contain timing statistics for a compile.
Args:
actions: The context's actions object.
target_name: The name of the target being built.
Returns:
The declared `File`.
"""
return actions.declare_directory("{}.compile-stats".format(target_name))

def _swiftc_output_file_map(actions, target_name):
"""Declares a file for the output file map for a compilation action.
Expand Down Expand Up @@ -317,7 +305,6 @@ derived_files = struct(
precompiled_module = _precompiled_module,
reexport_modules_src = _reexport_modules_src,
static_archive = _static_archive,
stats_directory = _stats_directory,
swiftc_output_file_map = _swiftc_output_file_map,
swiftdoc = _swiftdoc,
swiftinterface = _swiftinterface,
Expand Down
9 changes: 0 additions & 9 deletions swift/internal/feature_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ SWIFT_FEATURE_COVERAGE = "swift.coverage"
# `swift_test` output just a binary.
SWIFT_FEATURE_BUNDLED_XCTESTS = "swift.bundled_xctests"

# If enabled, the Swift compiler will emit a directory containing JSON files
# with timing information about the driver/frontend's actions. This directory
# will be emitted as a default output when a Swift target is built directly, and
# it will also be propagated in an output group named
# `swift_compile_stats_direct`. Typically this output group will not be accessed
# directly, but used by the `collect_swift_compile_stats` aspect to gather the
# transitive stats for the entire build.
SWIFT_FEATURE_COMPILE_STATS = "swift.compile_stats"

# If enabled, debug builds will use the `-debug-prefix-map` feature to remap the
# current working directory to `.`, which permits debugging remote or sandboxed
# builds.
Expand Down
61 changes: 0 additions & 61 deletions swift/stats.bzl

This file was deleted.

6 changes: 0 additions & 6 deletions tools/compile_stats/BUILD

This file was deleted.

18 changes: 0 additions & 18 deletions tools/compile_stats/README.md

This file was deleted.

62 changes: 0 additions & 62 deletions tools/compile_stats/build.sh

This file was deleted.

Loading

0 comments on commit 4234e38

Please sign in to comment.