Commit graph

198 commits

Author SHA1 Message Date
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
Bertrand SIMONNET
371a613294 Add init scripts for the metrics package
We are moving the init scripts out of chromeos-init
and into metrics/init.

BUG=chromium:346444
TEST=cbuildbot on x86-alex-paladin
CQ-DEPEND=CL:187455, CL:187470

Change-Id: If226addfaa154794361d3cf9687ca336b95b3104
Reviewed-on: https://chromium-review.googlesource.com/187456
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-02-27 00:49:41 +00:00
Luigi Semenzato
859b3f0ad3 metrics: add per-version cumulative counters
This adds counters that accumulate some measurement across an OS version;
they are reset at version updates, but reported more frequently (for instance,
daily).

Such counts could be obtained by pseudonymous dremel queries, but this is
more convenient.

The code replaces the "tag" datum in the counters with two tags: a
"report tag" and a "reset tag".  When the report
tag changes, the count is reported but not reset.  When the reset tag
changes, the count is both reported and reset.

This also adds one usage of the new counter which tracks the total
number of kernel crashes since the most recent OS version update.

The state machine in counter.cc changes a bit because it's no longer
true that a counter is reset after reporting it.  That logic is
still rather confusing, and could use a rewrite.

BUG=chromium:339588
TEST=ran on target under various situations
BRANCH=none

Change-Id: I5f83731e1a3d6e055b6d0f89111c9ffc60ccfcb9
Reviewed-on: https://chromium-review.googlesource.com/185081
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-02-22 03:10:10 +00:00
Luigi Semenzato
c5a92347a5 metrics daemon: change location of flag files
For security reasons, we changed the location of some flag
files to /var/run from /tmp, but we didn't update this
program to look for the files in their new location.
This corrects the problem.

BUG=chromium:200181
TEST=manually verified that kernel crash counters increase
BRANCH=none

Change-Id: I03efe6179a1ad8dfd4c8cbb1eccf24c7a8494058
Reviewed-on: https://chromium-review.googlesource.com/186692
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-02-15 04:22:12 +00:00
Ben Chan
46465a7cf2 Remove unused Makefile.
metrics is now part of platform2 and built using gyp.

BUG=chromium:342154
TEST=Trybot runs on x86-mario,lumpy,daisy paladin and release builders.

Change-Id: I69c5622399cab9d8508dc75310972ae638f0cac7
Reviewed-on: https://chromium-review.googlesource.com/186194
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2014-02-13 04:22:03 +00:00
Ben Chan
2e6543ddad Update to build against libchrome-242728.
This CL updates metrics to build against libchrome-242728 and also converts
libmetrics into slotted libraries (libmetrics-180609 and libmetrics-242728).

BUG=chromium:341521
BUG=chromium:342866
CQ-DEPEND=CL:186027
CQ-DEPEND=CL:186026
CQ-DEPEND=CL:186037
CQ-DEPEND=CL:186092
CQ-DEPEND=CL:186028
CQ-DEPEND=CL:186029
CQ-DEPEND=CL:186038
CQ-DEPEND=CL:186093
CQ-DEPEND=CL:186100
CQ-DEPEND=CL:186039
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I09dc3d47cfe24a22864abf217658c63493b35cba
Reviewed-on: https://chromium-review.googlesource.com/185187
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-02-12 19:39:45 +00:00
Darren Krahn
09a15fa954 Added a metric for tracking non-zero TPM dictionary-attack counters.
BUG=chromium:341358
TEST=manual

Change-Id: I99d3e4279c6d9185b9b515259d4fe511e0d79874
Reviewed-on: https://chromium-review.googlesource.com/185493
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
2014-02-08 04:21:15 +00:00
Mike Frysinger
754dc92466 add printf attributes to printf func
This fixes build warnings when using clang:
.../metrics/metrics_library.cc:235:30: warning: format string is not a string literal [-Wformat-nonliteral]
	format, args);
	^~~~~~

BUG=None
TEST=`FEATURES=test emerge-x86-alex platform2` works & doesn't warn
TEST=`FEATURES=test emerge-daisyplatform2` works & doesn't warn
TEST=`FEATURES=test emerge-lumpy platform2` works & doesn't warn

Change-Id: I03bfffe328eb1f1742de5b3fe722209e6e91f4bc
Reviewed-on: https://chromium-review.googlesource.com/180930
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-12-20 00:38:31 +00:00
Mike Frysinger
1c5708f69f metrics_daemon_test: drop unused vars
BUG=None
TEST=`FEATURES=test emerge-x86-alex platform2` still works

Change-Id: I86aa6a7380d226173c642880a3fc50faf3219d13
Reviewed-on: https://chromium-review.googlesource.com/180333
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-12-19 00:13:15 +00:00
Liam McLoughlin
b2c56e1ab0 Add -fvisibility=default to metrics library
BUG=chromium:315243
TEST=x86-generic-full and daisy-full trybots pass

Change-Id: Ia1f2d41ddf0e54beee0a928bc62b67edd71ac706
Reviewed-on: https://chromium-review.googlesource.com/175770
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2013-12-12 02:25:41 +00:00
Luigi Semenzato
0d9a9c961e Fix out-of-bound index and clean up code.
There was an out-of-bound index after something like 7.5 hours of
active use.  This probably caused the metrics daemon to restart
and pollute some of the memuse statistics, the very ones
responsible for the overflow.

BUG=chromium:326824
TEST=ran manually and verified memuse is still reported

Change-Id: I70709f8cbba63ea1ca5e277b2ab58729e072e127
Reviewed-on: https://chromium-review.googlesource.com/178976
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-12-06 22:44:22 +00:00
Yunlian Jiang
d399bed72c metrics: fix global-buffer-overflow
This fix the problem that the subscript of a global
array overflows in some cases.

BUG=chromium:326284
TEST=Unittest and suite:smoke passes.

Change-Id: I6a19d3bb18a886ee8a29b9a4df5f2b136ce57c5c
Reviewed-on: https://chromium-review.googlesource.com/178973
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2013-12-06 00:52:31 +00:00
Chris Masone
33a1baef7a Add passive_metrics USE flag to platform2
We want to be able to control the inclusion of the metrics_daemon,
which passively gathers power stats and the like and sends them
through the UMA pipeline iff the user has opted-in to metrics
collection.

CQ-DEPEND=CL:177244, CL:177291
BUG=None
TEST=emerge platform2 with USE='-passive_metrics' on and off, with and without FEATURES=test

Change-Id: Id6af84d3de585a156d8ebbcc23117df000de080d
Reviewed-on: https://chromium-review.googlesource.com/177217
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
2013-11-20 06:51:20 +00:00
Luigi Semenzato
e8fd968af0 Add two more charger states to Platform.CrOSEvent.
This adds SpringPowerSupply.Original.Low and SpringPowerSupply.ChargerIdle.

BUG=chrome-os-partner:23973
TEST=manual

Change-Id: I35478741e128891667bfd64c45b379c7c9b7d602
Reviewed-on: https://chromium-review.googlesource.com/176707
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-11-14 03:34:27 +00:00
Luigi Semenzato
e57398a6ee Define UMA events for interesting power adapter situations.
This adds events to the Platform.CrOSEvent histogram to record
specific situations we're interested in.  The user of the events
will be thermal.sh in the daisy overlay.

BUG=chrome-os-partner:23973
TEST=tested manually and observed samples in about:histograms

Change-Id: I1845ce1f90f5e77ecdc294834671328ce13c827b
Reviewed-on: https://chromium-review.googlesource.com/176367
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-12 01:07:05 +00:00
Darren Krahn
86830baa17 Added cros event name for attestation metric.
BUG=chromium:260504
TEST=unit

Change-Id: If1c7218a02bd6bac8193c4ac550866b06b475f2a
Reviewed-on: https://gerrit.chromium.org/gerrit/63495
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
2013-08-05 20:53:24 -07:00
Sonny Rao
4b8aebb0f4 Add additional stats for swapping from /proc/vmstat
This adds swap-in and swap-out rate calculation on the same intervals
as major page fault collection.

