Optionally, accept a std::pair<int, int>* that is populated with the
starting and ending indices of attribution nodes in FieldValues vector.
Bug: 154286011
Test: bit statsd_test:*
Change-Id: I6f19abea7fbb27712b6c2d5a7679aa4f428c191d
This helps save memory because FieldValues are copied around much more
than LogEvents.
+ removed unused variables from LogEvent
Test: bit statsd_test:*
Bug: 154267590
Change-Id: If444ef79c85a45526fce183b67d9d8a2e74fa10d
- Add AnnotationId enum stats-log-api-gen
- Rename RESET_STATE annotation to TRIGGER_STATE_RESET. Also rename the proto annotation.
Bug: 152412767
Test: stats-log-api-gen-test
Test: m statslog-framework-java-gen
Change-Id: I2c12ea0b9222ef28b8cc11ea36b272e518a96259
This CL serves as a prototype for future efforts to move statsd tests to
the new socket schema.
We also significantly refactor the LogEvent class by introducing two new
functions:
- LogEvent::LogEvent(int32_t uid, int32_t pid)
- bool LogEvent::parseBuffer(uint8_t* buf, size_t size)
The goal is that these two functions will be the only two entry points
into the class. Separating these two is helpful because (a) it allows
test and source code to use the same codepath and (b) it allows the
calling function to see if the atom encoding was successfully parsed
(note that constructors can't return values).
P.S. This CL breaks LogEventQueueTests, but that will be resolved once
all tests are moved to the new constructors.
Test: m statsd
Test: bit statsd_test:SimpleConditionTrackerTest#TestSlicedCondition
Bug: 149590301
Change-Id: Id3c9522c4467c4869ec97226734a556dd9dfb169
Merged-In: Id3c9522c4467c4869ec97226734a556dd9dfb169
(cherry picked from commit 14f56f6bc4)
LogEvent now stores the client's pid (the pid defaults to -1 if it is
not known). This pid will be used internally for permission checks.
This CL also fixes a bug where uids of -1 were being treated incorrectly
as unsigned ints.
Test: bit statsd_test:* (passes when the new socket schema flag is
flipped on).
Change-Id: I8b6b202bb719b79646282764f82466c8065031b3
Since all pullers now use StatsEvent instead of StatsLogEventWrapper,
this class can be deleted.
Test: m -j
Test: m -j statsd_test
Bug: 146578681
Change-Id: I63013768ee13af0235f8cd857ca3fc16d2fd877f
New tests are guarded by NEW_ENCODING_SCHEME flag.
Test: bit statsd_test:* (passes both when the flag is turned on or off)
Change-Id: I429f478355e3e19941e4796706405ab0774e11d9
This adds a writeBytes interface to LogEvent for native pulled atoms,
which have been using write(string). The function still takes in a
string, but instead uses the write_char_array interface to avoid
stopping on null termination.
Test: modified tests and ran statsd_test
Test: statsd_testdrive 10055 to test against gpu app stats
Bug: 141965020
Change-Id: Iaedfb73310769165d8b61affb55e784f109355cf
Change the file format to store the
experiment IDs direclty so we don't
need to parse the proto when reading
the values out.
Bug: 129099771
Test: bit statsd_test:* && adb shell cmd stats pull-source 10051
Change-Id: I0dc1fd118f4d9ba597c2f0959648136bbafb5aab
The field of the FieldValue was not properly being set in LogEvent for
many of the types in the KeyValuePairsAtom.
Test: manual inspeciton of logcat
Test: modified unit tests and made sure they passed
Change-Id: I445a2d3051cfa86affe45ea9a3fe69794f962eff
This reverts commit 9c7b131996.
Reason for revert: Fixed build failures due to merge
Change-Id: I7d7bfed3a3234b966f3fe3fd6e0cbc63d2bedf83
Test: unit test
+ 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
The key change is to revamp how we parse/store/match a log event, especially how we match repeated
field and attribution nodes, and how we construct dimensions and compare them.
+ We use a integer to encode the field of a log element. And also encode the FieldMatcher into an
integer and a bit mask. The log matching becomes 2 integer operations.
+ Dimension is stored as encoded field and value pair. Checking if 2 dimensions are equal is then
becoming checking if the underlying integers are equal. The integers are stored contiguously
in memory, so it's much faster than previous tree structure.
Start review from FieldValue.h
Test: statsd_test + new unit tests
Bug: 72659059
Change-Id: Iec8daeacdd3f39ab297c10ab9cd7b710a9c42e86