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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Change-Id: Ief779a5bdc68b8e5bf2f1ed979bf30b50aca8e0f
BUG=chromium-os:13747
TEST=verify that Platform.Meminfo* entries are in about:histograms.
Review URL: http://codereview.chromium.org/6804014
Change-Id: Id30f4b7e5d121f2632592ebacf47a18ea1d89fec
BUG=chromium-os:12171
TEST=ran on target and observed that stats are generated
Review URL: http://codereview.chromium.org/6486021
Now that flimflam has native support this can be purged.
TEST=run FEATURES=test emerge-x86-generic metrics; verify TimeToDrop is still being recorded w/ about:histograms/Network
Review URL: http://codereview.chromium.org/3233004
Also, initialize the network state from flimflam, just in case -- now
that the metrics daemon process starts a bit late,
BUG=none
TEST=unit tests, ran on the device, emerged arm-generic
Review URL: http://codereview.chromium.org/2864009
This class is currently used to aggregate the active daily use time
but can also be used to aggregate other data (e.g., active use time
between crashes) before sending to UMA. Abstracting this in a separate
class also simplifies the daemon unit tests.
An alternative design would store the data on shutdown (but may slow
down shutdown a little). This should do it for now.
BUG=none
TEST=gmerged on device,inspected logs,about:histograms,etc.
Review URL: http://codereview.chromium.org/2731008
Missing comma in array definition caused metrics_daemon to fail.
Metrics_daemon would use a lot of CPU when broken.
Review URL: http://codereview.chromium.org/2767003
Co-dependent with the following change:
- Issue 2685003: Update XScreenSaver to use new power manager signals for
locking (3 of 7).
TEST=Ran test suite.
BUG=chromium-os:3694
Review URL: http://codereview.chromium.org/2698002
- Remove trailing spaces.
- Convert 'char *' to 'char*'
- Fix other minor style nits
- Many of these issues were pointed out by tfarina.
BUG=none
TEST=Checked that it compiles and passes tests.
Review URL: http://codereview.chromium.org/2693001
Also, guard against time jumps in the active daily use metric collection.
BUG=none
TEST=unit tests; gmerge'd on the target device and inspected the logs.
Review URL: http://codereview.chromium.org/2576005
Refactor the metrics daemon API a little so that we don't need
to link in libmetrics into the daemon test binary.
Review URL: http://codereview.chromium.org/2079007
A separate CL adds a test stanza to the metrics ebuild. More tests
(specifically, for the D-Bus MessageFilter) will also come in a
separate CL.
Review URL: http://codereview.chromium.org/1919005
Rewrite most of metrics_daemon. Convert to low-level D-Bus API -- this
simplifies the code a little and also allows us to catch the power
state signal. I still suspect we may be abusing D-Bus a little but it
seems to work.
snanda@ -- please review the power state code specifically.
BUG=none
TEST=tested on target platform and arm-generic builds
Review URL: http://codereview.chromium.org/1799001
- value is int now.
- add seconds to milliseconds option to metrics_client and use it
- chmod chronos/root fix
- style fixes
Review URL: http://codereview.chromium.org/1649007