Commit 9ec7446c authored by mmortensen@google.com's avatar mmortensen@google.com

Add histogram to track number of .nexe launches, normalized against opening new tabs.

BUG=914 (http://code.google.com/p/nativeclient/issues/detail?id=914)
TEST=none
  Relied on trybots and manually checking "about:histograms"

Review URL: http://codereview.chromium.org/4065005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64261 0039d316-1c4b-4281-b951-d872f2087c98
parent 6d74fd27
......@@ -148,6 +148,8 @@
'message_pump_win.h',
'metrics/histogram.cc',
'metrics/histogram.h',
'metrics/nacl_histogram.cc',
'metrics/nacl_histogram.h',
'metrics/stats_counters.cc',
'metrics/stats_counters.h',
'metrics/stats_table.cc',
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// nacl_histogram provides an enum and defines a macro that uses definitions
// from histogram.h. Note that a histogram is an object that aggregates
// statistics, and can summarize them in various forms, including ASCII
// graphical, HTML, and numerically.
// nacl_histogram information is used to compare how many times a native
// client module has been loaded, compared to the number of chrome starts
// and number of new tabs created.
#include "base/metrics/histogram.h"
#include "base/metrics/nacl_histogram.h"
// To log histogram data about NaCl.Startups, call this function with
// a NaClHistogramValue passed in as |hvalue|
void UmaNaclHistogramEnumeration(NaClHistogramValue histogram_value) {
UMA_HISTOGRAM_ENUMERATION("NaCl.Startups", histogram_value,
NACL_MAX_HISTOGRAM);
}
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// nacl_histogram provides an enum and defines a macro that uses definitions
// from histogram.h. Note that a histogram is an object that aggregates
// statistics, and can summarize them in various forms, including ASCII
// graphical, HTML, and numerically.
// nacl_histogram information is used to compare how many times a native
// client module has been loaded, compared to the number of chrome starts
// and number of new tabs created.
#ifndef BASE_METRICS_NACL_HISTOGRAM_H_
#define BASE_METRICS_NACL_HISTOGRAM_H_
#pragma once
enum NaClHistogramValue {
FIRST_TAB_NACL_BASELINE, // First tab created - a baseline for NaCl starts.
NEW_TAB_NACL_BASELINE, // New tab created -- a baseline for NaCl starts.
NACL_STARTED, // NaCl process started
NACL_MAX_HISTOGRAM // DO NOT USE -- used by histogram for max bound.
};
// To log histogram data about NaCl.Startups, call this macro with
// a NaClHistogramValue passed in as |histogram_value|
void UmaNaclHistogramEnumeration(NaClHistogramValue histogram_value);
#endif // BASE_METRICS_NACL_HISTOGRAM_H_
......@@ -11,6 +11,7 @@
#endif
#include "base/command_line.h"
#include "base/metrics/nacl_histogram.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/chrome_switches.h"
......@@ -114,7 +115,7 @@ bool NaClProcessHost::Launch(ResourceMessageFilter* resource_message_filter,
if (!LaunchSelLdr()) {
return false;
}
UmaNaclHistogramEnumeration(NACL_STARTED);
resource_message_filter_ = resource_message_filter;
reply_msg_ = reply_msg;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/metrics/nacl_histogram.h"
#include "chrome/browser/tabs/default_tab_handler.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/tabs/tab_strip_model.h"
......@@ -14,6 +14,7 @@ DefaultTabHandler::DefaultTabHandler(TabHandlerDelegate* delegate)
: delegate_(delegate),
ALLOW_THIS_IN_INITIALIZER_LIST(
model_(new TabStripModel(this, delegate->GetProfile()))) {
UmaNaclHistogramEnumeration(FIRST_TAB_NACL_BASELINE);
model_->AddObserver(this);
}
......@@ -34,6 +35,7 @@ TabStripModel* DefaultTabHandler::GetTabStripModel() const {
// DefaultTabHandler, TabStripModelDelegate implementation:
TabContents* DefaultTabHandler::AddBlankTab(bool foreground) {
UmaNaclHistogramEnumeration(NEW_TAB_NACL_BASELINE);
return delegate_->AsBrowser()->AddBlankTab(foreground);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment