Add sampling profiler
This adds a sampling profiler thread that runs every so often, gathering
profiling data and writing the results to a file in /data/data (specific to
app running). The intention is to use these files as input to the compiler
so that it can determine the best methods to compile.
Bug: 11539952
Change-Id: I0bfbb4146fb7966673c792f017ffac8107b6272d
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 7b57dda..50da0dc 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -139,6 +139,12 @@
size_t tiny_method_threshold_;
size_t num_dex_methods_threshold_;
bool sea_ir_mode_;
+ bool profile_;
+ std::string profile_output_filename_;
+ int profile_period_s_;
+ int profile_duration_s_;
+ int profile_interval_us_;
+ double profile_backoff_coefficient_;
private:
ParsedOptions() {}
@@ -455,6 +461,8 @@
const std::vector<const DexFile*>& GetCompileTimeClassPath(jobject class_loader);
void SetCompileTimeClassPath(jobject class_loader, std::vector<const DexFile*>& class_path);
+ void StartProfiler(const char *appDir, bool startImmediately = false);
+
private:
static void InitPlatformSignalHandlers();
@@ -566,6 +574,14 @@
bool stats_enabled_;
RuntimeStats stats_;
+ // Runtime profile support.
+ bool profile_;
+ std::string profile_output_filename_;
+ uint32_t profile_period_s_; // Generate profile every n seconds.
+ uint32_t profile_duration_s_; // Run profile for n seconds.
+ uint32_t profile_interval_us_; // Microseconds between samples.
+ double profile_backoff_coefficient_; // Coefficient to exponential backoff.
+
bool method_trace_;
std::string method_trace_file_;
size_t method_trace_file_size_;