BUG=chromium:261965
TEST=observe Platform.SwapIn{Long,Short} and
Platform.SwapOut{Long,Short} appear in histograms

Change-Id: Ifcdba1088cdff355b8e132145ac79635b185663b
Reviewed-on: https://gerrit.chromium.org/gerrit/64162
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2013-08-01 18:15:49 -07:00
Darren Krahn
6e55c11537 Define cros event names for chaps database failures.
BUG=chrome-os-partner:17610
TEST=emerge

Change-Id: Ic12379645ad1c72388aa4a4758fa4bea5b2f554d
Reviewed-on: https://gerrit.chromium.org/gerrit/62698
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
2013-07-19 18:01:51 -07:00
Ben Chan
6f59842fb1 Remove unnecessary call to the deprecated g_thread_init().
g_thread_init() has been deprecated since glib 2.32. This CL removes the
unnecessary call to g_thread_init(), so that we can later migrate to
glib 2.34. It also replaces dbus_g_thread_init(), which calls the
deprecated g_thread_supported(), with dbus_threads_init_default()
directly.

BUG=chromium:253025
TEST=Tested the following:
1. Build and run unit tests.
2. chrome://histograms shows that CrOS metrics are being collected.

Change-Id: I9c191d1926928caa8a704db03024f48f6c1cb383
Reviewed-on: https://gerrit.chromium.org/gerrit/59683
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2013-06-24 13:08:13 -07:00
Luigi Semenzato
d92d18c935 Fix wrong sysfs pathname.
This bug was introduced while adding test code
which was supposed to improve the reliability
of this program.

BUG=chromium:238890
TEST=verified that about:histograms contains samples

Change-Id: I66323292f9261f5715760d7c884f91aca1f7e453
Reviewed-on: https://gerrit.chromium.org/gerrit/57501
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2013-06-05 09:44:27 -07:00
repo sync
0672655fa6 metrics: Creates |Pause| and |Resume| methods for timers.
BUG=chromium:244589
TEST=unittest

Change-Id: I54e6dd7f5a8eb08ff42b1ee0e60df5cc895d0819
Reviewed-on: https://gerrit.chromium.org/gerrit/56849
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
2013-06-03 14:33:31 -07:00
Yunlian Jiang
e6fcdabe73 metrics: fix clang syntax checking error.
This fixes the two errors in the clang syntax.

BUG=chromium:240325
TEST=FEATURES="test" emerge-lumpy metrics

Change-Id: I57ab09fbd3dba2b394c606a3b2ba1ad799607939
Reviewed-on: https://gerrit.chromium.org/gerrit/50999
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2013-05-13 12:46:54 -07:00
Luigi Semenzato
fb3a8211b5 Collect CPU frequency thermal throttling stats
This collects the max frequency every 30s and reports
it as a percentage of the unthrottled frequency.
The special value of 101% indicates that the CPU is
using turbo.

BUG=chromium:238890
TEST=ran manually, checked about:histograms

Change-Id: Ia1c8a2344b81b8274f9045b854d2e6d35cf49339
Reviewed-on: https://gerrit.chromium.org/gerrit/50387
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-05-10 14:55:31 -07:00
Liam McLoughlin
3ebadf8785 Add metrics GYP file
BUG=chromium:220003
TEST=Run emerge-<board> -v platform2 with and without platform2 USE
flag on a range of boards plus the host

Change-Id: I44f15c31a8ac3917f3262912c43419a93652c0d8
Reviewed-on: https://gerrit.chromium.org/gerrit/40316
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
2013-05-09 14:56:54 -07:00
Luigi Semenzato
a7ebeb3e8b Add sparse histograms to the metrics library and metrics client.
Samples to these histograms are any 32-bit int value.

BUG=chromium:222189
TEST=manual

Change-Id: Ic8d5773d05d717a275c4a4b5616e0e4c307337b8
Reviewed-on: https://gerrit.chromium.org/gerrit/45897
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2013-04-30 15:54:38 -07:00
Darin Petkov
40f2573a7b metrics: Listen to session manager for screen lock/unlock signals.
This should fix a pretty broken DailyUseTime metric. Also, use
contstants from service_constants.h where available.

