Commit graph

187 commits

Author SHA1 Message Date
Luigi Semenzato
5672f8b2e4 metrics: move sample file from /var/run to /var/lib
Some metrics are generated near shutdown and we expect to collect
them at reboot, but /var/run is a tmpfs and /var/run/uma-events
is lost.

This changes the uma events file location from the perspective
of the metrics daemon.  I am making the same change to Chrome.
I am adding a symlink to allow an older Chrome to read the
samples from the old location.  A newer Chrome will be screwed
but I hope that's OK (i.e. this will work for official builds
and for Chrome OS developers, but may cause malfunction for
Chrome developers)

BUG=chromium:447256
TEST=verified that /var/lib/metrics/uma-events grows and is truncated
CQ-DEPEND=CL:258971

Change-Id: I677cda16486de239dd205247083d4ad7240d992b
Reviewed-on: https://chromium-review.googlesource.com/257084
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2015-03-12 05:16:49 +00:00
Bertrand SIMONNET
e4fa61e05e metrics: don't upload metrics when metrics are disabled
The uploader should only send metrics samples when the metrics are
enabled.
The uploader daemon is still started when the metrics are disabled so
that:
* When we enable the metrics, we don't require a restart of
  metrics_daemon to start uploading metrics.
* The metrics file is truncated periodically and avoid taking too much
  space on long running system with metrics disabled.

BUG=chromium:459636
TEST=unittests
TEST=`test_that -b gizmo gizmo platform_MetricsUploader` works
TEST=manual: uploader does not upload metrics if metrics are disabled.

CQ-DEPEND=CL:250980

Change-Id: I9f5da3457066a183c5791b5488e985b7ab13b6e1
Reviewed-on: https://chromium-review.googlesource.com/250822
Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Nathan Bullock <nathanbullock@google.com>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-02-20 00:07:08 +00:00
Ben Chan
067ec8ba78 metrics: Disable uploader on non-official build.
The metrics uploader should only be enabled on an official build.

BUG=chromium:459105
TEST=`FEATURES=test emerge-$BOARD metrics`
TEST=Verified that metrics uploader is disabled on a developer build.

Change-Id: I5cadb3afeb56c0adac971228aa48ad56ed913bbf
Reviewed-on: https://chromium-review.googlesource.com/250542
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
2015-02-18 01:45:37 +00:00
Alex Vakulenko
7e238f3bcb platform2: Switch over to using base64 functions from libchromeos
Replaced existing implementations of Base64Encode/Base64Decode
with the functions from libchromeos, which were added as part
of an earlier change (see CL:247690).

BUG=None
TEST=`FEATURES=test emerge-link cryptohome debugd metrics privetd update_engine`

Change-Id: I8cec677ce2c2fd3b97ca2228d35c2cf5cd133f4c
Reviewed-on: https://chromium-review.googlesource.com/247792
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2015-02-11 06:00:08 +00:00
Yunlian Jiang
5a6ac9c97c metrics: fix -Winconsistent-missing-override warning
BUG=chromium:453069
TEST=FEATURES="test" emerge-amd64-generic metrics with new clang.

Change-Id: I1576200c94a01af46dd2f36e87806b8c93de7b86
Reviewed-on: https://chromium-review.googlesource.com/244052
Reviewed-by: Dan Erat <derat@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2015-01-29 03:48:31 +00:00
Steve Fung
ae4bdc4c92 metrics: Fix upload_service to work with base::MessageLoop
With an earlier change, metrics_daemon was switched from the glib message loop
to base::MessageLoop.  UploadService still is trying to interact with the
glib message loop, it needs to be switched to using base::MessageLoop.

BUG=chromium:452228
TEST=`FEATURES=test emerge-panther metrics`

