diff options
author | Yao Chen <yaochen@google.com> | 2018-03-15 16:48:25 -0700 |
---|---|---|
committer | Yao Chen <yaochen@google.com> | 2018-03-16 13:56:38 -0700 |
commit | c40a19d2e43d5de3e036e926bf070220c2c865e6 (patch) | |
tree | 4fa3688aee73fdd1a7295fd83a782665f7676650 /tools/stats_log_api_gen/Collation.cpp | |
parent | ddbb9d00a262e46054636582d3dda02f57694d77 (diff) |
Add uid field annotation in atoms.proto and statd memory usage optimization.
[memory]
statsd binary size from 664k -> 600k
memory usage 1978k -> 1813k (with no configs)
+ Avoid initialize any static map in statslog.h to avoid many copies of the map in each include.
- Do it in cpp so that it is initialized only in places that use them
[Uid annotation]
+ Uid annotation is needed for extracting uid from dimension for UidCpuPuller.
+ After the change, stand-alone uids don't need to be in field 1 anymore.
+ Also added exclusive bit annotation in AppDied
+ Currently only allow one uid field in an Atom. This is to keep things simple until
we find an exception.
Test: statsd_test
Bug: 73958484
Bug: 72129300
Change-Id: I8a916d5c00d5930e24ae7e0825a57dea19c0e744
Diffstat (limited to 'tools/stats_log_api_gen/Collation.cpp')
-rw-r--r-- | tools/stats_log_api_gen/Collation.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/stats_log_api_gen/Collation.cpp b/tools/stats_log_api_gen/Collation.cpp index ab106d708748..ebdcdfdd6c50 100644 --- a/tools/stats_log_api_gen/Collation.cpp +++ b/tools/stats_log_api_gen/Collation.cpp @@ -46,7 +46,8 @@ AtomDecl::AtomDecl(const AtomDecl& that) message(that.message), fields(that.fields), primaryFields(that.primaryFields), - exclusiveField(that.exclusiveField) {} + exclusiveField(that.exclusiveField), + uidField(that.uidField) {} AtomDecl::AtomDecl(int c, const string& n, const string& m) :code(c), @@ -262,6 +263,18 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, errorCount++; } } + + if (field->options().GetExtension(os::statsd::is_uid) == true) { + if (javaType != JAVA_TYPE_INT) { + errorCount++; + } + + if (atomDecl->uidField == 0) { + atomDecl->uidField = it->first; + } else { + errorCount++; + } + } } return errorCount; |