BUG=chromium:216382,chromium:234799
TEST=unit tests; stop metrics_daemon on the device, then ran metrics_daemon
--nodaemon and inspected console log output while logging in/out as well as on
suspend/resume.
CQ-DEPEND=Ibfcc54c8dbf145cccd5ef871c7c9701b8312eb9e

Change-Id: I69ca0ea9594a496453f0933147ec66b0fa334718
Reviewed-on: https://gerrit.chromium.org/gerrit/49468
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
2013-04-30 06:01:10 -07:00
Chih-Chung Chang
6844c06107 metrics: Add Cras.NoCodecsFoundAtBoot event to CrosEvents
Also put event names into an array, so it's easier to add new event names.

BUG=none
TEST=run "strace -e write=3 metrics_client -v Cras.NoCodecsFoundAtBoot" and
verify the event is written.

Change-Id: I925b4ff3b6d362e099df62a11905c1df03fc9435
Reviewed-on: https://gerrit.chromium.org/gerrit/46998
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
2013-04-02 21:56:20 -07:00
Grant Grundler
4b5164bb9e metrics: add HwWatchdogReboot to CrosEvents
Add HwWatchdogReboot to CrosEvents support.

BUG=chromium:221000
TEST=none

Change-Id: I7388c6d1ee93a73f930d591552b18ea7bba7743f
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46593
Reviewed-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2013-03-28 18:27:14 -07:00
repo sync
1bc9ce0294 metrics: Fixes a comment for |TimerReporter::ReportMilliseconds|.
It turns out that |TimerReporter::ReportMilliseconds| does report a value
for a timer that hasn't been started (in shill,
|Metrics::NotifyDevice*Finished| calls |Stop| immediately before
|ReportMilliseconds| and it works just fine.  This is perfectly OK, it's
just that the comment didn't reflect this.  This CL fixes that.

BUG=None.
TEST=None.

Change-Id: I578d554106acdb92957bfe0197622a1054cfa9c9
Reviewed-on: https://gerrit.chromium.org/gerrit/46337
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
2013-03-25 13:47:27 -07:00
Luigi Semenzato
3268422240 Add generic "event of interest" enumerated histogram.
This change aims to simplify the addition of events we may
want to track in the field, more specifically hard-to-reproduce
bugs.  Before this change, this requires creating a new histogram
and registering it via histograms.xml, which is not in the Chrome OS
repositories.  With this change, a new event just requires claiming
an event name (such as ModemManagerCommandSendFailure) in
metrics_library.cc, and running "metrics_client -v <event name>"
or calling SendCrosEventToUMA(event_name).

I can make up a bug for this.  Or not.

BUG=none
TEST=compiled

Change-Id: I9c56b58310f0d22e77624edee7fe6149abd60a49
Reviewed-on: https://gerrit.chromium.org/gerrit/45322
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-03-13 16:05:39 -07:00
Chris Masone
e10b548cf5 [metrics] Update metrics to build against libchrome-180609
base/eintr_wrapper.h moved to base/posix/eintr_wrapper.h

CQ-DEPEND=Ib19c1382ab28ae7632728aa672478da2feb3950e

BUG=chromium-os:38941
TEST=emerge the metrics package with tests enabled.
STATUS=Fixed

Change-Id: I5d72d8934930ce394786ee151fd8f390b5caf2e1
Reviewed-on: https://gerrit.chromium.org/gerrit/43297
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
2013-02-14 14:03:28 -08:00
Luigi Semenzato
942cbabb1c Modify swap metrics to be more useful.
We need to record the amount of swap used, and correlate it
with the total amount of swap.

The metrics added are Platform.MeminfoSwapUsed and
Platform.MeminfoSwapUsedPercent.

BUG=chromium-os:38583
TEST=not really
BRANCH=none

