summaryrefslogtreecommitdiff
path: root/metrics_utils.h
AgeCommit message (Collapse)Author
2020-11-14update_engine: Make SystemState accessible from everywhereAmin Hassani
SystemState is supposed to be a global context and is used lamost everywhere. So instead of passing it to functions and keeping multiple pointers to it, its better to do what we did in dlcservice and make it a singleton class with a getter that can be get from everywhere. BUG=b:171829801 TEST=unittests Change-Id: I3b2de9394b7769b3911195ca52d61dbe49afd4dd Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521792 Commit-Queue: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-11-03update_engine: Create cros vs. aosp boundary clearAmin Hassani
Its time to make the boundary between Chrome OS and Android code more clear. This CL moves all CrOS only code to "chromeos" directory and the same for Android (in "android" directory). This way we would easily know which code is uses in which project and can keep the code cleaner and more maintainable. One big remaining problem is download_action* files. It seems like DownloadAction class does a lot of things that chrome OS needs and it depends on a lot of Chrome OS stuff, but Android is also using thie Action in a way that circumvent the Chrome OS stuff. For example Android checks for SystemState to be nullptr to not do things. This is really fragile and needs to change. Probably Android Team has to implement their own DownloadAction of some sort and not re use the Chrome OS one in a very fragile way. Removed a few android files that have not been used anywhere. Changed some clang-format and lint issues in order to pass preupload. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: I3fff1d4a100a065a5c1484a845241b5521614d9f Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2508965 Tested-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Tianjie Xu <xunchang@google.com> Reviewed-by: Kelvin Zhang <zhangkelvin@google.com> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2018-08-16Fix two android metrics reporting in update engineTianjie Xu
1. The AttemptCurrentBytesDownloadedMiB was reported in bytes. 2. We were using the same start timestamp (in monotonic_time) for both boot_time and monotonic_time. This leads to an inaccurate update duration reporting. This cl saves an extra perf for the boot time and calculates the duration accordingly. Also report these information with a different metrics name. Bug: 30989466 Test: Run an update and check the report Change-Id: I69e20648501a736a59ff60ca9202ce7bdd9b6e34
2017-10-14Collect metrics for android update attemptTianjie Xu
Report the update attempt/result metrics when an upate finishes; and abnormally terminated updates/time to reboot when the device reboots. Bug: 30989466 Test: update_engine_unittest pass Change-Id: Iea16b4e8003ae3dab5e9b7c65cf4b38d2219d203
2017-09-20Move metrics from namespace to classTianjie Xu
Add a new metrics reporter interface to handle the current metrics report for omaha (with metricsd). This helps to add metrics logging for android phone devices (using other libraries) in the future. Also change the unit tests accordingly. Test: unit tests pass for pico Change-Id: I703c8b6353e4b38bc89d6a71f01623978cf7a549
2016-06-07Move ParseConnection*() to connection_utils.Sen Jiang
We don't need real_shill_provider if USE_DBUS is 0, but we still need these functions, and they have a duplicate copy in connection_manager, so put them in utils and deduplicate. Also moved StringForConnectionType() to connection_utils. Bug: 28800946 Test: mma Change-Id: If535fdc52bc8fb267921bea02b31d8d6580d5d54
2015-11-17Move metrics time helpers to metrics_utils.Alex Deymo
The metrics module reports metrics periodically, for which it needs to keep track of the duration since some events (for example, the update finished). These helpers were in the common/utils.h, but they rely on the global SystemState to access both Prefs and Clock. Since these helpers are specific to the metric reporting, this CL moves them to the metrics_utils.h module. Bug: 25197634 TEST=FEATURES=test emerge-link update_engine; mmma system/update_engine Change-Id: Ia48091adbdc56c339c69c86c91c5c01aa58c54fb
2015-11-12common: Split out metrics utils from utils.cc.Alex Deymo
The utility functions to convert error codes and network settings to the types defined by the metrics framework are split out the utils.cc file. These tools are only used by the update_engine daemon to report back metrics on an update check. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; mma Change-Id: I589dc9f6056fb1399fa84ca4f44076ed3a6b5365