mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-27 17:11:37 +00:00
commit
a5bedc0a26
@ -73,7 +73,22 @@ long BufferWriter::Write(const void* data, size_t size)
|
||||
if (shareMemoryBlock_ == nullptr || data == nullptr || size == 0) {
|
||||
return false;
|
||||
}
|
||||
return shareMemoryBlock_->PutRawTimeout(reinterpret_cast<const int8_t*>(data), size);
|
||||
|
||||
ProfilerPluginData pluginData;
|
||||
pluginData.set_name(pluginName_);
|
||||
pluginData.set_version(pluginVersion_);
|
||||
pluginData.set_status(0);
|
||||
pluginData.set_data(data, size);
|
||||
|
||||
struct timespec ts = { 0, 0 };
|
||||
clock_gettime(clockId_, &ts);
|
||||
|
||||
pluginData.set_clock_id(static_cast<ProfilerPluginData_ClockId>(clockId_));
|
||||
pluginData.set_tv_sec(ts.tv_sec);
|
||||
pluginData.set_tv_nsec(ts.tv_nsec);
|
||||
|
||||
DoStats(pluginData.ByteSizeLong());
|
||||
return shareMemoryBlock_->PutMessage(pluginData, pluginName_);
|
||||
}
|
||||
|
||||
RandomWriteCtx* BufferWriter::StartReport()
|
||||
|
@ -823,19 +823,22 @@ void StackPreprocess::Flush(const uint8_t* src, size_t size)
|
||||
HILOG_ERROR(LOG_CORE, "Flush src is nullptr");
|
||||
return;
|
||||
}
|
||||
ProfilerPluginData pluginData;
|
||||
pluginData.set_name("nativehook");
|
||||
pluginData.set_version("1.02");
|
||||
pluginData.set_status(0);
|
||||
pluginData.set_data(src, size);
|
||||
struct timespec ts;
|
||||
clock_gettime(pluginDataClockId_, &ts);
|
||||
pluginData.set_clock_id(static_cast<ProfilerPluginData_ClockId>(pluginDataClockId_));
|
||||
pluginData.set_tv_sec(ts.tv_sec);
|
||||
pluginData.set_tv_nsec(ts.tv_nsec);
|
||||
pluginData.SerializeToArray(buffer_.get(), pluginData.ByteSizeLong());
|
||||
if (isSaService_) {
|
||||
ProfilerPluginData pluginData;
|
||||
pluginData.set_name("nativehook");
|
||||
pluginData.set_version("1.02");
|
||||
pluginData.set_status(0);
|
||||
pluginData.set_data(src, size);
|
||||
struct timespec ts;
|
||||
clock_gettime(pluginDataClockId_, &ts);
|
||||
pluginData.set_clock_id(static_cast<ProfilerPluginData_ClockId>(pluginDataClockId_));
|
||||
pluginData.set_tv_sec(ts.tv_sec);
|
||||
pluginData.set_tv_nsec(ts.tv_nsec);
|
||||
pluginData.SerializeToArray(buffer_.get(), pluginData.ByteSizeLong());
|
||||
size = pluginData.ByteSizeLong();
|
||||
}
|
||||
|
||||
writer_->Write(buffer_.get(), pluginData.ByteSizeLong());
|
||||
writer_->Write(buffer_.get(), size);
|
||||
writer_->Flush();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user