Change-Id: Iaf26c917e3c4d23f3f58f436047f8dd165177960
Reviewed-on: https://gerrit.chromium.org/gerrit/43123
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2013-02-13 13:00:49 -08:00
Luigi Semenzato
3ccca065fd Add meminfo swap metrics.
The current metrics don't show how much swap we're using at a given
time.  We only have indirect measures (page faults rate for instance).

We also need to add one type of histogram scale, since compressed swap
can exceed total RAM, and all current histograms are on a scale from
zero to total RAM.

BUG=chromium-os:38583
TEST=stared at the code really hard and compiled it
BRANCH=none

Change-Id: Icb9dce5efe5dbd78123aad51ffd369cb46721096
Reviewed-on: https://gerrit.chromium.org/gerrit/42598
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-02-05 16:08:33 -08:00
Julian Pastarmov
d605a005d6 Make policy reloads explicit.
BUG=chromium-os:38541
TEST=unit tests pass

CQ-DEPEND=I20461078ca890c6ec2f81ad5383c06c4d75a64cd

Change-Id: I042e9d1cfbefa479ff18c0b1bc170a15cec705bc
Reviewed-on: https://gerrit.chromium.org/gerrit/42538
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
2013-02-05 09:45:39 -08:00
Ben Chan
9cd8b8cbab Add missing gthread-2.0 linkage.
gthread-2.0 linkage is required for g_thread_init when compiling with
glib 2.32.4.

BUG=chromium-os:34103
TEST=`emerge metrics` with glib 2.30.2 and 2.32.4

Change-Id: Id6ef58ee568989123fc563af47e2670066d01b93
Reviewed-on: https://gerrit.chromium.org/gerrit/32507
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
2012-09-07 01:00:04 -07:00
Yunlian Jiang
564c69f4f1 Add unisdt.h to make gcc 4.7 compile it
BUG=None
TEST=compile passed

Change-Id: I3c52e0c7b60572058d277c05ea05471327149601
Reviewed-on: https://gerrit.chromium.org/gerrit/21672
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2012-05-03 16:46:24 -07:00
Mike Frysinger
f040f1324d update to newer libbase, and allow setting via env
Other packages have this, and it makes managing the ebuild easier, so
let the env set the libbase version to use.

BUG=chromium-os:25872
TEST=`emerge-x86-alex metrics` works
TEST=`cros_run_unit_tests --board=x86-alex -p metrics` pass
TEST=build_images+build_packages for x86-alex boots up

Change-Id: I2f417a13f8220d653aa2bcf6c89f519fb4f2e3df
Reviewed-on: https://gerrit.chromium.org/gerrit/20198
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-04-13 07:31:42 -07:00
Mike Frysinger
f06d7b1213 clean up build & convert to SLOT-ed libbase
This includes a couple of fixes:
 - use the right compiler flag names
 - execute pkg-config twice total, and not once per compile
 - build against SLOT-ed libbase
 - drop link info that was just for libbase as that handles
   things all by itself now without bothering external users

BUG=chromium-os:16623
TEST=`emerge-x86-alex metrics` still works
TEST=`cros_run_unit_tests --board x86-alex -p metrics` passes

Change-Id: I40b9216c9e2a1edef476f9369d524e6a4bf26012
Reviewed-on: https://gerrit.chromium.org/gerrit/17704
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-03-12 12:22:47 -07:00
Mike Frysinger
71ebf98645 include base/stringprintf.h directly
This code uses StringPrintf, but doesn't include the header.  Older
versions of libbase would implicitly include it, but newer ones do
not.  So include it ourselves to fix building with newer versions.

BUG=chromium-os:25872
TEST=`emerge-x86-alex metrics` works (with newer and older libbase)

Change-Id: I7859f67767958f70853a40e8df4a33a64b36d010
Reviewed-on: https://gerrit.chromium.org/gerrit/17487
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-03-07 17:12:08 -08:00
Mike Frysinger
8b8dd20794 touchup pkg-config/library handling
Make sure we execute pkg-config twice in the ebuild and not once
per object compile/link.

Fix the order of libraries when linking libmetric -- we need them to
come after the objects, and we need to link in libbase since we use
symbols from it.  (Things happen to be working now because libpolicy
accidentally exports some symbols from libbase.)