Change-Id: I38eb52ca1995d75cfb7d0e69a434e649493e7c6f
Reviewed-on: https://chromium-review.googlesource.com/243429
Reviewed-by: Nathan Bullock <nathanbullock@google.com>
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Stephen Fung <stevefung@chromium.org>
Commit-Queue: Stephen Fung <stevefung@chromium.org>
Trybot-Ready: Stephen Fung <stevefung@chromium.org>
2015-01-28 01:56:01 +00:00
Bertrand SIMONNET
a8bcc18bea metrics: generate app_version from standard lsb-release fields
app_version used to be set to CHROMEOS_RELEASE_DESCRIPTION which has no
structure and should never be used for parsing.

Now that various version numbers have been added to lsb-release, use those
fields to generate the version string.

The version string format is "A.B.C.D (Official Build) $CHANNEL $BOARD" with:
* A = chrome milestone
* B = build number
* C = branch number
* D = patch number
* CHANNEL is one of STABLE, DEV, BETA, CANARY
* BOARD is the board name

BUG=chromium:426889
TEST=trybot run on gizmo-paladin
TEST=`test_that -b gizmo gizmo platform_MetricsUploader`
TEST=`FEATURES=test emerge-gizmo metrics`

Change-Id: I624df14bd859e0c0279dd3de621e651150d30add
Reviewed-on: https://chromium-review.googlesource.com/236949
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org>
2015-01-22 01:18:06 +00:00
Alex Vakulenko
3d41d4561d libchromeos: Cleaned up HTTP utilities
Renamed http utilities by appending ...AndBlock() to make it
obvious that they are blocking (synchronous) calls. Async I/O
is coming in subsequent CLs.

Replaced a bunch of "const char*" with "const std::string&" in
function prototypes.

Also removed extra overloads for http_utils functions in preparation
for adding asynchronous API which would bloat the overloads even more.
The original overloads were to provide the ability to omit some
less-commonly-used parameters, but that would eventually make the API
harder to choose from since the number of overloads will get out of hand.

Swept the code to remove unnecessary calls to std::string::c_str() and
added omitted parameters in calls to http_utils functions.

BUG=None
TEST=FEATURES=test emerge-link libchromeos peerd privetd feedback metrics buffet
CQ-DEPEND=CL:*191319

Change-Id: I9c1721cd2179ba3b389dd94ef181370eec98ed2e
Reviewed-on: https://chromium-review.googlesource.com/239251
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2015-01-14 03:11:25 +00:00
Steve Fung
8ab89c5bfe metrics: Fix metrics_daemon Meminfo callback interval
With the switch from the glib run loop to base::MessageLoop, the
interval for scheduling Meminfo callbacks was incorrectly set to
milliseconds.  Fix it back to seconds.

BUG=chromium:445573
TEST=strace shows metrics_daemon sleep for 30 seconds between
     collecting statistics

Change-Id: I4b4b597273d3cf04b9972011dd0a7386ea14233d
Reviewed-on: https://chromium-review.googlesource.com/238466
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
2015-01-07 05:13:28 +00:00
Steve Fung
e86591e585 metrics: Convert Metrics to DBusDaemon
In order to remove glib, convert Metrics from the glib message loop to
DBusDaemon, which is based on base::MessageLoop.  Also use the DBusDaemon's
dbus::Bus object directly to set up the CrashReporter signal handling, as
the ObjectProxy used by chromeos-dbus-bindings requires all signals be sent
from registered name owners.

BUG=chromium:431838
TEST=Unittests and hwtests pass.
TEST=`test_that -b panther <IP> platform_MetricsUploader` passes
CQ-DEPEND=CL:236652

Change-Id: I6bc1f66999a43065b0d48325b031cd36bb782b76
Reviewed-on: https://chromium-review.googlesource.com/234359
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
2014-12-22 21:50:32 +00:00
Alex Vakulenko
73b40b468b Update libchrome to r307740 and fix build errors
Updated libchrome, libchrome_crypto, metrics, feedback to the
latest revisions from Chrome (r307740).

Fixed build breaks due to the changes in upstream code:

- scope_ptr no longer needs explicit PassAs<T>() calls.
- scope_ptr<T> no longer has implicit conversion to T*.
  Must use scope_ptr<T>::get() instead.
- base/file_util.h moved to base/files/file_util.h
- ARRAYSIZE_UNSAFE() removed in favor of arraysize()
- base::AppendToFile() and base::WriteFileDescriptor() now
  return bool instead of the number of bytes written.
- dbus::Bus::AddFilterFunction() now returns void.
- C++11 features are enabled in libchromeos, so all targets
  linking with it now have to support C++11
- OVERRIDE macro is removed in favor of native C++11
  'override' keyword.

BUG=chromium:416628, chromium:411508
TEST=Build the world on x86, x64, ARM. The following builders
     were tried:
       x86-generic-full amd64-generic-full arm-generic-full
       amd64-generic-asan daisy-full nyan-full pre-cq-group
       daisy-release-group sandybridge-release-group
       pineview-release-group
CQ-DEPEND=CL:234450,CL:234980

Change-Id: I374bebe2211d533c4431c82efb8be1cdcb1f405d
Reviewed-on: https://chromium-review.googlesource.com/234440
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-12-15 07:18:09 +00:00
Alex Vakulenko
788d3b6365 metrics: fork metrics sources from Chromium source base
In preparation to libchrome uprev, fork off non-protobuf code
from Chromium's metrics component into platform2/metrics.

The current version of Chromium's metrics component has been
significantly refactored and pieces of functionality that
Chromium OS was dependant on (e.g. MetricsLogBase class) has
been removed completely.

So, taking the r293518 version we have been using for a while
and putting it as part of platform2/metrics now.

BUG=None
TEST=FEATURES=test emerge-link metrics

Change-Id: Ib46ac1dff2e2b9cc881e4787b3c6b6250f0bf9c4
Reviewed-on: https://chromium-review.googlesource.com/234635
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
2014-12-12 21:38:08 +00:00
Alex Deymo
7845a57134 Include the implemented header first in all projects.
The Google C++ style guide dictates that foo.cc and foo_unittest.cc
should include foo.h in the first place, so missing headers in foo.h
are detected with a compile error of the module implementing them and
not when another module uses them.

This CL sweeps across all the .cc file in platform2 enforcing this.

BUG=None
TEST=cbuildbot amd64-generic

Change-Id: I41835835caba13f54c3c844ecf552eb0e47efa9d
Reviewed-on: https://chromium-review.googlesource.com/228894
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-11-12 19:56:58 +00:00
Nathan Bullock
d78f3df6bc libchromeos: void OsReleaseReader.Load()
Previously OsReleaseReader returned a bool, which meant that code that
called load wanted to CHECK the return values and possibly log warning
messages, etc. This was unecessary since OsReleaseReader.Load never
returns false.

TEST=unittests
BUG=none

Change-Id: I7064c6a788897b5d5c687d6c9c5f4e03d4ca21a7
Reviewed-on: https://chromium-review.googlesource.com/223990
Reviewed-by: Bertrand Simonnet <bsimonnet@google.com>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: Nathan Bullock <nathanbullock@google.com>
2014-10-18 01:39:05 +00:00
Bertrand SIMONNET
cac74e122f metrics: use TimeDelta for upload_interval
Use TimeDelta instead of int interpreted as seconds.

BUG=None
TEST=Unittests.

Change-Id: I18db8d558303291ab86b26c68c89203e0364b623
Reviewed-on: https://chromium-review.googlesource.com/222611
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-10-15 00:10:07 +00:00
Bertrand SIMONNET
71a62efc54 metrics: add support for other product id
metrics_uploader should use the GOOGLE_METRICS_PRODUCT_ID field from os-release
whenever possible instead of the default Chrome product id.

BUG=chromium:415744
TEST=FEATURES=test emerge-gizmo metrics succeeds.
TEST=test_that platform_MetricsUploader succeeds.

