summaryrefslogtreecommitdiff
path: root/pixelstats/MmMetricsReporter.cpp
diff options
context:
space:
mode:
authorRobin Hsu <robinhsu@google.com>2022-07-06 12:44:34 +0800
committerRobin Hsu <robinhsu@google.com>2022-08-23 08:14:42 +0000
commit6a8de948f151cda6033454809de332582c0a6272 (patch)
tree5881bf9a167a8c651f6e1a50bdc2e71977af0a8b /pixelstats/MmMetricsReporter.cpp
parentfdb36c83b5bf220c8fdd234fe52f285587458d9d (diff)
pixelstat: MM metrics: framework change
Some small change in the MM metrics framework: * Previously preparing atom by a vector "values", and the vector is keep resized per module added in. This CL calculates the last index and allocate space for the vector once for all. Note that later on, if we want to add or remove some metrics, we need to change the last index to keep it sync to the last metric proto file. * Add version for 'PixelMmMetricsPerHour' and 'PixelMmMetricsPerday' (and it is the last metrics as defined in the design doc) Test: n/a Bug: 234564667 Signed-off-by: Robin Hsu <robinhsu@google.com> Change-Id: I35da187f9318e8aed089c3676d8c6df815913f02
Diffstat (limited to 'pixelstats/MmMetricsReporter.cpp')
-rw-r--r--pixelstats/MmMetricsReporter.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/pixelstats/MmMetricsReporter.cpp b/pixelstats/MmMetricsReporter.cpp
index 4a2a087..c93f0d9 100644
--- a/pixelstats/MmMetricsReporter.cpp
+++ b/pixelstats/MmMetricsReporter.cpp
@@ -312,16 +312,14 @@ void MmMetricsReporter::logPixelMmMetricsPerHour(const std::shared_ptr<IStats> &
uint64_t ion_total_pools = getIonTotalPools();
uint64_t gpu_memory = getGpuMemory();
- std::vector<VendorAtomValue> values;
- fillAtomValues(kMmMetricsPerHourInfo, vmstat, &prev_hour_vmstat_, &values);
-
- // resize values to add the following fields
+ // allocate enough values[] entries for the metrics.
VendorAtomValue tmp;
tmp.set<VendorAtomValue::longValue>(0);
- int size = PixelMmMetricsPerHour::kGpuMemoryFieldNumber - kVendorAtomOffset + 1;
- if (values.size() < size) {
- values.resize(size, tmp);
- }
+ int last_value_index =
+ PixelMmMetricsPerHour::kPsiMemSomeAvg300AvgFieldNumber - kVendorAtomOffset;
+ std::vector<VendorAtomValue> values(last_value_index + 1, tmp);
+
+ fillAtomValues(kMmMetricsPerHourInfo, vmstat, &prev_hour_vmstat_, &values);
tmp.set<VendorAtomValue::longValue>(ion_total_pools);
values[PixelMmMetricsPerHour::kIonTotalPoolsFieldNumber - kVendorAtomOffset] = tmp;
tmp.set<VendorAtomValue::longValue>(gpu_memory);
@@ -340,8 +338,15 @@ void MmMetricsReporter::logPixelMmMetricsPerDay(const std::shared_ptr<IStats> &s
if (vmstat.size() == 0)
return;
- std::vector<VendorAtomValue> values;
bool is_first_atom = (prev_day_vmstat_.size() == 0) ? true : false;
+
+ // allocate enough values[] entries for the metrics.
+ VendorAtomValue tmp;
+ tmp.set<VendorAtomValue::longValue>(0);
+ int last_value_index =
+ PixelMmMetricsPerDay::kThpDeferredSplitPageFieldNumber - kVendorAtomOffset;
+ std::vector<VendorAtomValue> values(last_value_index + 1, tmp);
+
fillAtomValues(kMmMetricsPerDayInfo, vmstat, &prev_day_vmstat_, &values);
std::map<std::string, uint64_t> pixel_vmstat =