summaryrefslogtreecommitdiff
path: root/cmds/statsd/tools
AgeCommit message (Collapse)Author
2020-12-03Migrate frameworks/base/cmds/statsd to packages/modules/StatsD/bin Baligh Uddin
Add statsd protos to platform_protos rule BUG: 167962588 TEST: TH TEST: Local build [ crosshatch-userdebug ] Change-Id: I053f2a211ea28c2f181937af3d58ad16b235d096
2020-06-26Add atom for general external storage access stats shafik
Define a new pulled atom which will be logged in MediaProvider. The atom collects general access stats for external storage: * Total number of accesses * Total number of file path accesses * Total number of secondary storage accesses * List of accesses mime types Test: build Test: make statsd_testdrive ; ./out/host/linux-x86/bin/statsd_testdrive \ -p com.google.android.providers.media.module 10085 Bug: 149669087 Change-Id: Ic0ebb040a05ec06603f1a617f290af6a2f21916d
2020-05-01Statsd testdrive: remove debug line. Will Brockman
Oops, left the old output in the submitted CL that changed to a new output approach. Bug: 149914234 Test: atest --host frameworks/base/cmds/statsd/tools/localtools/test/com/android/statsd/shelltools/testdrive/*.java Test: statsd_testdrive 90 > /tmp/testdrive Change-Id: Ib9542e478a57ad56d9fe2a0e97cb18a05d5d2535
2020-04-28Statsd TestDrive tool: Write output to stdout. Will Brockman
Also: Option for less verbose output. Bug: 149914234 Test: atest --host test/com/android/statsd/shelltools/testdrive/TestDriveTest.java Test: out/host/linux-x86/bin/statsd_testdrive -terse -one 29 33 48 62 63 64 90 149 244 245 246 259 260 Change-Id: I4ed4cfdd85eb5382ce28846ed6ed81b4dd3f5334
2020-04-23Extend & refactor Statsd TestDrive tool. Will Brockman
Now allows capturing multiple events under the same event metric. Added unit tests for configuration generation and command-line interpretation. Refactored configuration into an inner class and added functionality using TDD. Also updated TestDrive & LocalDrive tools to check ANDROID_SERIAL as well as the -s parameter when multiple devices are connected, and improved error messages. Bug: 149914234 Test: atest --host test/com/android/statsd/shelltools/testdrive/*.java Test: out/host/linux-x86/bin/statsd_testdrive -s <SERIAL> 90 Test: out/host/linux-x86/bin/statsd_localdrive -s <SERIAL> get-data 90 Change-Id: I4e756c2b132a22d66ccaf7b3346fe4fbf1f6f1fb
2020-04-10Merge "Whitelist MediaProvider for statsd metrics" into rvc-dev TreeHugger Robot
2020-04-08Whitelist MediaProvider for statsd metrics shafik
Now that MediaProvider is a mainline module, we need to whitelist it in statsd in order to enable pushing metrics from it. Test: ./out/host/linux-x86/bin/statsd_testdrive -p \ com.google.android.providers.media.module 233 Fix: 153160314 Bug: 149669087 Change-Id: I5237663de2b24d467283d2c2b60f7155fb5b5e53
2020-04-07Add radio to default pull sources in statsd_testdrive. Chi Zhang
Bug: 151642352 Test: m statsd_testdrive and manual test Change-Id: I3411dba98b2087f401adfe374450f187b719b4b3
2020-04-01[statsd/tools] allow multiple connected devices Songchun Fan
// Multiple devices connected Test: adb devices List of devices attached 02211FQC200065 device 98141FFBA005QD device Test: out/host/linux-x86/bin/statsd_testdrive -s 98141FFBA005QD 261 Test: out/host/linux-x86/bin/statsd_localdrive -s 98141FFBA005QD get-data 261 // Single device connected Test: adb devices 98141FFBA005QD device Test: out/host/linux-x86/bin/statsd_testdrive 261 Test: out/host/linux-x86/bin/statsd_localdrive get-data 261 BUG: 152913040 Change-Id: I54009b9151565ddb5512a4f7b3ff8ef67c3a2055
2020-03-27LibstatsPullTest, Testdrive updates for sandboxing Tej Singh
Test: atest LibStatsPullTests Test: statsd_testdrive 10051 10004 10055 Test: adb shell cmd stats pull-source 10051 AID_STATSD Test: adb shell cmd stats pull-source 10055 AID_GPU_SERVICE Test: adb shell cmd stats pull-source 10004 Bug: 151642352 Change-Id: I3b104cb2f2427b4558d5175dfeb3bb2c80012d0e
2019-07-24Merge "Remove the deprecated StatsdDogfood and LoadTest app." TreeHugger Robot
2019-07-23Remove the deprecated StatsdDogfood and LoadTest app. Yao Chen
Bug: 128364199 Test: build Change-Id: I898272860dc9136318320d87a3b19c5ef2725e84
2019-05-15Testdrive: allow multiple atoms in pulled atoms Tej Singh
Modifies statsd_testdrive to allow up to 100 atoms to be pulled at a time. Uses trigger event with app breadcrumb so that the puller happens once. Bug: 128893770 Test: statsd_testdrive 10021 (temperature) Change-Id: I185a7eb1b32a6b19596601dcf5a1ba7a633e4e35
2019-04-27define media.metrics events for statsd Ray Essick
define atoms/messages that express the media.metrics events as they get passed to statsd. This mirrors the data that was already being collected via 'dumpsys media.metrics'. Update the test app's list of acceptable uid's from which it takes submissions to include the media.metrics service. Bug: 118782504 Test: statsd/test_drive Change-Id: I825f6cb7a9baa61f51c45b1b56a20dd94ae48015
2019-02-01Add PermissionGrantRequestResultReported atom Philip P. Moltmann
Also add a prototype for a future system-api accessible metrics file that will be auto-generated from atoms.proto Test: - ./out/host/linux-x86/bin/statsd_testdrive -p com.google.android.permissoncontroller 170 - triggered permission request Bug: 123594188, 123663448 Change-Id: Icede6ff1f12ca79ebad6267c045a4fb3a9955402
2019-01-23Add NetworkStack to allowed log sources in statsd_testdrive Chiachang Wang
Test: - atest statsd_test - manual test with statsd_testdrive Bug: 123260425 Change-Id: Id23162efbdee6979cfa1da5862ff874eed825926
2019-01-04Add ManagedProvisioning to allowed log sources in statsd_testdrive. arangelov
Test: manual Bug: 122346015 Change-Id: I3f4ec145bb331493efb850574a18a50bd893954c
2018-12-20Refactor statsd_testdrive to support recording N atoms at the same time. Ben Murdoch
Found this useful in my testing. Test: make and run statsd_testdrive Change-Id: I3a9ff22119e79e89890c59be514f9f778aaced73
2018-12-20Allow events from AID_LMKD in statsd_testdrive. Ben Murdoch
Test: ran statsd_testdrive for atom 51 (lmk_kill_occurred), saw events Change-Id: I2b9c9817813dcf4c0c7fd69a984726c6ef24db20
2018-12-17LocalDrive fails fast on P devices Bookatz
Makes LocalDrive quit for devices running P or earlier; the statsd of such devices lack the --keep_data flag and therefore will fail anyway, so we may as well the user why and fail fast. Test: Manual testing on userdebug and userbuild, P and Q Change-Id: Ia26528383c9d35732ffd819ed2e2ac6f3bb41b34
2018-12-13Allow statsd_testdrive to work in root Bookatz
LocalDrive needs to handle the situation whereby the caller does 'adb root' in between calls, and therefore runs everything as shell. TestDrive is a single-call, so it can just run as the caller. That's what it used to do, but a recent refactoring made some of its calls via shell, causes an error. This fixes that. Test: manual confirmation that it worked for both shell and root Change-Id: I5e31cdd59d61290a480cb6fae107170616daabc0
2018-12-12statsd local tool Bookatz
Adds a tool for local usage of statsd. The tool can: -upload a config from a file -get the report data from statsd Both the config and the report can be either in binary or human-readable format, as specified. Usage: make statsd_localdrive ./out/host/linux-x86/bin/statsd_localdrive Also, adds the ability to specify whether dump-report should also erase the data when it returns it. A test for this is added. Test: make -j8 statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test Test: make statsd_localdrive && ./out/host/linux-x86/bin/statsd_localdrive <commands> Bug: 77909781 Change-Id: I9a38964988e90c4158a555f41879534267aadd32
2018-10-30Convert statsd and incidentd to Android.bp Colin Cross
See build/soong/README.md for more information. Fixes: 110563449 Test: m checkbuild Change-Id: I8c80878cec46c9299234c6f4c1e0e19efc0a221e
2018-10-24make testdrive log message less verbose Chenjie Yu
1. Use custom TestDriveFormatter for log output. It should be easy to fine tune it from here. 2. Fine tune logging level Now the output looks like this: ./out/host/linux-x86/bin/statsd_testdrive 10 WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.protobuf.Utf8$UnsafeProcessor (file:/android2/master/out/host/linux-x86/framework/statsd_testdrive.jar) to field java.nio.Buffer.address WARNING: Please consider reporting this to the maintainers of com.google.protobuf.Utf8$UnsafeProcessor WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Pushed the following config to statsd: id: 12345 event_metric { id: 1111 what: 1234567 } atom_matcher { id: 1234567 simple_atom_matcher { atom_id: 10 } } ...... hash_strings_in_metric_report: false Now please play with the device to trigger the event. All events should be dumped after 1 min ... Success! Got following metric data dump: metric_id: 1111 event_metrics { data { ..... state: RELEASE } } } } Test: manual test Change-Id: I9fcb09bbd1663f0eae85d428ed45a3b139f62782
2018-10-15local test drive tool for statsd Chenjie Yu
example usage: $./out/host/linux-x86/bin/statsd_testdrive 10009 Uploading the following config to statsd: id: 56789 gauge_metric { id: 2222 what: 1234567 gauge_fields_filter { include_all: true } bucket: ONE_MINUTE } atom_matcher { id: 1234567 simple_atom_matcher { atom_id: 10009 } } allowed_log_source: "AID_GRAPHICS" allowed_log_source: "AID_INCIDENTD" allowed_log_source: "AID_STATSD" allowed_log_source: "AID_RADIO" allowed_log_source: "com.android.systemui" allowed_log_source: "com.android.vending" allowed_log_source: "AID_SYSTEM" allowed_log_source: "AID_ROOT" allowed_log_source: "AID_BLUETOOTH" hash_strings_in_metric_report: false Success! Success! Now wait for 2 minutes ... Success! Got following metric data: metric_id: 2222 gauge_metrics { data { bucket_info { atom { cpu_time_per_uid { uid: 0 user_time_millis: 581844000 sys_time_millis: 135242354000 } } elapsed_timestamp_nanos: 610841423012521 start_bucket_elapsed_millis: 610841423 end_bucket_elapsed_millis: 610880290 } bucket_info { atom { cpu_time_per_uid { uid: 0 user_time_millis: 581904000 sys_time_millis: 135251114000 } } elapsed_timestamp_nanos: 610880295723373 bucket_num: 65 } bucket_info { atom { cpu_time_per_uid { uid: 0 user_time_millis: 581944000 sys_time_millis: 135264674000 } } elapsed_timestamp_nanos: 610940293803881 start_bucket_elapsed_millis: 610940290 end_bucket_elapsed_millis: 610961579 } } } time_base_elapsed_nano_seconds: 606980290711787 bucket_size_nano_seconds: 60000000000 Success! Test: manual test Change-Id: I8ea5249807cf3cf6971e3bbc8696ff33025ba8d7
2018-10-14Fix the typos and naming convention in atoms.proto Yangster-mac
Test: cts,statsd BUG: b/117708491 Change-Id: Ib381ef66ae9925938e1f70b9a8869ef008e3d335
2018-04-10StatsManager throws exceptions Bookatz
When StatsManager fails to connect to statsd, it now throws an exception for the caller to catch. It also throws an exception of the config being added is of an unreadable format. Due to backwards compatibility issues, the old APIs could not be changed, so new ones were made to replace the old ones. The old ones are now temporary and will be removed when the compatibility issue is resolved. Bug: 77648233 Test: gts-tradefed run gts-dev --module GtsStatsdHostTestCases Change-Id: Ibea05883a29b9b3ef9927d2f8fe295eb99832ab7
2018-03-07frameworks/base: Set LOCAL_SDK_VERSION where possible. Anton Hansson
This change sets LOCAL_SDK_VERSION for all packages where this is possible without breaking the build, and LOCAL_PRIVATE_PLATFORM_APIS := true otherwise. Setting one of these two will be made required soon, and this is a change in preparation for that. Not setting LOCAL_SDK_VERSION makes the app implicitly depend on the bootclasspath, which is often not required. This change effectively makes depending on private apis opt-in rather than opt-out. Test: make relevant packages Bug: 73535841 Exempt-From-Owner-Approval: Global cleanup Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
2018-02-28Reduce statsd binary size from 730KB-> 664KB Yao Chen
1. StatsdStats does not use the proto object in memory anymore. 2. lite_static -> lite 3. don't use sstream Bug: 72129300 Test: statsd_test Change-Id: I8a5adaf222d4d5034e8bf115215fb6dd5f042cac
2018-02-21Add annotation to atoms that represent a state change in atoms.proto Yao Chen
+ A state change atom can have one exclusive state field, and any number of primary key fields. When there is primary key in the atom, it means the state belongs to the primary key. For example, message UidProcessStateChanged { optional int32 uid = 1 [(stateFieldOption).option = PRIMARY]; optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; } When there is no primary key fields in the atom, the state is global. For example, message ScreenStateChanged { optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; } + The annotation is consumed by stats_log_api_gen to generate a static map from the state atoms to its primary fields, and exclusive fields + stats_log.proto is splitted into 2 proto files, because statsd needs proto lite, and c++ lite proto library cannot properly ignore the field options which requires full proto. This CL doesn't change any logic in the statsd yet. A separate CL will use the field option information to correctly track the state. Test: added unit tests in stats_log_api_gen_test. and statsd_test pases. Change-Id: I9e8a979fe81ba60efd4d854bb7087ce4b2b147ec
2018-02-13Use elapsed realtime instead of times based on wall clock, which can jump ↵ Yangster-mac
around and go backwards. Test: statsd unit test passed Change-Id: Ib541df99231e171b3be2a24f75632693e36da90e
2018-02-08Merge "Modifies statsd output for start and end times." TreeHugger Robot
2018-02-08Modifies statsd output for start and end times. David Chen
We include the start of when the last dump occurred and the current timestamp. These timestamps are shared across all metrics, so there's no advantage in duplicating these numbers across all metrics. Also, we should use elapsed realtime instead of times based on wall clock, which can jump around and go backwards. Test: Test that statsd can still build and adb shell cmd stats dump-report doesn't crash. Change-Id: I819e5643cee75dfa3e78a58f94c9d61ededa78d7
2018-02-07Statsd notifies listener with pendingintent. David Chen
Previously, statsd would inform interested listeners that it's time to collect data via a protected broadcast. However, the preferred solution is to pass a PendingIntent via a separate setter. Whenever statsd wants the listener to call getData, StatsCompanionService will trigger the pending intent. Test: Tested in marlin-eng that functionality works as expected with dogfood app. Bug: 72562867 Change-Id: Ibcfcd5072a1a78947f8a7cbcd0bc429b54351da3
2018-01-31Use statsd constants instead of literals Bookatz
Instead of writing StatsLog.write(StatsLog.NAME, 1), we replace the 1 with the appropriate StatsLog constant. Bug: 72749863 Test: still compiles Change-Id: I68c8206de49df7e77ee66333dd633e4b70c7b226
2018-01-30Make statsd dogfood app to be a system app. Yao Chen
And update the baseline config. Bug: 72710440 Test: manual Change-Id: Icc37d1d688d3788e9c9e98a594b9532889ffeea9
2018-01-25Statsd and frameworks reference proto enums Bookatz
For frameworks constants that don't have intrinsic meaning (i.e. their actual value and order don't matter), so that it is unlikely that their values will be changed: This cl introduces proto enums representing some constants found in the Android codebase, and connects the two. By using the Proto enum as the source-of-truth, it means that Java and proto can be kept in sync. Otherwise, when the Java frameworks code changes, it silently breaks the protos from working properly, since the enums are wrong. By having the Java code reference the proto enums, it ensures that everything is in sync. The values of the constants are unchanged. But future changes to these constants will need to be done in the proto file, which the Java file merely references. The protos are necessary for incidentd and statsd and, in the future, possibly dumpsys. In this way, the logging mechanism is much less likely to get broken when new constants are added, and we can be ensured that the logging accurately reflects the underlying codebase. Bug: 69478930 Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases Change-Id: If79032c34b2799db1e3e70cb47b1312fd72092b9
2018-01-24Statsd broadcast subscriber Bookatz
Allows a uid that uploads a statsd config to additionally register a BroadcastSubscriber with statsd. If statsd detects an anomaly (according to the config's Alert), statsd can inform a BroadcastSubscriber provided in the config. The config uses a subscriberId (just an int) to identify the BroadcastSubscriber. It then uses StatsManager.setBroadcastSubscriber to associate that subscriberId with a given PendingIntent. Then, when the anomaly is detected, statsd sends a broadcast using that PendingIntent, alerting whoever was specified by the config/setBroadcastSubscriber. Bug: 70356901 Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests Change-Id: I4d9ea9a6c8a85e61fadfd99c1513c55abbadd5e9
2018-01-23Sync statsd google3 protos to aosp. Yangster
Test: statsd unit tests passed Change-Id: I66b05478b7c5b0f9fdd6386b2e2ba7c38a3f9b88
2018-01-21Make StatsdDogfood build again. Yao Chen
Test: manual Change-Id: I14614c060cf0bfb49809315b3ef0482d8a64a1a5
2018-01-19Statsd -> Perfetto integration Primiano Tucci
This CL invokes the perfetto client utility to start the collection of a trace when an anomaly that subscribed to Perfetto is detected. The code simply spawns the /system/bin/perfetto client and passes the trace config via stdin. The client takes care of the dropbox upload. The CollectPerfettoTraceAndUploadToDropbox() function does NOT wait for the full trace collection (in order to avoid blocking statsd) and instead returns immediately after having spawned perfetto. Change-Id: I4f02067bad7a46ede7b6e4841cdcf381c1a4e2a7 Bug: 71795552
2018-01-17Proto change for dimension from condition. Yangster-mac
Test: all statsd unit tests and cts tests passed. Change-Id: I955143aca7c76e2e22a10d7ba42eb797bd32e147
2018-01-10More adjustments to the loadtest app. Stefan Lafon
- Add ability to set the replication factor by intent. - Add shell script to automate the loadtesting. Test: Loadtest app works. Change-Id: I7263a3c23049f3ed20144e4e15b6a54ac5fddcc8
2018-01-05Fix a few things with the loadtest app. Stefan Lafon
Test: Loadtest app is running fine. Change-Id: I834f6c618f5a6b0b17ecd5592e2ab2209ce7b94a
2018-01-04Merge "Use TimeUnit enum to specify the bucket size." TreeHugger Robot
2018-01-04Use TimeUnit enum to specify the bucket size. Yangster-mac
Test: all statsd unit test passed Change-Id: I4f6b80ba2f8c984b06e46e6de6df3e546e99a968
2018-01-04use only string type in the log source whitelist. Yao Chen
+ predefined "AID_X" will be provided as string type to statsd, and we will translate to integer uid using the static map. Test: statsd_test Change-Id: Ie47d8481e0c456457e6881ebb9cb4ce008e772b8
2018-01-031/ Change all "name" to id in statsD. Yangster-mac
2/ Handle Subscription for alert. 3/ Support no_report_metric Bug: 69522276 Test: all statsd unit tests passed. Change-Id: I851b235f2d149b8602b0cad632d5bf541962f40a
2018-01-011/ Support nested message and repeated fields in statsd. Yangster-mac
2/ Filter gauge fields by FieldMatcher. 3/ Wire up wakelock attribution chain. 4/ e2e test: wakelock duration metric with aggregated predicate dimensions. 5/ e2e test: count metric with multiple metric condition links for 2 predicates and 1 non-sliced predicate. Test: statsd unit test passed. Change-Id: I89db31cb068184a54e0a892fad710966d3127bc9
2017-12-22Modify Loadtest app to be able to exclude certain metric types. Yao Chen
Test: manual Change-Id: Iba025e4d6cd7c15a231550d382768aa7661ccc86