Merge "bug fixes * add timestamp to those pull from StatsCompanionService * GaugeMetricProducer unregister from StatsPullerManager when dismissed"
This commit is contained in:
committed by
Android (Google) Code Review
commit
971c8ca6b1
@@ -45,10 +45,11 @@ bool StatsCompanionServicePuller::Pull(const int tagId, vector<shared_ptr<LogEve
|
||||
if (statsCompanion != NULL) {
|
||||
Status status = statsCompanion->pullData(tagId, &returned_value);
|
||||
if (!status.isOk()) {
|
||||
ALOGW("error pulling kernel wakelock");
|
||||
ALOGW("error pulling for %d", tagId);
|
||||
return false;
|
||||
}
|
||||
data->clear();
|
||||
long timestamp = time(nullptr);
|
||||
for (const StatsLogEventWrapper& it : returned_value) {
|
||||
log_msg tmp;
|
||||
tmp.entry_v1.len = it.bytes.size();
|
||||
@@ -56,9 +57,10 @@ bool StatsCompanionServicePuller::Pull(const int tagId, vector<shared_ptr<LogEve
|
||||
tmp.entry.hdr_size = kLogMsgHeaderSize;
|
||||
// And set the received bytes starting after the 28 bytes reserved for header.
|
||||
std::copy(it.bytes.begin(), it.bytes.end(), tmp.buf + kLogMsgHeaderSize);
|
||||
tmp.entry_v1.sec = timestamp;
|
||||
data->push_back(make_shared<LogEvent>(tmp));
|
||||
}
|
||||
ALOGD("KernelWakelockPuller::pull succeeded!");
|
||||
ALOGD("StatsCompanionServicePuller::pull succeeded for %d", tagId);
|
||||
return true;
|
||||
} else {
|
||||
ALOGW("statsCompanion not found!");
|
||||
|
||||
@@ -76,7 +76,9 @@ bool StatsPullerManagerImpl::Pull(int tagId, vector<shared_ptr<LogEvent>>* data)
|
||||
if (DEBUG) ALOGD("Initiating pulling %d", tagId);
|
||||
|
||||
if (mPullers.find(tagId) != mPullers.end()) {
|
||||
return mPullers.find(tagId)->second->Pull(tagId, data);
|
||||
bool ret = mPullers.find(tagId)->second->Pull(tagId, data);
|
||||
ALOGD("pulled %d items", (int)data->size());
|
||||
return ret;
|
||||
} else {
|
||||
ALOGD("Unknown tagId %d", tagId);
|
||||
return false; // Return early since we don't know what to pull.
|
||||
|
||||
@@ -99,6 +99,9 @@ GaugeMetricProducer::GaugeMetricProducer(const ConfigKey& key, const GaugeMetric
|
||||
|
||||
GaugeMetricProducer::~GaugeMetricProducer() {
|
||||
VLOG("~GaugeMetricProducer() called");
|
||||
if (mPullTagId != -1) {
|
||||
mStatsPullerManager.UnRegisterReceiver(mPullTagId, this);
|
||||
}
|
||||
}
|
||||
|
||||
void GaugeMetricProducer::startNewProtoOutputStreamLocked(long long startTime) {
|
||||
|
||||
Reference in New Issue
Block a user