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
1 change: 1 addition & 0 deletions base/cvd/build_external/build_external.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ include("//build_external/mkbootimg:mkbootimg.MODULE.bazel")
include("//build_external/ms-tpm-20-ref:ms-tpm-20-ref.MODULE.bazel")
include("//build_external/mtools:mtools.MODULE.bazel")
include("//build_external/opengl_headers:opengl_headers.MODULE.bazel")
include("//build_external/perfetto:perfetto.MODULE.bazel")
include("//build_external/pyyaml:pyyaml.MODULE.bazel")
include("//build_external/re2:re2.MODULE.bazel")
include("//build_external/rootcanal:rootcanal.MODULE.bazel")
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions base/cvd/build_external/perfetto/perfetto.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
perfetto_ext = use_extension("//build_external/perfetto:repositories.bzl", "perfetto_extension")
use_repo(perfetto_ext, "perfetto")
use_repo(perfetto_ext, "perfetto_cfg")
35 changes: 35 additions & 0 deletions base/cvd/build_external/perfetto/repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# https://github.com/google/perfetto/issues/2787 for Perfetto getting into the
# Central Repository.
def _perfetto_extension_impl(_):
URL = "https://github.com/google/perfetto/archive/refs/tags/v54.0.tar.gz"
http_archive(
name = "perfetto",
url = URL,
strip_prefix = "perfetto-54.0",
patch_cmds = [
# Hack away all of the Android specific dependencies:
"sed -i '/load(\"@rules_android/d' bazel/rules.bzl",
"sed -i '/load(\"@perfetto\\/\\/bazel:run_ait_with_adb.bzl/d' bazel/rules.bzl",
"sed -i 's| android_binary(\\*\\*kwargs)| return|g' bazel/rules.bzl",
"sed -i 's| android_library(\\*\\*kwargs)| return|g' bazel/rules.bzl",
"sed -i 's| android_instrumentation_test(\\*\\*kwargs)| return|g' bazel/rules.bzl",
],
)

# perfetto_cfg is a new_local_repository using a path relative to the top-level WORKSPACE file.
# We replicate this with an http_archive using a bigger strip_prefix.
http_archive(
name = "perfetto_cfg",
url = URL,
strip_prefix = "perfetto-54.0/bazel/standalone",
build_file_content = "# empty BUILD to make a bazel package",
patch_cmds = [
"sed -i 's|@com_google_protobuf|@protobuf|g' perfetto_cfg.bzl",
],
)

