Skip to content

Commit

Permalink
#Centipede Instrument distiller with RUsageProfiler
Browse files Browse the repository at this point in the history
This is a prerequisite for optimizing the module.

PiperOrigin-RevId: 597717264
  • Loading branch information
ussuri authored and copybara-github committed Jan 12, 2024
1 parent 6a65944 commit 666ec13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions centipede/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,14 @@ cc_library(
":feature",
":feature_set",
":logging",
":rusage_profiler",
":shard_reader",
":util",
":workdir",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/time",
],
)

Expand Down
7 changes: 7 additions & 0 deletions centipede/distill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/time/time.h"
#include "./centipede/blob_file.h"
#include "./centipede/defs.h"
#include "./centipede/environment.h"
#include "./centipede/feature.h"
#include "./centipede/feature_set.h"
#include "./centipede/logging.h"
#include "./centipede/rusage_profiler.h"
#include "./centipede/shard_reader.h"
#include "./centipede/util.h"
#include "./centipede/workdir.h"
Expand Down Expand Up @@ -113,6 +115,11 @@ void DistillTask(const Environment &env,
}

int Distill(const Environment &env) {
RPROF_THIS_FUNCTION_WITH_TIMELAPSE( //
/*enable=*/VLOG_IS_ON(1), //
/*timelapse_interval=*/absl::Seconds(VLOG_IS_ON(2) ? 10 : 60), //
/*also_log_timelapses=*/VLOG_IS_ON(10));

// Run `env.num_threads` independent distillation threads.
std::vector<std::thread> threads(env.num_threads);
std::vector<Environment> envs(env.num_threads, env);
Expand Down

0 comments on commit 666ec13

Please sign in to comment.