Home | History | Annotate | Download | only in performance_monitor
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_CONSTANTS_H_
      6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_CONSTANTS_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/time/time.h"
     10 
     11 namespace performance_monitor {
     12 
     13 // Constants which are used by the PerformanceMonitor and its related classes.
     14 // The constants should be documented alongside the definition of their values
     15 // in the .cc file.
     16 
     17 extern const char kMetricNotFoundError[];
     18 extern const char kProcessChromeAggregate[];
     19 
     20 // State tokens
     21 extern const char kStateChromeVersion[];
     22 extern const char kStateProfilePrefix[];
     23 
     24 // The interval the watched processes are sampled for performance metrics.
     25 const int kSampleIntervalInSeconds = 10;
     26 // The default interval at which PerformanceMonitor performs its timed
     27 // collections; this can be overridden by using the kPerformanceMonitorGathering
     28 // switch with an associated (positive integer) value.
     29 const int kDefaultGatherIntervalInSeconds = 120;
     30 
     31 // Unit values (for use in metric, and on the UI side).
     32 
     33 // Memory measurements
     34 const int64 kBytesPerKilobyte = 1 << 10;
     35 const int64 kBytesPerMegabyte = kBytesPerKilobyte * (1 << 10);
     36 const int64 kBytesPerGigabyte = kBytesPerMegabyte * (1 << 10);
     37 const int64 kBytesPerTerabyte = kBytesPerGigabyte * (1 << 10);
     38 
     39 // Time measurements - Most of these are imported from base/time/time.h
     40 // These units are used for display (and it's related calculations), not for
     41 // any mathematical analysis. Thus we can estimate for values without an exact
     42 // conversion.
     43 const int64 kMicrosecondsPerMonth = base::Time::kMicrosecondsPerDay * 30;
     44 const int64 kMicrosecondsPerYear = base::Time::kMicrosecondsPerDay * 365;
     45 
     46 // Performance alert thresholds
     47 
     48 // If a process is consistently above this CPU utilization percentage over time,
     49 // we consider it as high and may take action.
     50 const float kHighCPUUtilizationThreshold = 90.0f;
     51 }  // namespace performance_monitor
     52 
     53 #endif  // CHROME_BROWSER_PERFORMANCE_MONITOR_CONSTANTS_H_
     54