BUG=chromium-os:26658
TEST=`emerge-x86-alex metrics` still works

Change-Id: Ic8381ce9cb3e8a6d81d45d613ac66fea8a12b669
Reviewed-on: https://gerrit.chromium.org/gerrit/16290
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-03-05 11:46:00 -08:00
Eric Shienbrood
1135355246 Update metrics_library.h to find scoped_ptr.h in <base/memory>.
This is in preparation to the move to a newer libchrome, where
scoped_ptr.h no longer appears in base, just in base/memory.

BUG=chromium-os:16623
TEST=Do the emerge, and then examine /usr/include/metrics/metrics_library.h

Change-Id: I95cd9b52eee216316dd8ea21ecb84101d7a95edf
Reviewed-on: https://gerrit.chromium.org/gerrit/17073
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
2012-02-29 13:42:14 -08:00
Elly Jones
4abef11971 [metrics] use libchromeos.pc
BUG=chromium-os:24959
TEST=build

Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/14012
Reviewed-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit 0ea8151d4628ccf500da82206384b8b492a95a0b)

Change-Id: I0c51d49cc7182a19b16d3cb123c43e29be890cbe
Reviewed-on: https://gerrit.chromium.org/gerrit/14505
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Ready: Elly Jones <ellyjones@chromium.org>
Tested-by: Elly Jones <ellyjones@chromium.org>
2012-01-19 14:29:20 -08:00
Scott James Remnant
f53e106bbb Revert "[metrics] use libchromeos.pc"
This reverts commit 6ed1d63d859c37e5a3290d4786862d46927aa5c2

Change-Id: If32cadcdb918f66c9cfada8809f2001122a35d69
Reviewed-on: https://gerrit.chromium.org/gerrit/14118
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
2012-01-12 18:00:47 -08:00
Elly Jones
8df4995721 [metrics] use libchromeos.pc
BUG=chromium-os:24959
TEST=build

Change-Id: I7038f5173c7b0949cbf88e6a9213d75e96ae142d
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/14012
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2012-01-12 12:26:58 -08:00
Luigi Semenzato
df3e4529ca Sends metrics to Chrome even when user did not consent to send stats.
BUG=chromium-os:21660
TEST=observed that Platform.* stats appear in about:histograms also when consent is turned off.

Change-Id: Id70f0cca468ec39fdfe687d89a6f0748a2a07828
Reviewed-on: http://gerrit.chromium.org/gerrit/10147
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
2011-10-21 01:08:26 -07:00
Luigi Semenzato
5bd764faf3 Add page fault statistics.
BUG=chromium-os:20624
TEST=observe that Platform.PageFaultXXX appear in about:histograms.

Change-Id: Ifc281d31e05102dc4133d133f732b737e19891f1
Reviewed-on: http://gerrit.chromium.org/gerrit/10143
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
2011-10-18 12:12:16 -07:00
Bruno Rocha
e3bdf0f559 Fixed wrong method signatures in TimerReporterMock.
TimerReporterMock had some wrong method signatures, and was lacking signatures
for its accessor methods.

BUG=chromium-os:18800
TEST=None

Change-Id: I08d832857c1ae3df907f5470433117f7a03fe125
Reviewed-on: http://gerrit.chromium.org/gerrit/6230
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
Tested-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
2011-08-22 13:07:28 -07:00
Bruno Rocha
be388f301b Added a timer-based report to the metrics library.
Timer encapsulates a timer with basic functionality.
TimerReporter subclasses it for also sending UMA reports.

BUG=chromium-os:18800
TEST=Unit test 'timer_test' has been included

Change-Id: I9de9a2a7388721ba1476fe706a8d12788d2176ad
Reviewed-on: http://gerrit.chromium.org/gerrit/5161
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Bruno Pontes Soares Rocha <bpontes@google.com>
Reviewed-by: Bruno Pontes Soares Rocha <bpontes@google.com>
2011-08-17 14:43:56 -07:00
Julian Pastarmov
0e5debf2d5 Fixed a test where a method was expected to be called but it wasn't.
A recent optimization in the code made that second call unneeded as so
our expectation is not met anymore (for good so).