CQ-DEPEND=CL:221963

Change-Id: I69b1a6ca766048ad80d93008a2fe3b18879bf1da
Reviewed-on: https://chromium-review.googlesource.com/221953
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2014-10-10 06:54:05 +00:00
Steve Fung
67906c6bbb metrics: remove gflags dependency
We are switching to using chromeos/flag_helper.h instead to standardize the
code everywhere.

BUG=chromium:375017
TEST=`FEATURES=test emerge-panther metrics`
TEST=`cbuildbot --remote --hwtest -p 'chromiumos/platform2'
      falco-paladin` passes

Change-Id: Icd08f65fd639e82ac6fe1581c763d60a189db827
Reviewed-on: https://chromium-review.googlesource.com/221757
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
2014-10-07 05:53:18 +00:00
Nathan Bullock
e812249cab metrics: protobufs need to be uploaded as binary
TEST=manually tested on panther_embedded
BUG=none

Change-Id: Id07952d2b015c4199344556686218a78b8d79193
Reviewed-on: https://chromium-review.googlesource.com/221060
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: Nathan Bullock <nathanbullock@google.com>
2014-10-02 20:51:01 +00:00
Nathan Bullock
52d9edb590 metrics: 'Send' method crashes on NULL ErrorPtr
TEST=manually tested on panther_embedded
BUG=none

Change-Id: Iced380180918839d34a46e1cb2743a4cffdd5b4c
Reviewed-on: https://chromium-review.googlesource.com/220780
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: Nathan Bullock <nathanbullock@google.com>
2014-10-01 19:47:24 +00:00
Alex Deymo
dfea2f8992 Remove '../platform2/' from platform2 relative paths in gyp files.
The paths in platform2 gyp files are relative to the gyp file so they
don't require to have '../platform2/' in them.

BUG=None
TEST=cbuildbot amd64-generic-full arm-generic-full

Change-Id: I4da32969fc4956df14e9d3685f790565cd33d20f
Reviewed-on: https://chromium-review.googlesource.com/219788
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
2014-09-25 04:10:00 +00:00
Nathan Bullock
dc1ef3c356 metrics: read /sys/class/block/*/stat correctly
TEST=unit tests, manual tested on panther_embedded
BUG=chromium:415118

Change-Id: I849a9b7849a27d29d9d24bb1575f113e43716bd5
Reviewed-on: https://chromium-review.googlesource.com/218504
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: Nathan Bullock <nathanbullock@google.com>
2014-09-19 03:00:11 +00:00
Nathan Bullock
0be0f736d7 metrics: Add more log messages to uploader
TEST=compiled
BUG=none

Change-Id: Iee49b104d0b6214e035f70fa108ae7464bd7988f
Reviewed-on: https://chromium-review.googlesource.com/217338
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Nathan Bullock <nathanbullock@google.com>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
2014-09-19 02:59:32 +00:00
Bertrand SIMONNET
eb815be5a9 metrics: Fix metrics_uploader on VMs
metrics_uploader must be in testing mode so that it does not try to grab the
real hardware id (not available on VMs).

BUG=chromium:413256
TEST=FEATURES=test emerge-amd64-generic metrics.
TEST=platform_MetricsUploader succeeds on a gizmo VM.

Change-Id: I9e508c8661dfdb7933161b0d41ef4cf9bd7db2c6
Reviewed-on: https://chromium-review.googlesource.com/217760
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-09-17 01:25:07 +00:00
Ben Chan
51bf92a3cb Update code to include base/files/file_util.h
file_util.h was moved from base to base/files
(https://codereview.chromium.org/468253002). This CL updates platform2
code to include base/files/file_util.h instead of base/file_util.h.

BUG=chromium:411001
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I488925b54615e131e508a460dc1a27f88168f936
Reviewed-on: https://chromium-review.googlesource.com/216851
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:34 +00:00
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