Commit Graph

163 Commits

Author SHA1 Message Date
Ben Chan 37595f893f Update to build against libchrome-293518.
libchrome is updated from revision 271506 to 293518. This CL updates
platform2 code to build against libchrome-293518 with the following
changes:

- LOG_ERROR_REPORT is removed
  (https://codereview.chromium.org/331143007)

- StringToLowerASCII is moved to base namespace
  (https://codereview.chromium.org/448853002)

BUG=chromium:411001
CQ-DEPEND=CL:216584
CQ-DEPEND=CL:216585
CQ-DEPEND=CL:216586
CQ-DEPEND=CL:216511
CQ-DEPEND=CL:217084
CQ-DEPEND=CL:217085
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I9fbdad30b3a7c79c1ec4e208664b8befea31a3ec
Reviewed-on: https://chromium-review.googlesource.com/216589
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-09-09 21:00:00 +00:00
Bertrand SIMONNET 43bee50572 metrics: Document uploader functionality
Metrics uploader can be activated with the metrics_uploader use flag, update
README to reflect that.
Also fix the section about activating metrics.

BUG=None
TEST=None

Change-Id: I2c6d0abe6536eb419c5b49f149b6d3f097670325
Reviewed-on: https://chromium-review.googlesource.com/216631
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-09-09 13:49:40 +00:00
Bertrand SIMONNET 4bcffd3d70 metrics: add bsimonnet to OWNERS
BUG=None
TEST=None

Change-Id: I9e89ac959c352560a29e46fa3ea56a91a65c8941
Reviewed-on: https://chromium-review.googlesource.com/216583
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-09-09 13:49:36 +00:00
Alex Vakulenko ec991df012 metrics: Switch uploader to use http_utils from libchromeos
Removed explicit dependency on libcurl from metrics and using
chromeos::http::PostText() function instead.

BUG=chromium:411076
TEST=FEATURES=test emerge-link metrics

Change-Id: Ida883fa18d266e9bb87c3a4271e57d44c9308c79
Reviewed-on: https://chromium-review.googlesource.com/216526
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-09-09 13:49:28 +00:00
Ben Chan 652d6971b1 metrics: Include base/macros.h instead of base/basictypes.h
metrics no longer uses the integer types from base/basictypes.h. It
should simply include base/macros.h for the DISALLOW_COPY_AND_ASSIGN
macro instead.

BUG=None
TEST=`FEATURES=test emerge-$BOARD metrics platform2`

Change-Id: Id325bcb6c9d3318b5b78e42a04da9c53d0a8c3ce
Reviewed-on: https://chromium-review.googlesource.com/216349
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-09-04 15:46:34 +00:00
Yunlian Jiang e2c2d8947b metrics: fix memory leaks in unittest.
This fixes the memory leaks exposed in unittest.

BUG=chromium:408309
TEST=USE="clang asan" FEATURES="test" emerge-amd64-generic metrics
   passes.

Change-Id: I6f612499d7e67fa9171b95de4dbfac4e7f6698a0
Reviewed-on: https://chromium-review.googlesource.com/215887
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
2014-09-03 19:31:45 +00:00
Bertrand SIMONNET ef3aebe6a7 metrics: Activate the uploader for embedded boards
Now that the code is under tests, add an extra flag to metrics_daemon.conf to
enable the uploader when chrome is not available.

BUG=chromium:389222
TEST=build and deploy metrics on gizmo. metrics_daemon is running and the
metrics are reported.

CQ-DEPEND=CL:214286

Change-Id: I5daa72a95c3bf1c15387a40c6964be44bc6da082
Reviewed-on: https://chromium-review.googlesource.com/214285
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-09-01 13:49:39 +00:00
Alex Vakulenko 14595032aa platform2: Replace NULL with nullptr in minor components
Replace NULL with nullptr in C++11-enabled components of platform2
that don't have too many occurrences of NULL. Other major
"offenders" will be handled separately.

BUG=None
TEST=FEATURES=test emerge-link app-shell-launcher buffet easy-unlock platform2 metrics wimax_manager

Change-Id: I61b25a057e3d6865908bc74f9f3d4cb55e08af26
Reviewed-on: https://chromium-review.googlesource.com/214837
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-08-29 21:58:46 +00:00
Yunlian Jiang b1640eee93 metrics: fix memory leaks in unittest.
This fixes the memory leaks exposed in unittest.

BUG=chromium:408309
TEST=The memory leak related to |sender_| is gone.

Change-Id: I92970d0560f6ccd1ccd7f5022ece8cc5eba4a674
Reviewed-on: https://chromium-review.googlesource.com/214578
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
2014-08-29 21:55:22 +00:00
Thiemo Nagel 0b8cc1c952 metrics: Improve metrics_client usage docs.
BUG=chromium:393334
TEST=unit tests passed

Change-Id: Iaf6b75cba2fddce5ea5f770d227ed5df70c9bed8
Reviewed-on: https://chromium-review.googlesource.com/213471
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Thiemo Nagel <tnagel@chromium.org>
Tested-by: Thiemo Nagel <tnagel@chromium.org>
2014-08-22 00:53:54 +00:00
Ben Chan 8c56c5ed5f platform2: Remove legacy inherit-review-settings-ok files.
BUG=None
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I11a13e64cd1fd9e3394d1f298425d29204bb06aa
Reviewed-on: https://chromium-review.googlesource.com/212840
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-08-18 03:06:06 +00:00
Alex Vakulenko e8a8e30b25 metrics: Replace 'OVERRIDE' with 'override' and fix linter
Replace OVERRIDE macro with native C++ 'override' keyword.
Also fixed the style issue of using both 'override' and 'virtual'
on member function overrides. Only one is required and cpplint
complains if both are specified now.

And since gobi-chromo-plugin is the only project that uses
libmetrics and is not C++11 yet, enabled C++11 features
in its makefile to allow for the 'override' keywords to
compile in the included metrics/metrics_library.h header.

BUG=None
TEST=USE="cellular buffet" ./build_packages

Change-Id: I28dace6dc4bcb07386632eaed890ce41564e8144
Reviewed-on: https://chromium-review.googlesource.com/212494
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
2014-08-16 05:26:56 +00:00
Ben Chan f05ab40ab9 metrics: Use integer types from stdint.h
This CL replaces the deprecated int* and uint* types from
'base/basictypes.h' with the int*_t and uint*_t types from 'stdint.h'.

BUG=chromium:401356
TEST=`FEATURES=test emerge-$BOARD metrics`

Change-Id: Ie5a69edba2c8a9d5185bbc548ed70a5b121c3e3b
Reviewed-on: https://chromium-review.googlesource.com/211381
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-08-07 14:25:23 +00:00
Alex Vakulenko 4e59634509 metrics: fix remaining linter issues
Fixed various issues reported by cpplint.py when run on
src/platform2/metrics.

BUG=None
TEST=cpplint.py `find metrics/* | grep "\.cc\|\.h"`
     FEATURES=test emerge-link metrics

Change-Id: I589be238c97c38f985f24ffe26d2cdf259c96760
Reviewed-on: https://chromium-review.googlesource.com/210505
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-08-01 04:19:03 +00:00
Bertrand SIMONNET e6cfd64e6a metrics: fix lint warnings
This CL solve the cros lint warnings.
This is mostly due to:
* header guards
* include path
* few google style guide warnings

BUG=chromium:389229
TEST=FEATURES=test emerge-amd64-generic metrics

Change-Id: Ibbfcd2c88926bcc0c1ce9275b4ad0fb0748cd4de
Reviewed-on: https://chromium-review.googlesource.com/207248
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2014-07-11 05:02:00 +00:00
Bertrand SIMONNET 5984b2116c metrics: remove unused constant
A constant was left during the refactoring
(https://chromium-review.googlesource.com/#/c/207237/) and it is failing the
generic ASAN buildbot.

BUG=chromium:374368
TEST=FEATURES=test emerge-amd64-generic metrics

Change-Id: Ief9f2a064dbeded87e2e5fc67d3659fedac88867
Reviewed-on: https://chromium-review.googlesource.com/207460
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-07-11 04:58:23 +00:00
Bertrand SIMONNET d83ca801ad metrics: Use the new serialization mechanism in libmetrics
Convert libmetrics to the new serialization mechanism living in
//components/metrics in the chrome repo.

BUG=chromium:374368
TEST=FEATURES=test emerge-amd64-generic metrics

Change-Id: Ia8cf128d04fedd9672fb47096dc6fd87d6a9043d
Reviewed-on: https://chromium-review.googlesource.com/207237
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-07-10 21:22:14 +00:00
Bertrand SIMONNET 346c43baf2 metrics: fix unittest
This fixes a compilation bug that was not caught because of crbug.com/392504.

BUG=chromium:392504
TEST=FEATURES=test emerge-amd64-generic metrics

Change-Id: Id71a8945d1ec80c7e5d7f2d8de5d287321b47de7
Reviewed-on: https://chromium-review.googlesource.com/207131
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-07-09 20:30:03 +00:00
Bertrand SIMONNET 46b49da5ad Add an uploader to metrics_daemon
Metrics_daemon will now upload the metrics to Chrome's backend when Chrome is
not available.
This uses //components/metrics from chrome to use its protobuf definition and
the metrics common code.

This functionality is not yet enabled. It will be once the end-to-end test is
enabled.

BUG=chromium:358283, chromium:364579
TEST=FEATURES=test emerge-amd64-generic metrics

CQ-DEPEND=CL:205790
CQ-DEPEND=CL:206055

Change-Id: I87aaf7a2ac041581fa3ffd4ec61f73e933c00a52
Reviewed-on: https://chromium-review.googlesource.com/205810
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-07-08 04:28:11 +00:00
Luigi Semenzato 4a6c942d1d metrics_daemon: fix parsing of zram sysfs
The only real change is in ReadFileToUint64.  The other changes
appease the updated pre-commit checks.

BUG=chromium:390334
TEST=ran manually, checked syslog, checked chrome://histograms

Change-Id: I5ca10aab03697aa8fd64c5dd51ca64911e8d2a76
Reviewed-on: https://chromium-review.googlesource.com/206285
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-07-02 22:11:43 +00:00
Mike Frysinger 6a26a0d4c6 clean up licenses/urls after merge
We have a common LICENSE file for this repo, so use that.

Update the URLs to use the new git paths.

BUG=None
TEST=build_packages passes for many boards
CQ-DEPEND=CL:205370

Change-Id: Ia60071ad2bec9a90b913a4057a617c6916533df6
Reviewed-on: https://chromium-review.googlesource.com/204953
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-06-25 01:32:41 +00:00
Bertrand SIMONNET 0d4b551b54 metrics: Create a standalone ebuild for system_api
system_api is required by a lot of platform2 packages. We need it to be in a
standalone ebuild in order for other packages to depend on it.

This package installs the common headers and compiles the protobufs into static
libraries.

BUG=chromium:386223
TEST=FEATURES=test emerge-amd64-generic platform2.
TEST=trybot run on daisy, link, duck, x86-mario.
TEST=trybot run on lumpy-incremental-release.

CQ-DEPEND=CL:204594

Change-Id: If0b601576593855cbc21a6358977d6e313cf696e
Reviewed-on: https://chromium-review.googlesource.com/204582
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-06-21 02:23:13 +00:00
Bertrand SIMONNET 4764f52d9c metrics: Migrate libchromeos to its own ebuild
All platform2 packages should have their own ebuild that will be compiled
independently. Packages should DEPEND on libchromeos and should not have a gyp
dependency on libchromeos's gyp file anymore.

BUG=chromium:381372
TEST=emerge-daisy libchromeos && emerge-daisy platform2 work
TEST=trybot run on daisy, link, mario and duck.
TEST=trybot run on lumpy-incremental-paladin.

CQ-DEPEND=CL:202748

Change-Id: I0fe0732d47463e880b11d3d547e99dba0ac83ace
Reviewed-on: https://chromium-review.googlesource.com/202771
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-06-18 11:00:49 +00:00
Luigi Semenzato 9636019892 metrics_daemon: add zram stats collection
Memory compression stats are being collected by Chrome, but it
is more natural to do it here since they are system-wide rather than
Chrome-specific.

In addition, this provides better granularity for the compression ratio
(percents, from 100% to 600%) since we're especially interested in the
distribution of values between 1 and 2, and currently these all fall
in the same bucket.

Finally, we collect more interesting stats on zero pages.

BUG=chromium:315113
TEST=unit testing, checked about:histograms

Change-Id: I09c974989661d42f45d44afd428e8114e4ee1dbd
Reviewed-on: https://chromium-review.googlesource.com/202587
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-06-07 01:33:36 +00:00
Bertrand SIMONNET a756f7e66f metrics: Update gyp files to use libchromeos from src/platform2
libchromeos was moved from src/platform to src/platform2. This CL updates
the gyp files to use the new location.

BUG=chromium:370258
TEST=FEATURES=test emerge-amd64-generic platform2
TEST=trybot run on daisy, link, mario and duck

CQ-DEPEND=CL:202334

Change-Id: I939dd5672120d47e8dc388f75b3dfeeb234c47b7
Reviewed-on: https://chromium-review.googlesource.com/202398
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-06-03 04:25:06 +00:00
Bertrand SIMONNET 38f6bfa90b metrics: Update gyp file to use src/platform2/common-mk
We are moving the packages built by platform2's ebuild into src/platform2.
We need packages to use src/platform2/common-mk instead of
src/platform/common-mk.

BUG=chromium:378554
TEST=emerge-daisy platform2
TEST=trybot run on daisy, link, mario and duck

CQ-DEPEND=CL:201938

Change-Id: Ibe02d33d7d17a830f0d72cdb2597b8e97b1864da
Reviewed-on: https://chromium-review.googlesource.com/201982
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-05-31 01:46:36 +00:00
Luigi Semenzato a5db220722 metrics daemon: create /var/run/metrics/uma-events earlier
The uma-events file needs to be created earlier, for all users of the
metrics library.  This also avoids permission issues with writing
to /var/run/metrics.

BUG=chromium:376891
TEST=manual
CQ-DEPEND=CL:201416

Change-Id: I3a48a3779edb24f3bd08a91fbee4e8fe5a25ec49
Reviewed-on: https://chromium-review.googlesource.com/201347
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-05-28 10:33:26 +00:00
Ben Chan 52178b4871 libmetrics: remove version 242728
BUG=chromium:375032
TEST=Trybot runs on paladin, release and chromiumos-sdk builders.

Change-Id: I661a5646c37f43e92c6666790b11a4cc8451ee05
Reviewed-on: https://chromium-review.googlesource.com/201004
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-05-23 04:55:28 +00:00
Ben Chan 8c3cd41620 metrics: Update to build against libchrome-271506
BUG=chromium:375032
TEST=`FEATURES=test emerge-$BOARD platform2`
TEST=Trybot runs on paladin, release, and chromiumos-sdk builders.

Change-Id: Icb524d3fd4001ebc36edc84306ea70db70f7599b
Reviewed-on: https://chromium-review.googlesource.com/200519
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-05-21 20:30:05 +00:00
Ben Chan 65dd4c61b8 libmetrics: Add support for building against libchrome-271506
BUG=chromium:375032
CQ-DEPEND=CL:200532
CQ-DEPEND=CL:200522
TEST=`FEATURES=test emerge-$BOARD platform2`
TEST=Trybot runs on paladin, release, and chromiumos-sdk builders.

Change-Id: Ie3e9cc522099a8225f54a4442d0215d580425846
Reviewed-on: https://chromium-review.googlesource.com/200518
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-05-21 20:29:50 +00:00
Luigi Semenzato 31cda9806e metrics library: complete switchover from /var/log to /var/run
This removes the double metrics even file use to facilitate
the transition.  The corresponding change has been in Chromium
for 2 days now.

BUG=chromium:373833
TEST=manually verified

Change-Id: I36ff355e6519b3894c0a4579758ae87bdac6b148
Reviewed-on: https://chromium-review.googlesource.com/200426
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-05-19 23:06:27 +00:00
Luigi Semenzato 960e0e12c0 metrics library: move event file location from /var/log to /var/run
The event file, which is used for communicating metric events
from chrome os to chrome, has been living in the very non-kosher
location /var/log/metrics/uma-events.  This change duplicates it
in /var/run/metrics/uma-events.  A later chrome change will pick
up the metrics from there.

I also opened crbug.com/373833 to remove the duplication once
Chrome has switched over.

BUG=chromium:361331
TEST=tested with unit tests and manually

Change-Id: I98b741798aa0481b7987f93f087239ad214b759f
Reviewed-on: https://chromium-review.googlesource.com/200091
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-05-16 04:18:02 +00:00
Luigi Semenzato 41c5450523 metrics library: convert to proper C++/libbase
This mostly converts fprintfs to proper logs, char* to
std::string wherever appropriate.

BUG=chromium:355796
TEST=unit tests

Change-Id: Ieb1cb110be5e281b7e0c764a0dfce895f33d4a3c
Reviewed-on: https://chromium-review.googlesource.com/199610
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-05-15 19:06:02 +00:00
Mike Frysinger 3e8a851625 use IGNORE_EINTR w/close
HANDLE_EINTR is both not safe and not useful on Linux systems.
Switch to IGNORE_EINTR like Chromium has done everywhere.

See http://crbug.com/269623 for details.

BUG=chromium:373154
TEST=`cbuildbot {arm,amd64,x86}-generic-full` passes

Change-Id: I3d99bb2376cb7961ac31ba0fa82bafc1b4c14bd9
Reviewed-on: https://chromium-review.googlesource.com/199821
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-05-15 07:41:00 +00:00
Luigi Semenzato e5883fadd9 metrics_daemon: restore correct meaning of Logging.DailyUse.
Maintain separate persistent values for DailyActiveUse and
CumulativeActiveUse.  The latter is used to compute crash rates
relative to active use.

BUG=chromium:364746
TEST=manual

Change-Id: I4d0485016eb49b30a77169ba1cedc1ffbff8810e
Reviewed-on: https://chromium-review.googlesource.com/195698
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-05-13 00:08:39 +00:00
Luigi Semenzato 254d22e5fd metrics_daemon: log to syslog
Also log to stderr when not running as daemon.

BUG=chromium:364700
TEST=manually verified in both daemon and non-daemon modes

Change-Id: If62f70c1d327a5ecaf3075b6689b83a1494c09d5
Reviewed-on: https://chromium-review.googlesource.com/199380
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-05-13 00:08:13 +00:00
Ben Chan d884a2e478 libmetrics: add pkg-config file
BUG=chromium:366984
TEST=`FEATURES=test emerge-$BOARD platform2` and verify libmetrics-242728.pc is created.

Change-Id: I3cd79e7421a5f666a4bf2551c87086f779078771
Reviewed-on: https://chromium-review.googlesource.com/196974
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-04-26 00:59:09 +00:00
Ben Chan 0d97a47418 libmetrics: remove version 180609
BUG=chromium:361748
CQ-DEPEND=CL:195565
CQ-DEPEND=CL:195570
CQ-DEPEND=CL:195548
TEST=Trybot runs on paladin, release and chromiumos-sdk builders.

Change-Id: I09fdbdad6752ced19bc0dc6cfecdc67f1867c2cf
Reviewed-on: https://chromium-review.googlesource.com/195580
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-04-19 03:35:46 +00:00
Wu-Cheng Li cc43be17cc Remove unused variable in metrics_daemon_test.cc.
x86-generic ASAN builder unittest failed at
metrics_daemon_test.cc:33:18: error: unused variable 'kSecondsPerDay'.
Hopefully this can fix the failure.

BUG=chromium:364818
TEST=NONE

Change-Id: Icb63ed50a285e5f9a522d9dc2a7ab98f4affbf74
Reviewed-on: https://chromium-review.googlesource.com/195557
Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
Commit-Queue: Wu-Cheng Li <wuchengli@chromium.org>
Tested-by: Wu-Cheng Li <wuchengli@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
2014-04-18 14:22:26 +00:00
Daniel Erat c83975ab1e metrics: Clean up user-active code.
Stop listening for the soon-to-deleted PowerStateChanged
D-Bus signal from powerd; the code that was listening for
it had some issues (there was no guarantee that it'd run
before the system suspended, and resumes weren't handled at
all).

Also remove the session-state- and screen-lock-handling
code; it provided an inaccurate view of user activity (what
if the user is listening to music with the screen locked or
if they don't have screen-locking enabled?).

Track uptime instead via a timer that fires every five
minutes.

BUG=chromium:359619
TEST=manual: ran metrics_daemon --nodaemon and watched the
     logs

Change-Id: I4ad74773daefa01afdea080d20001ff1944c2eee
Reviewed-on: https://chromium-review.googlesource.com/195491
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
2014-04-18 09:23:59 +00:00
Luigi Semenzato e5c7eb1d13 metrics_daemon: store persistent counters in /var/lib, not /var/log.
BUG=chromium:356781
TEST=manual

Change-Id: I7d36876347bdbbe329e24adf3345c2ade97be5fe
Reviewed-on: https://chromium-review.googlesource.com/195310
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-04-18 03:08:11 +00:00
Luigi Semenzato 5ef2e39119 metrics_daemon: report cumulative daily use.
This had been lost in the previous changes.  Also, the meaning
of DailyUse changes: it is now cumulative daily use.  But we should
revise these stats so I think it's OK for now.

BUG=chromium:339588
TEST=unit tests

Change-Id: I4894fef0ffb237633abcf949c01dd7ea5f5e5d6e
Reviewed-on: https://chromium-review.googlesource.com/195005
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-04-16 17:14:51 +00:00
Luigi Semenzato a5f4fe6b98 metrics_daemon: fix harmless confusion in writing persistent integers
As the subject says, I don't think this can change any of the
behavior, but the argument to Write() was ignored and merely
confusing.

BUG=chromium:339588
TEST=ran unit tests

Change-Id: Ie6d59e6879a734523978c21d66170721e0f499c7
Reviewed-on: https://chromium-review.googlesource.com/194919
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-04-16 17:14:47 +00:00
Luigi Semenzato d8abf55c1b metrics client: add basic sanity check for numeric arguments
"atoi" and "atod" don't do any conversions or error checks, they
just return 0 on error.  They should be illegal.

BUG=chromium:356932
TEST=checked various valid and invalid inputs

Change-Id: I53a92ccab5f44e18e8ac27154c2b2826d355a6c0
Reviewed-on: https://chromium-review.googlesource.com/191971
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-04-10 01:18:29 +00:00
Luigi Semenzato 4f05c0e9ee Add OWNERS for metrics.
It looks like all the other people who made significant contributions
to this project have left the team.

BUG=none
TEST=none

Change-Id: Ie572a43e85cee565c71c4101d1474e77e51449e5
Reviewed-on: https://chromium-review.googlesource.com/192008
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-04-03 21:06:44 +00:00
Luigi Semenzato 6c320063ef metrics: add PersistentInteger unit test.
BUG=chromium:339588
TEST=P2_TEST_FILTER="metrics::*" FEATURES=test emerge-panther -v platform2
BRANCH=none

Change-Id: I78bdd8eed2da69ae6284d0f7770918d1be9f0e9f
Reviewed-on: https://chromium-review.googlesource.com/190121
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-03-25 00:32:15 +00:00
Luigi Semenzato ba0c65d098 metrics: add per-version daily stats reporting
Adds a few kernel crash stats which are reported daily but
are accumulated from beginning to end of a Chrome OS version.

BUG=chromium:339588
TEST=ran and checked histograms on device
BRANCH=none

Change-Id: I630c673156c28dc90ffe0c9c2df58caaada082dc
Reviewed-on: https://chromium-review.googlesource.com/190404
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-03-22 13:29:45 +00:00
Yunlian Jiang 49fb1adc5a metrics: use abs() for integer only.
This cast the type of the paramenter of abs() to integer before
calling the abs() function.

BUG=chromium:352331
TEST=FEATURES="test" emerge-amd64-generic platform2 passes.

Change-Id: Id8b994b743345456f14194b45f3a288b7e3b74f3
Reviewed-on: https://chromium-review.googlesource.com/189849
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
2014-03-18 19:09:11 +00:00
Luigi Semenzato 2fd51cc42d metrics: refactor counters
The metrics daemon had counter classes that represented
persistent, tagged values, and UMA stats.  To create some
derived UMA stats we need to separate persistency and UMA stats,
and the tagging doesn't help either.

This rewrite is supposed to keep the same functionality.

BUG=chromium:339588
TEST=ran and checked a few histograms
BRANCH=none

Change-Id: Ia1121ab2db391d71edffab9f52afe29ce17686ba
Reviewed-on: https://chromium-review.googlesource.com/188082
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-03-14 19:42:50 +00:00
Daniel Erat fd158294da metrics: Make implicit MetricsLibrary d'tor explicit.
Also add 'virtual' and 'OVERRIDE' to overridden methods.

BUG=none
TEST=did a build

Change-Id: Iec71c59853b6ada38b20cea9d0605c3d39e9353f
Reviewed-on: https://chromium-review.googlesource.com/189398
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
2014-03-10 07:47:27 +00:00