BUG=chromium-os:18430
TEST=Metrics unit tests should pass.

Change-Id: I1162dc657156ee9207b904ab544b0f151eec0453
Reviewed-on: http://gerrit.chromium.org/gerrit/5302
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
2011-08-04 02:17:26 -07:00
Julian Pastarmov
70b7abd84f Respect the metrics file if no policy value is set (for legacy migration).
BUG=chromium-os:18430
TEST=Update chromeos and check whether the consent for stats is preserved.

Change-Id: I86d4710ef9f381abd9f1eac728040878e6fc5b71
Reviewed-on: http://gerrit.chromium.org/gerrit/5139
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
2011-08-04 01:38:02 -07:00
Ken Mixter
b2f170970e Revert "Revert "Make the metrics library respect the policy settings instead of the consent file.""
This reverts commit aa91d046ac27a9bdc96e6cd9438741d98f1cef66

Change-Id: I1c84fb86d6eb56a5a8e88136c98104394be697b2
Reviewed-on: http://gerrit.chromium.org/gerrit/4614
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
2011-07-22 16:06:45 -07:00
Julian Pastarmov
a3df284fe1 Revert "Make the metrics library respect the policy settings instead of the consent file."
This reverts commit 8c874ca26dd0d07471cfc66ded527ad5c3a1cd20

Change-Id: Iaa91d046ac27a9bdc96e6cd9438741d98f1cef66
Reviewed-on: http://gerrit.chromium.org/gerrit/4583
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
2011-07-22 10:22:10 -07:00
Julian Pastarmov
ff3eb194b0 Make the metrics library respect the policy settings instead of the consent file.
BUG=chromium-os:17012
TEST=metrics_library_test

This is a second try at committing http://gerrit.chromium.org/gerrit/#change,3865

Change-Id: I8c874ca26dd0d07471cfc66ded527ad5c3a1cd20
Reviewed-on: http://gerrit.chromium.org/gerrit/4578
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
2011-07-22 09:16:40 -07:00
Ken Mixter
ec380e84c5 Revert "Make the metrics library respect the policy settings instead of the consent file."
This reverts commit 6a294b4a3e9aa69dc9c429ed398e9dd7615029f2

Change-Id: I7d80b119d4e2b880f75c2293770e073785764e7d
Reviewed-on: http://gerrit.chromium.org/gerrit/4509
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
2011-07-21 14:34:27 -07:00
Julian Pastarmov
a2ce30fdde Make the metrics library respect the policy settings instead of the consent file.
BUG=chromium-os:17012
TEST=metrics_library_test

Change-Id: I133b19a672f52d5ba4f150aa75d1b32af2896c3f
Reviewed-on: http://gerrit.chromium.org/gerrit/3865
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
2011-07-21 14:10:34 -07:00
Arkaitz Ruiz Alvarez
9f1a774c67 Determine guest mode status for metrics collection
Modification to the function IsGuestMode. It returns true only if the guestfs
partition is mounted and the file /var/run/state/logged-in exits. Previously
it did not check for this file existence.

BUG=chromium-os:15763
TEST=Log in in to guest mode right after installing recovery image and check
the absence of /home/chronos/prev_stats. Log out and log in as a user and
confirm the existence of this directory.

Change-Id: I7b0e7e8844332cca3fa67611b90fada3c5ba0eeb
Reviewed-on: http://gerrit.chromium.org/gerrit/1647
Tested-by: Arkaitz Ruiz Alvarez <arkaitzr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
2011-05-26 13:32:41 -07:00
Arkaitz Ruiz Alvarez
4fdcf19a62 Determine guest mode status for metrics collection
Modification to the function IsGuestMode. It returns true only if the guestfs
partition is mounted and the file /var/run/state/logged-in exits. Previously
it did not check for this file existence.

BUG=chromium-os:15763
TEST=Log in in to guest mode right after installing recovery image and check
the absence of /home/chronos/prev_stats. Log out and log in as a user and
confirm the existence of this directory.