perfetto_extension = module_extension(
implementation = _perfetto_extension_impl,
)
5 changes: 5 additions & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cf_cc_binary(
"//cuttlefish/host/libs/config/defaults",
"//cuttlefish/host/libs/config/fastboot",
"//cuttlefish/host/libs/feature:inject",
"//cuttlefish/host/libs/tracing:tracing",
"//cuttlefish/posix:symlink",
"//cuttlefish/pretty:vector",
"//libbase",
Expand Down Expand Up @@ -237,6 +238,7 @@ cf_cc_library(
"//cuttlefish/host/libs/config:vmm_mode",
"//cuttlefish/host/libs/image_aggregator",
"//cuttlefish/host/libs/image_aggregator:qcow2",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/log",
Expand Down Expand Up @@ -354,6 +356,7 @@ cf_cc_library(
"//cuttlefish/host/libs/config:secure_hals",
"//cuttlefish/host/libs/config:vmm_mode",
"//cuttlefish/host/libs/config/defaults",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/host/libs/vhal_proxy_server",
"//cuttlefish/host/libs/vm_manager",
"//cuttlefish/result",
Expand Down Expand Up @@ -402,6 +405,7 @@ cf_cc_library(
"//cuttlefish/host/libs/config:config_utils",
"//cuttlefish/host/libs/config:display",
"//cuttlefish/host/libs/config:gpu_mode",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/pretty",
"//cuttlefish/pretty:optional",
"//cuttlefish/pretty:string",
Expand Down Expand Up @@ -431,6 +435,7 @@ cf_cc_library(
"//cuttlefish/host/libs/config:guest_hwui_renderer",
"//cuttlefish/host/libs/config:guest_renderer_preload",
"//cuttlefish/host/libs/config:vmm_mode",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/result",
"//libbase",
"@abseil-cpp//absl/log",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "cuttlefish/host/libs/config/fetcher_configs.h"
#include "cuttlefish/host/libs/config/log_string_to_dir.h"
#include "cuttlefish/host/libs/feature/inject.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/posix/symlink.h"
#include "cuttlefish/pretty/vector.h"

Expand Down Expand Up @@ -304,6 +305,8 @@ Result<const CuttlefishConfig*> InitFilesystemAndCreateConfig(
const VmManagerFlag& vm_manager_flag, const Defaults& defaults,
AndroidBuilds& android_builds) {
{
CF_TRACE_EVENT_FUNC();

// The config object is created here, but only exists in memory until the
// SaveConfig line below. Don't launch cuttlefish subprocesses between these
// two operations, as those will assume they can read the config object from
Expand Down Expand Up @@ -573,6 +576,9 @@ Result<int> AssembleCvdMain(int argc, char** argv) {

CF_EXPECT(CheckNoTTY());

auto scoped_trace_flusher = InitializeTracing();
CF_TRACE_EVENT_FUNC();

// Read everything that cvd_internal_start writes, but ignore it since
// fetcher_config.json will be searched for in the system image directory.
(void) CF_EXPECT(ReadInputFiles());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "cuttlefish/host/libs/config/vmm_mode.h"
#include "cuttlefish/host/libs/image_aggregator/image_aggregator.h"
#include "cuttlefish/host/libs/image_aggregator/qcow2.h"
#include "cuttlefish/host/libs/tracing/tracing.h"

namespace cuttlefish {

Expand Down Expand Up @@ -199,6 +200,8 @@ Result<bool> DiskBuilder::WillRebuildCompositeDisk() {
}

Result<bool> DiskBuilder::BuildCompositeDiskIfNecessary() {
CF_TRACE_EVENT_FUNC();

if (!entire_disk_.empty()) {
VLOG(0) << "No composite disk to build";
return false;
Expand Down Expand Up @@ -228,6 +231,8 @@ Result<bool> DiskBuilder::BuildCompositeDiskIfNecessary() {
}

Result<bool> DiskBuilder::BuildOverlayIfNecessary() {
CF_TRACE_EVENT_FUNC();

#ifdef __APPLE__
return false;
#else
Expand Down
3 changes: 3 additions & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#include "cuttlefish/host/libs/config/instance_nums.h"
#include "cuttlefish/host/libs/config/secure_hals.h"
#include "cuttlefish/host/libs/config/vmm_mode.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/host/libs/vhal_proxy_server/vhal_proxy_server_eth_addr.h"
#include "cuttlefish/host/libs/vm_manager/gem5_manager.h"
#include "cuttlefish/host/libs/vm_manager/qemu_manager.h"
Expand Down Expand Up @@ -352,6 +353,8 @@ Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
const SystemImageDirFlag& system_image_dir,
const VendorBootImageFlag& vendor_boot_image,
const VmManagerFlag& vm_manager_flag, const Defaults& defaults) {
CF_TRACE_EVENT_FUNC();

CuttlefishConfig tmp_config_obj;
// If a snapshot path is provided, do not read all flags to set up the config.
// Instead, read the config that was saved at time of snapshot and restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "cuttlefish/host/libs/config/guest_hwui_renderer.h"
#include "cuttlefish/host/libs/config/guest_renderer_preload.h"
#include "cuttlefish/host/libs/config/vmm_mode.h"
#include "cuttlefish/host/libs/tracing/tracing.h"

#ifdef __APPLE__
#define CF_UNUSED_ON_MACOS [[maybe_unused]]
Expand Down Expand Up @@ -681,6 +682,8 @@ static std::unordered_set<std::string> kSupportedGpuContexts{

gfxstream::proto::GraphicsAvailability
GetGraphicsAvailabilityWithSubprocessCheck() {
CF_TRACE_EVENT_FUNC();

#ifdef __APPLE__
return {};
#else
Expand Down Expand Up @@ -734,6 +737,8 @@ Result<GpuMode> ConfigureGpuSettings(
const std::string& guest_renderer_preload_arg, VmmMode vmm,
const GuestConfig& guest_config,
CuttlefishConfig::MutableInstanceSpecific& instance) {
CF_TRACE_EVENT_FUNC();

#ifdef __APPLE__
(void)graphics_availability;
(void)gpu_vhost_user_mode_arg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "cuttlefish/host/libs/config/config_utils.h"
#include "cuttlefish/host/libs/config/display.h"
#include "cuttlefish/host/libs/config/gpu_mode.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/pretty/optional.h"
#include "cuttlefish/pretty/string.h"

Expand Down Expand Up @@ -309,6 +310,8 @@ PrettyStruct Pretty(const GuestConfig& config, PrettyAdlPlaceholder) {
Result<std::vector<GuestConfig>> ReadGuestConfig(
const BootImageFlag& boot_image, const KernelPathFlag& kernel_path,
const SystemImageDirFlag& system_image_dirs) {
CF_TRACE_EVENT_FUNC();

std::vector<GuestConfig> guest_configs;

const std::string env_path = fmt::format(
Expand Down
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cf_cc_binary(
"//cuttlefish/common/libs/utils:tee_logging",
"//cuttlefish/host/commands/cvd/utils",
"//cuttlefish/host/commands/cvd/version",
"//cuttlefish/host/libs/tracing:tracing",
"//cuttlefish/host/libs/vm_manager",
"//cuttlefish/posix:strerror",
"//libbase",
Expand Down
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ cf_cc_library(
"//cuttlefish/host/commands/cvd/instances:instance_manager",
"//cuttlefish/host/commands/cvd/instances/lock",
"//cuttlefish/host/commands/cvd/utils",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/host/libs/metrics:device_metrics_orchestration",
"//cuttlefish/posix:strerror",
"//cuttlefish/posix:symlink",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ cf_cc_library(
"//cuttlefish/host/commands/cvd/fetch:fetch_cvd_parser",
"//cuttlefish/host/commands/cvd/utils",
"//cuttlefish/host/commands/cvd/utils:common",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/host/libs/metrics:fetch_metrics_orchestration",
"//cuttlefish/result",
"//libbase",
Expand Down
3 changes: 3 additions & 0 deletions base/cvd/cuttlefish/host/commands/cvd/cli/commands/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "cuttlefish/host/commands/cvd/instances/instance_manager.h"
#include "cuttlefish/host/commands/cvd/instances/local_instance_group.h"
#include "cuttlefish/host/commands/cvd/utils/common.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/posix/strerror.h"
#include "cuttlefish/posix/symlink.h"
#include "cuttlefish/result/result.h"
Expand Down Expand Up @@ -294,6 +295,8 @@ Result<void> CvdCreateCommandHandler::CreateSymlinks(
}

Result<void> CvdCreateCommandHandler::Handle(const CommandRequest& request) {
CF_TRACE_EVENT_FUNC();

CF_EXPECT(CanHandle(request));
std::vector<std::string> subcmd_args = request.SubcommandArguments();
bool is_help = CF_EXPECT(HasHelpFlag(subcmd_args));
Expand Down
3 changes: 3 additions & 0 deletions base/cvd/cuttlefish/host/commands/cvd/cli/commands/fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "cuttlefish/host/commands/cvd/fetch/fetch_cvd_parser.h"
#include "cuttlefish/host/commands/cvd/utils/common.h"
#include "cuttlefish/host/libs/metrics/fetch_metrics_orchestration.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/result/result.h"

namespace cuttlefish {
Expand All @@ -51,6 +52,8 @@ class CvdFetchCommandHandler : public CvdCommandHandler {
};

Result<void> CvdFetchCommandHandler::Handle(const CommandRequest& request) {
CF_TRACE_EVENT_FUNC();

CF_EXPECT(CanHandle(request));

std::vector<std::string> args = request.SubcommandArguments();
Expand Down
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ cf_cc_library(
"//cuttlefish/host/libs/config:fetcher_config",
"//cuttlefish/host/libs/config:file_source",
"//cuttlefish/host/libs/image_aggregator:sparse_image",
"//cuttlefish/host/libs/tracing",
"//cuttlefish/host/libs/web:android_build",
"//cuttlefish/host/libs/web:android_build_string",
"//cuttlefish/host/libs/web:chrome_os_build_string",
Expand Down
26 changes: 26 additions & 0 deletions base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "cuttlefish/host/libs/config/fetcher_config.h"
#include "cuttlefish/host/libs/config/file_source.h"
#include "cuttlefish/host/libs/image_aggregator/sparse_image.h"
#include "cuttlefish/host/libs/tracing/tracing.h"
#include "cuttlefish/host/libs/web/android_build.h"
#include "cuttlefish/host/libs/web/android_build_string.h"
#include "cuttlefish/host/libs/web/chrome_os_build_string.h"
Expand Down Expand Up @@ -101,6 +102,8 @@ std::vector<Target> GetFetchTargets(const FetchFlags& flags,
Result<void> EnsureDirectoriesExist(const std::string& host_tools_directory,
const std::string& cache_base_path,
const std::vector<Target>& targets) {
CF_TRACE_EVENT_FUNC();

CF_EXPECT(EnsureDirectoryExists(host_tools_directory));
CF_EXPECT(EnsureDirectoryExists(cache_base_path));
for (const auto& target : targets) {
Expand All @@ -125,6 +128,7 @@ Result<std::optional<Build>> GetBuildHelper(

Result<Builds> GetBuilds(BuildApi& build_api,
const BuildStrings& build_sources) {
CF_TRACE_EVENT_FUNC();
Builds result = Builds{
.default_build = CF_EXPECT(GetBuildHelper(
build_api, build_sources.default_build, kDefaultBuildTarget)),
Expand Down Expand Up @@ -203,6 +207,8 @@ Result<void> FetchDefaultTarget(FetchBuildContext& context,
bool keep_downloaded_archives,
const DownloadFlags& flags,
bool has_system_build) {
CF_TRACE_EVENT_FUNC();

constexpr char kSignedPrefix[] = "signed/signed-";
// Some older builds might not have misc_info.txt, so permit errors on
// fetching misc_info.txt
Expand Down Expand Up @@ -262,6 +268,8 @@ Result<void> FetchDefaultTarget(FetchBuildContext& context,
Result<void> FetchSystemTarget(FetchBuildContext& context,
bool download_img_zip,
const bool keep_downloaded_archives) {
CF_TRACE_EVENT_FUNC();

std::string target_files_name = context.GetBuildZipName("target_files");
FetchArtifact target_files = context.Artifact(target_files_name);

Expand Down Expand Up @@ -303,6 +311,8 @@ Result<void> FetchSystemTarget(FetchBuildContext& context,
}

Result<void> FetchKernelTarget(FetchBuildContext context) {
CF_TRACE_EVENT_FUNC();

// If the kernel is from an arm/aarch64 build, the artifact will be called
// Image.
if (!context.Artifact("bzImage").DownloadTo("kernel").ok()) {
Expand All @@ -318,6 +328,8 @@ Result<void> FetchKernelTarget(FetchBuildContext context) {

Result<void> FetchBootTarget(FetchBuildContext& context,
bool keep_downloaded_archives) {
CF_TRACE_EVENT_FUNC();

std::string img_zip = context.GetBuildZipName("img");
std::string to_download = context.GetFilepath().value_or(img_zip);
FetchArtifact artifact = context.Artifact(to_download);
Expand All @@ -335,6 +347,8 @@ Result<void> FetchBootTarget(FetchBuildContext& context,
}

Result<void> FetchBootloaderTarget(FetchBuildContext& context) {
CF_TRACE_EVENT_FUNC();

// If the bootloader is from an arm/aarch64 build, the artifact will be of
// filetype bin.
if (!context.Artifact("u-boot.rom").DownloadTo("bootloader").ok()) {
Expand All @@ -344,13 +358,17 @@ Result<void> FetchBootloaderTarget(FetchBuildContext& context) {
}

Result<void> FetchAndroidEfiLoaderTarget(FetchBuildContext& context) {
CF_TRACE_EVENT_FUNC();

std::string filename = context.GetFilepath().value_or("gbl_x86_64.efi");
CF_EXPECT(context.Artifact(filename).DownloadTo("android_efi_loader.efi"));
return {};
}

Result<void> FetchOtaToolsTarget(FetchBuildContext& context,
bool keep_downloaded_archives) {
CF_TRACE_EVENT_FUNC();

FetchArtifact otatools = context.Artifact("otatools.zip");
CF_EXPECT(otatools.Download());
CF_EXPECT(otatools.ExtractAll());
Expand All @@ -362,6 +380,8 @@ Result<void> FetchOtaToolsTarget(FetchBuildContext& context,

Result<void> FetchTestSuitesTarget(FetchBuildContext& context,
bool keep_downloaded_archives) {
CF_TRACE_EVENT_FUNC();

FetchArtifact android_cts = context.Artifact("android-cts.zip");
// TODO(b/468074996): determine what tradefed actually needs and potentially
// expose a flag to allow downloading specific parts of the entire zip.
Expand All @@ -379,6 +399,8 @@ Result<void> FetchChromeOsTarget(
const TargetDirectories& target_directories,
const bool keep_downloaded_archives, FetcherConfig& config,
FetchTracer::Trace trace) {
CF_TRACE_EVENT_FUNC();

auto artifacts_opt =
CF_EXPECT(luci_build_api.GetBuildArtifacts(chrome_os_build_string));
auto artifacts = CF_EXPECT(std::move(artifacts_opt));
Expand All @@ -404,6 +426,8 @@ Result<void> FetchChromeOsTarget(
Result<void> FetchTarget(FetchContext& fetch_context,
const DownloadFlags& flags,
const bool keep_downloaded_archives) {
CF_TRACE_EVENT_FUNC();

if (std::optional<FetchBuildContext> context = fetch_context.DefaultBuild()) {
bool has_system_build = fetch_context.SystemBuild().has_value();
CF_EXPECT(FetchDefaultTarget(*context, keep_downloaded_archives, flags,
Expand Down Expand Up @@ -447,6 +471,8 @@ Result<FetchResult> Fetch(const FetchFlags& flags,
const std::string& cache_base_path,
const HostToolsTarget& host_target,
std::vector<Target>& targets) {
CF_TRACE_EVENT_FUNC();

#ifdef __BIONIC__
// TODO(schuffelen): Find a better way to deal with tzdata
setenv("ANDROID_TZDATA_ROOT", "/", /* overwrite */ 0);
Expand Down
Loading
Loading