diff options
author | elijahtaylor@chromium.org <elijahtaylor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 20:49:34 +0000 |
---|---|---|
committer | elijahtaylor@chromium.org <elijahtaylor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 20:49:34 +0000 |
commit | 4564949f87f10dc504993080785fa1fbb60bb978 (patch) | |
tree | 18b622d0656fb4c7a2f7ecce39a596a0b43b80a7 /ppapi/native_client | |
parent | cba826490cd939ae2f22363c5163517017c5a7d0 (diff) | |
download | chromium_src-4564949f87f10dc504993080785fa1fbb60bb978.zip chromium_src-4564949f87f10dc504993080785fa1fbb60bb978.tar.gz chromium_src-4564949f87f10dc504993080785fa1fbb60bb978.tar.bz2 |
Proxy private UMA pepper interface for out-of-process and NaCl plugins.
BUG=317833
Review URL: https://codereview.chromium.org/61643022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
4 files changed, 206 insertions, 227 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 2bf3021..3309d65 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -34,7 +34,6 @@ #include "ppapi/c/ppb_var.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/private/ppb_nacl_private.h" -#include "ppapi/c/private/ppb_uma_private.h" #include "ppapi/cpp/dev/url_util_dev.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/text_input_controller.h" @@ -104,63 +103,108 @@ const PPB_NaCl_Private* GetNaClInterface() { module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); } -const PPB_UMA_Private* GetUMAInterface() { - pp::Module *module = pp::Module::Get(); - CHECK(module); - return static_cast<const PPB_UMA_Private*>( - module->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); -} +} // namespace -void HistogramTimeSmall(const std::string& name, int64_t ms) { - if (ms < 0) return; +bool Plugin::EarlyInit(int argc, const char* argn[], const char* argv[]) { + PLUGIN_PRINTF(("Plugin::EarlyInit (instance=%p)\n", + static_cast<void*>(this))); + +#ifdef NACL_OSX + // TODO(kochi): For crbug.com/102808, this is a stopgap solution for Lion + // until we expose IME API to .nexe. This disables any IME interference + // against key inputs, so you cannot use off-the-spot IME input for NaCl apps. + // This makes discrepancy among platforms and therefore we should remove + // this hack when IME API is made available. + // The default for non-Mac platforms is still off-the-spot IME mode. + pp::TextInputController(this).SetTextInputType(PP_TEXTINPUT_TYPE_NONE); +#endif + + // Remember the embed/object argn/argv pairs. + argn_ = new char*[argc]; + argv_ = new char*[argc]; + argc_ = 0; + for (int i = 0; i < argc; ++i) { + if (NULL != argn_ && NULL != argv_) { + argn_[argc_] = strdup(argn[i]); + argv_[argc_] = strdup(argv[i]); + if (NULL == argn_[argc_] || NULL == argv_[argc_]) { + // Give up on passing arguments. + free(argn_[argc_]); + free(argv_[argc_]); + continue; + } + ++argc_; + } + } + // TODO(sehr): this leaks strings if there is a subsequent failure. - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; + // Set up the factory used to produce DescWrappers. + wrapper_factory_ = new nacl::DescWrapperFactory(); + if (NULL == wrapper_factory_) { + return false; + } + PLUGIN_PRINTF(("Plugin::Init (wrapper_factory=%p)\n", + static_cast<void*>(wrapper_factory_))); - ptr->HistogramCustomTimes(pp::Var(name).pp_var(), - ms, - kTimeSmallMin, kTimeSmallMax, - kTimeSmallBuckets); + PLUGIN_PRINTF(("Plugin::Init (return 1)\n")); + // Return success. + return true; } -void HistogramTimeMedium(const std::string& name, int64_t ms) { - if (ms < 0) return; +void Plugin::ShutDownSubprocesses() { + PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (this=%p)\n", + static_cast<void*>(this))); + PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (%s)\n", + main_subprocess_.detailed_description().c_str())); - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; + // Shut down service runtime. This must be done before all other calls so + // they don't block forever when waiting for the upcall thread to exit. + main_subprocess_.Shutdown(); - ptr->HistogramCustomTimes(pp::Var(name).pp_var(), - ms, - kTimeMediumMin, kTimeMediumMax, - kTimeMediumBuckets); + PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n", + static_cast<void*>(this))); } -void HistogramTimeLarge(const std::string& name, int64_t ms) { +void Plugin::HistogramTimeSmall(const std::string& name, + int64_t ms) { if (ms < 0) return; + uma_interface_.HistogramCustomTimes(name, + ms, + kTimeSmallMin, kTimeSmallMax, + kTimeSmallBuckets); +} - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; +void Plugin::HistogramTimeMedium(const std::string& name, + int64_t ms) { + if (ms < 0) return; + uma_interface_.HistogramCustomTimes(name, + ms, + kTimeMediumMin, kTimeMediumMax, + kTimeMediumBuckets); +} - ptr->HistogramCustomTimes(pp::Var(name).pp_var(), - ms, - kTimeLargeMin, kTimeLargeMax, - kTimeLargeBuckets); +void Plugin::HistogramTimeLarge(const std::string& name, + int64_t ms) { + if (ms < 0) return; + uma_interface_.HistogramCustomTimes(name, + ms, + kTimeLargeMin, kTimeLargeMax, + kTimeLargeBuckets); } -void HistogramSizeKB(const std::string& name, int32_t sample) { +void Plugin::HistogramSizeKB(const std::string& name, + int32_t sample) { if (sample < 0) return; - - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - - ptr->HistogramCustomCounts(pp::Var(name).pp_var(), - sample, - kSizeKBMin, kSizeKBMax, - kSizeKBBuckets); + uma_interface_.HistogramCustomCounts(name, + sample, + kSizeKBMin, kSizeKBMax, + kSizeKBBuckets); } -void HistogramEnumerate(const std::string& name, int sample, int maximum, - int out_of_range_replacement) { +void Plugin::HistogramEnumerate(const std::string& name, + int sample, + int maximum, + int out_of_range_replacement) { if (sample < 0 || sample >= maximum) { if (out_of_range_replacement < 0) // No replacement for bad input, abort. @@ -169,12 +213,10 @@ void HistogramEnumerate(const std::string& name, int sample, int maximum, // Use a specific value to signal a bad input. sample = out_of_range_replacement; } - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - ptr->HistogramEnumeration(pp::Var(name).pp_var(), sample, maximum); + uma_interface_.HistogramEnumeration(name, sample, maximum); } -void HistogramEnumerateOsArch(const std::string& sandbox_isa) { +void Plugin::HistogramEnumerateOsArch(const std::string& sandbox_isa) { enum NaClOSArch { kNaClLinux32 = 0, kNaClLinux64, @@ -205,22 +247,21 @@ void HistogramEnumerateOsArch(const std::string& sandbox_isa) { HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); } -void HistogramEnumerateLoadStatus(PluginErrorCode error_code, - bool is_installed) { +void Plugin::HistogramEnumerateLoadStatus(PluginErrorCode error_code, + bool is_installed) { HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX, ERROR_UNKNOWN); // Gather data to see if being installed changes load outcomes. const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : "NaCl.LoadStatus.Plugin.NotInstalledApp"; - HistogramEnumerate(name, error_code, ERROR_MAX, - ERROR_UNKNOWN); + HistogramEnumerate(name, error_code, ERROR_MAX, ERROR_UNKNOWN); } -void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, - bool is_installed) { - HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX, - LOAD_STATUS_UNKNOWN); +void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, + bool is_installed) { + HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, + NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); // Gather data to see if being installed changes load outcomes. const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" : @@ -229,11 +270,12 @@ void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, LOAD_STATUS_UNKNOWN); } -void HistogramEnumerateManifestIsDataURI(bool is_data_uri) { +void Plugin::HistogramEnumerateManifestIsDataURI(bool is_data_uri) { HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1); } -void HistogramHTTPStatusCode(const std::string& name, int status) { +void Plugin::HistogramHTTPStatusCode(const std::string& name, + int status) { // Log the status codes in rough buckets - 1XX, 2XX, etc. int sample = status / 100; // HTTP status codes only go up to 5XX, using "6" to indicate an internal @@ -244,84 +286,6 @@ void HistogramHTTPStatusCode(const std::string& name, int status) { HistogramEnumerate(name, sample, 7, 6); } -} // namespace - -bool Plugin::EarlyInit(int argc, const char* argn[], const char* argv[]) { - PLUGIN_PRINTF(("Plugin::EarlyInit (instance=%p)\n", - static_cast<void*>(this))); - -#ifdef NACL_OSX - // TODO(kochi): For crbug.com/102808, this is a stopgap solution for Lion - // until we expose IME API to .nexe. This disables any IME interference - // against key inputs, so you cannot use off-the-spot IME input for NaCl apps. - // This makes discrepancy among platforms and therefore we should remove - // this hack when IME API is made available. - // The default for non-Mac platforms is still off-the-spot IME mode. - pp::TextInputController(this).SetTextInputType(PP_TEXTINPUT_TYPE_NONE); -#endif - - // Remember the embed/object argn/argv pairs. - argn_ = new char*[argc]; - argv_ = new char*[argc]; - argc_ = 0; - for (int i = 0; i < argc; ++i) { - if (NULL != argn_ && NULL != argv_) { - argn_[argc_] = strdup(argn[i]); - argv_[argc_] = strdup(argv[i]); - if (NULL == argn_[argc_] || NULL == argv_[argc_]) { - // Give up on passing arguments. - free(argn_[argc_]); - free(argv_[argc_]); - continue; - } - ++argc_; - } - } - // TODO(sehr): this leaks strings if there is a subsequent failure. - - // Set up the factory used to produce DescWrappers. - wrapper_factory_ = new nacl::DescWrapperFactory(); - if (NULL == wrapper_factory_) { - return false; - } - PLUGIN_PRINTF(("Plugin::Init (wrapper_factory=%p)\n", - static_cast<void*>(wrapper_factory_))); - - PLUGIN_PRINTF(("Plugin::Init (return 1)\n")); - // Return success. - return true; -} - -void Plugin::ShutDownSubprocesses() { - PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (this=%p)\n", - static_cast<void*>(this))); - PLUGIN_PRINTF(("Plugin::ShutDownSubprocesses (%s)\n", - main_subprocess_.detailed_description().c_str())); - - // Shut down service runtime. This must be done before all other calls so - // they don't block forever when waiting for the upcall thread to exit. - main_subprocess_.Shutdown(); - - PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n", - static_cast<void*>(this))); -} - -void Plugin::StartSelLdrOnMainThread(int32_t pp_error, - ServiceRuntime* service_runtime, - const SelLdrStartParams& params, - bool* success) { - if (pp_error != PP_OK) { - PLUGIN_PRINTF(("Plugin::StartSelLdrOnMainThread: non-PP_OK arg " - "-- SHOULD NOT HAPPEN\n")); - *success = false; - return; - } - *success = service_runtime->StartSelLdr(params); - // Signal outside of StartSelLdr here, so that the write to *success - // is done before signaling. - service_runtime->SignalStartSelLdrDone(); -} - bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, NaClSubprocess* subprocess, const Manifest* manifest, @@ -374,6 +338,22 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, return true; } +void Plugin::StartSelLdrOnMainThread(int32_t pp_error, + ServiceRuntime* service_runtime, + const SelLdrStartParams& params, + bool* success) { + if (pp_error != PP_OK) { + PLUGIN_PRINTF(("Plugin::StartSelLdrOnMainThread: non-PP_OK arg " + "-- SHOULD NOT HAPPEN\n")); + *success = false; + return; + } + *success = service_runtime->StartSelLdr(params); + // Signal outside of StartSelLdr here, so that the write to *success + // is done before signaling. + service_runtime->SignalStartSelLdrDone(); +} + bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, ErrorInfo* error_info, bool enable_dyncode_syscalls, @@ -651,7 +631,8 @@ Plugin::Plugin(PP_Instance pp_instance) nexe_size_(0), time_of_last_progress_event_(0), exit_status_(-1), - nacl_interface_(NULL) { + nacl_interface_(NULL), + uma_interface_(this) { PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" NACL_PRId32 ")\n", static_cast<void*>(this), pp_instance)); callback_factory_.Initialize(this); @@ -1309,7 +1290,6 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, } -// TODO(ncbray): report UMA stats void Plugin::ReportLoadError(const ErrorInfo& error_info) { PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n", error_info.message().c_str())); diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index ca83489..240d314 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -23,6 +23,7 @@ #include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/cpp/private/instance_private.h" +#include "ppapi/cpp/private/uma_private.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/view.h" @@ -253,6 +254,7 @@ class Plugin : public pp::InstancePrivate { void set_exit_status(int exit_status); const PPB_NaCl_Private* nacl_interface() const { return nacl_interface_; } + pp::UMAPrivate& uma_interface() { return uma_interface_; } private: NACL_DISALLOW_COPY_AND_ASSIGN(Plugin); @@ -278,6 +280,24 @@ class Plugin : public pp::InstancePrivate { return main_subprocess_.service_runtime(); } + // Histogram helper functions, internal to Plugin so they can use + // uma_interface_ normally. + void HistogramTimeSmall(const std::string& name, int64_t ms); + void HistogramTimeMedium(const std::string& name, int64_t ms); + void HistogramTimeLarge(const std::string& name, int64_t ms); + void HistogramSizeKB(const std::string& name, int32_t sample); + void HistogramEnumerate(const std::string& name, + int sample, + int maximum, + int out_of_range_replacement); + void HistogramEnumerateOsArch(const std::string& sandbox_isa); + void HistogramEnumerateLoadStatus(PluginErrorCode error_code, + bool is_installed); + void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, + bool is_installed); + void HistogramEnumerateManifestIsDataURI(bool is_data_uri); + void HistogramHTTPStatusCode(const std::string& name, int status); + // Help load a nacl module, from the file specified in wrapper. // This will fully initialize the |subprocess| if the load was successful. bool LoadNaClModuleCommon(nacl::DescWrapper* wrapper, @@ -465,6 +485,7 @@ class Plugin : public pp::InstancePrivate { int exit_status_; const PPB_NaCl_Private* nacl_interface_; + pp::UMAPrivate uma_interface_; }; } // namespace plugin diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index f892059..9e96f0d 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -121,85 +121,56 @@ const int32_t kKBPSMin = 1; const int32_t kKBPSMax = 30*1000; // max of 30 MB / sec. const uint32_t kKBPSBuckets = 100; -const PPB_UMA_Private* uma_interface = NULL; - -const PPB_UMA_Private* GetUMAInterface() { - if (uma_interface != NULL) { - return uma_interface; - } - pp::Module *module = pp::Module::Get(); - DCHECK(module); - uma_interface = static_cast<const PPB_UMA_Private*>( - module->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); - return uma_interface; -} - -void HistogramTime(const std::string& name, int64_t ms) { +void HistogramTime(pp::UMAPrivate& uma, + const std::string& name, int64_t ms) { if (ms < 0) return; - - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - - ptr->HistogramCustomTimes(pp::Var(name).pp_var(), - ms, - kTimeLargeMin, kTimeLargeMax, - kTimeLargeBuckets); + uma.HistogramCustomTimes(name, + ms, + kTimeLargeMin, kTimeLargeMax, + kTimeLargeBuckets); } -void HistogramSizeKB(const std::string& name, int32_t kb) { +void HistogramSizeKB(pp::UMAPrivate& uma, + const std::string& name, int32_t kb) { if (kb < 0) return; - - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - - ptr->HistogramCustomCounts(pp::Var(name).pp_var(), - kb, - kSizeKBMin, kSizeKBMax, - kSizeKBBuckets); + uma.HistogramCustomCounts(name, + kb, + kSizeKBMin, kSizeKBMax, + kSizeKBBuckets); } -void HistogramRatio(const std::string& name, int64_t a, int64_t b) { +void HistogramRatio(pp::UMAPrivate& uma, + const std::string& name, int64_t a, int64_t b) { if (a < 0 || b <= 0) return; - - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - - ptr->HistogramCustomCounts(pp::Var(name).pp_var(), - 100 * a / b, - kRatioMin, kRatioMax, - kRatioBuckets); + uma.HistogramCustomCounts(name, + 100 * a / b, + kRatioMin, kRatioMax, + kRatioBuckets); } -void HistogramKBPerSec(const std::string& name, double kb, double s) { +void HistogramKBPerSec(pp::UMAPrivate& uma, + const std::string& name, double kb, double s) { if (kb < 0.0 || s <= 0.0) return; - - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - - ptr->HistogramCustomCounts(pp::Var(name).pp_var(), - static_cast<int64_t>(kb / s), - kKBPSMin, kKBPSMax, - kKBPSBuckets); + uma.HistogramCustomCounts(name, + static_cast<int64_t>(kb / s), + kKBPSMin, kKBPSMax, + kKBPSBuckets); } -void HistogramEnumerateTranslationCache(bool hit) { - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; - ptr->HistogramEnumeration(pp::Var("NaCl.Perf.PNaClCache.IsHit").pp_var(), - hit, 2); +void HistogramEnumerateTranslationCache(pp::UMAPrivate& uma, bool hit) { + uma.HistogramEnumeration("NaCl.Perf.PNaClCache.IsHit", + hit, 2); } // Opt level is expected to be 0 to 3. Treating 4 as unknown. const int8_t kOptUnknown = 4; -void HistogramOptLevel(int8_t opt_level) { - const PPB_UMA_Private* ptr = GetUMAInterface(); - if (ptr == NULL) return; +void HistogramOptLevel(pp::UMAPrivate& uma, int8_t opt_level) { if (opt_level < 0 || opt_level > 3) { opt_level = kOptUnknown; } - ptr->HistogramEnumeration(pp::Var("NaCl.Options.PNaCl.OptLevel").pp_var(), - opt_level, kOptUnknown+1); + uma.HistogramEnumeration("NaCl.Options.PNaCl.OptLevel", + opt_level, kOptUnknown+1); } } // namespace @@ -347,20 +318,22 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { } // If there are no errors, report stats from this thread (the main thread). - HistogramOptLevel(pnacl_options_.opt_level()); + HistogramOptLevel(plugin_->uma_interface(), pnacl_options_.opt_level()); const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); - HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", + HistogramTime(plugin_->uma_interface(), + "NaCl.Perf.PNaClLoadTime.LoadCompiler", time_stats.pnacl_llc_load_time / NACL_MICROS_PER_MILLI); - HistogramTime("NaCl.Perf.PNaClLoadTime.CompileTime", + HistogramTime(plugin_->uma_interface(), "NaCl.Perf.PNaClLoadTime.CompileTime", time_stats.pnacl_compile_time / NACL_MICROS_PER_MILLI); - HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", + HistogramKBPerSec(plugin_->uma_interface(), + "NaCl.Perf.PNaClLoadTime.CompileKBPerSec", pexe_size_ / 1024.0, time_stats.pnacl_compile_time / 1000000.0); - HistogramTime("NaCl.Perf.PNaClLoadTime.LoadLinker", + HistogramTime(plugin_->uma_interface(), "NaCl.Perf.PNaClLoadTime.LoadLinker", time_stats.pnacl_ld_load_time / NACL_MICROS_PER_MILLI); - HistogramTime("NaCl.Perf.PNaClLoadTime.LinkTime", + HistogramTime(plugin_->uma_interface(), "NaCl.Perf.PNaClLoadTime.LinkTime", time_stats.pnacl_link_time / NACL_MICROS_PER_MILLI); - HistogramSizeKB("NaCl.Perf.Size.Pexe", + HistogramSizeKB(plugin_->uma_interface(), "NaCl.Perf.Size.Pexe", static_cast<int64_t>(pexe_size_ / 1024)); struct nacl_abi_stat stbuf; @@ -371,15 +344,19 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) { PLUGIN_PRINTF(("PnaclCoordinator::TranslateFinished can't stat nexe.\n")); } else { size_t nexe_size = stbuf.nacl_abi_st_size; - HistogramSizeKB("NaCl.Perf.Size.PNaClTranslatedNexe", + HistogramSizeKB(plugin_->uma_interface(), + "NaCl.Perf.Size.PNaClTranslatedNexe", static_cast<int64_t>(nexe_size / 1024)); - HistogramRatio("NaCl.Perf.Size.PexeNexeSizePct", pexe_size_, nexe_size); + HistogramRatio(plugin_->uma_interface(), + "NaCl.Perf.Size.PexeNexeSizePct", pexe_size_, nexe_size); } int64_t total_time = NaClGetTimeOfDayMicroseconds() - pnacl_init_time_; - HistogramTime("NaCl.Perf.PNaClLoadTime.TotalUncachedTime", + HistogramTime(plugin_->uma_interface(), + "NaCl.Perf.PNaClLoadTime.TotalUncachedTime", total_time / NACL_MICROS_PER_MILLI); - HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", + HistogramKBPerSec(plugin_->uma_interface(), + "NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", pexe_size_ / 1024.0, total_time / 1000000.0); @@ -542,7 +519,7 @@ void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { "PnaclCoordinator: Got bad temp file handle from GetNexeFd")); return; } - HistogramEnumerateTranslationCache(is_cache_hit_); + HistogramEnumerateTranslationCache(plugin_->uma_interface(), is_cache_hit_); if (is_cache_hit_ == PP_TRUE) { // Cache hit -- no need to stream the rest of the file. @@ -592,7 +569,8 @@ void PnaclCoordinator::BitcodeStreamDidFinish(int32_t pp_error) { translate_thread_->AbortSubprocesses(); } else { // Compare download completion pct (100% now), to compile completion pct. - HistogramRatio("NaCl.Perf.PNaClLoadTime.PctCompiledWhenFullyDownloaded", + HistogramRatio(plugin_->uma_interface(), + "NaCl.Perf.PNaClLoadTime.PctCompiledWhenFullyDownloaded", pexe_bytes_compiled_, pexe_size_); } } diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index ecc08a4..fdb9434 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -233,7 +233,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Testing_Private_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1; @@ -3762,24 +3762,24 @@ static void Pnacl_M23_PPB_UDPSocket_Private_Close(PP_Resource udp_socket) { /* End wrapper methods for PPB_UDPSocket_Private_0_4 */ -/* Begin wrapper methods for PPB_UMA_Private_0_1 */ +/* Begin wrapper methods for PPB_UMA_Private_0_2 */ -static void Pnacl_M18_PPB_UMA_Private_HistogramCustomTimes(struct PP_Var* name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count) { - const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface; - iface->HistogramCustomTimes(*name, sample, min, max, bucket_count); +static void Pnacl_M33_PPB_UMA_Private_HistogramCustomTimes(PP_Instance instance, struct PP_Var* name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count) { + const struct PPB_UMA_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_2.real_iface; + iface->HistogramCustomTimes(instance, *name, sample, min, max, bucket_count); } -static void Pnacl_M18_PPB_UMA_Private_HistogramCustomCounts(struct PP_Var* name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count) { - const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface; - iface->HistogramCustomCounts(*name, sample, min, max, bucket_count); +static void Pnacl_M33_PPB_UMA_Private_HistogramCustomCounts(PP_Instance instance, struct PP_Var* name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count) { + const struct PPB_UMA_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_2.real_iface; + iface->HistogramCustomCounts(instance, *name, sample, min, max, bucket_count); } -static void Pnacl_M18_PPB_UMA_Private_HistogramEnumeration(struct PP_Var* name, int32_t sample, int32_t boundary_value) { - const struct PPB_UMA_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_1.real_iface; - iface->HistogramEnumeration(*name, sample, boundary_value); +static void Pnacl_M33_PPB_UMA_Private_HistogramEnumeration(PP_Instance instance, struct PP_Var* name, int32_t sample, int32_t boundary_value) { + const struct PPB_UMA_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_UMA_Private_0_2.real_iface; + iface->HistogramEnumeration(instance, *name, sample, boundary_value); } -/* End wrapper methods for PPB_UMA_Private_0_1 */ +/* End wrapper methods for PPB_UMA_Private_0_2 */ /* Begin wrapper methods for PPB_VideoDestination_Private_0_1 */ @@ -5138,10 +5138,10 @@ static struct PPB_UDPSocket_Private_0_4 Pnacl_Wrappers_PPB_UDPSocket_Private_0_4 .Close = (void (*)(PP_Resource udp_socket))&Pnacl_M23_PPB_UDPSocket_Private_Close }; -static struct PPB_UMA_Private_0_1 Pnacl_Wrappers_PPB_UMA_Private_0_1 = { - .HistogramCustomTimes = (void (*)(struct PP_Var name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count))&Pnacl_M18_PPB_UMA_Private_HistogramCustomTimes, - .HistogramCustomCounts = (void (*)(struct PP_Var name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count))&Pnacl_M18_PPB_UMA_Private_HistogramCustomCounts, - .HistogramEnumeration = (void (*)(struct PP_Var name, int32_t sample, int32_t boundary_value))&Pnacl_M18_PPB_UMA_Private_HistogramEnumeration +static struct PPB_UMA_Private_0_2 Pnacl_Wrappers_PPB_UMA_Private_0_2 = { + .HistogramCustomTimes = (void (*)(PP_Instance instance, struct PP_Var name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count))&Pnacl_M33_PPB_UMA_Private_HistogramCustomTimes, + .HistogramCustomCounts = (void (*)(PP_Instance instance, struct PP_Var name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count))&Pnacl_M33_PPB_UMA_Private_HistogramCustomCounts, + .HistogramEnumeration = (void (*)(PP_Instance instance, struct PP_Var name, int32_t sample, int32_t boundary_value))&Pnacl_M33_PPB_UMA_Private_HistogramEnumeration }; static struct PPB_VideoDestination_Private_0_1 Pnacl_Wrappers_PPB_VideoDestination_Private_0_1 = { @@ -5795,9 +5795,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1 = { - .iface_macro = PPB_UMA_PRIVATE_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UMA_Private_0_1, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_2 = { + .iface_macro = PPB_UMA_PRIVATE_INTERFACE_0_2, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_UMA_Private_0_2, .real_iface = NULL }; @@ -5936,7 +5936,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4, - &Pnacl_WrapperInfo_PPB_UMA_Private_0_1, + &Pnacl_WrapperInfo_PPB_UMA_Private_0_2, &Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1, &Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1, &Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1, |