Change-Id: I29c66642ba590e882e6ec7a02732e818c87ac2ad
Reviewed-on: http://gerrit.chromium.org/gerrit/1586
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Arkaitz Ruiz Alvarez <arkaitzr@google.com>
2011-05-25 17:19:04 -07:00
Luigi Semenzato
8accd33d92 Add memuse stats and fix disk I/O computations.
This changes adds memory usage stats after 1  5, 30, 150, and 750
minutes of active use (approximated by wall
clock time minus sleep time).  We log only the anonymous memory
usage (active + inactive) as we expect that other types of
allocations would not convey much additional information.

This also fixes the disk I/O computation to use actual active
time elapsed between callbacks, instead of assuming the expected
interval has elapsed.  The existing code causes errors in
both directions when a suspend/resume cycle occurs between callbacks.

BUG=14209
TEST=verify that about:histograms page contains Platform.MemuseAnon1 after 1 minute and Platform.MemuseAnon2 after 5 minutes.

Change-Id: Ib32d915fac7766a9fca7125105224889ea93050e
Reviewed-on: http://gerrit.chromium.org/gerrit/1132
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2011-05-23 15:06:49 -07:00
Darin Petkov
b7780ce4a4 Remove obsolete hardware_class script.
BUG=chromium-os:15257
TEST=emerge-x86-mario metrics

Change-Id: I496121c47394dc81b7f414655940dddc8d5cc992
Reviewed-on: http://gerrit.chromium.org/gerrit/1314
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
2011-05-23 12:34:31 -07:00
Chris Masone
817016a81f [metrics] Roll forward to new libchrome
BUG=chromium-os:14304
TEST=build, unit tests

Change-Id: I92fd96b2c14df847efe47735c0f76d99023ec254
Reviewed-on: http://gerrit.chromium.org/gerrit/819
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
2011-05-14 11:09:36 -07:00
Darin Petkov
8032dd0c6f metrics: Fixed compile-time warnings due to unused variables.
BUG=chromium-os:15040
TEST=built with gcc-4.6

Change-Id: Idf95c986e1eda79be735eeb4ff7c79e9a7eede60
Reviewed-on: http://gerrit.chromium.org/gerrit/569
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
2011-05-10 10:19:45 -07:00
Luigi Semenzato
29c7ef9e6a Add meminfo UMA collection.
Change-Id: Ief779a5bdc68b8e5bf2f1ed979bf30b50aca8e0f

BUG=chromium-os:13747
TEST=verify that Platform.Meminfo* entries are in about:histograms.

Review URL: http://codereview.chromium.org/6804014
2011-04-12 14:12:35 -07:00
Luigi Semenzato
0f132bba6f Find device-dependent disk stats file, and skip disk stats if not available.
Change-Id: I03afb85e3357dd4c2cf5effd98b194c71d77c71d

BUG=12171
TEST=unit tested

Review URL: http://codereview.chromium.org/6541007
2011-02-28 11:17:43 -08:00
Darin Petkov
8d3305eb92 libmetrics: Support partial writes.
BUG=chromium-os:11125
TEST=unit tests, tested on device

Change-Id: If9066988b86f61cb5bae413b7250d5426854f31b

Review URL: http://codereview.chromium.org/6592019
2011-02-25 14:19:30 -08:00
Darin Petkov
8842c8c42d libmetrics -- release the shared file lock when closing, handle EINTR.
BUG=chromium-os:11125
TEST=unit tests, tested on device

Change-Id: I126af62f77e4fd0f098d441038f8dc94c0020ac2

Review URL: http://codereview.chromium.org/6576048
2011-02-24 12:48:30 -08:00
Luigi Semenzato
c88e42dea9 Collect some disk statistics.
Change-Id: Id30f4b7e5d121f2632592ebacf47a18ea1d89fec

BUG=chromium-os:12171
TEST=ran on target and observed that stats are generated

Review URL: http://codereview.chromium.org/6486021
2011-02-17 10:21:16 -08:00