Lines Matching full:sample

59 ExecutionMode PerfExecMode(const PerfDataHandler::SampleContext& sample) {  in PerfExecMode()  argument
60 if (sample.header.has_misc()) { in PerfExecMode()
61 switch (sample.header.misc() & PERF_RECORD_MISC_CPUMODE_MASK) { in PerfExecMode()
106 // required to uniquely identify a Sample: if two Samples you consider different
115 // The index of the sample's command in the profile's string table.
144 // can be thread-specific. If the requested sample labels include PID and
145 // TID, we'll need to maintain separate profile sample objects for samples
146 // that are identical except for TID. Likewise, if the requested sample
149 typedef std::unordered_map<SampleKey, perftools::profiles::Sample*,
160 // object is created per, say, each sample), so using the pointers is OK.
210 void Sample(const PerfDataHandler::SampleContext& sample) override;
215 // Adds a new sample updating the event counters if such sample is not present
217 // with the sample if the sample was added before.
236 // profile.proto's Sample.Label field.
239 // profile.proto's Sample.Label field.
242 // profile.proto's Sample.Label field.
247 // profile.proto's Sample.Label field.
252 // profile.proto's Sample.Label field.
255 SampleKey MakeSampleKey(const PerfDataHandler::SampleContext& sample,
259 const PerfDataHandler::SampleContext& sample);
289 const PerfDataHandler::SampleContext& sample, ProfileBuilder* builder) { in MakeSampleKey() argument
291 sample_key.pid = sample.sample.has_pid() ? sample.sample.pid() : 0; in MakeSampleKey()
293 (IncludeTidLabels() && sample.sample.has_tid()) ? sample.sample.tid() : 0; in MakeSampleKey()
295 (IncludeTimestampNsLabels() && sample.sample.has_sample_time_ns()) in MakeSampleKey()
296 ? sample.sample.sample_time_ns() in MakeSampleKey()
299 sample_key.exec_mode = PerfExecMode(sample); in MakeSampleKey()
301 if (IncludeCommLabels() && sample.sample.has_pid() && in MakeSampleKey()
302 sample.sample.has_tid()) { in MakeSampleKey()
303 Pid pid = sample.sample.pid(); in MakeSampleKey()
304 Pid tid = sample.sample.tid(); in MakeSampleKey()
314 const PerfDataHandler::SampleContext& sample) { in GetOrCreateBuilder() argument
315 Pid builder_pid = (options_ & kGroupByPids) ? sample.sample.pid() : 0; in GetOrCreateBuilder()
343 sample_type->set_type(UTF8StringId(event_name + "sample", builder)); in GetOrCreateBuilder()
349 if (sample.main_mapping == nullptr) { in GetOrCreateBuilder()
355 AddOrGetMapping(sample.sample.pid(), sample.main_mapping, builder); in GetOrCreateBuilder()
370 if ((options_ & kGroupByPids) && sample.main_mapping != nullptr && in GetOrCreateBuilder()
371 sample.main_mapping->filename != nullptr) { in GetOrCreateBuilder()
374 const string& sample_filename = MappingFilename(sample.main_mapping); in GetOrCreateBuilder()
378 LOG(FATAL) << "main mapping mismatch: " << sample.sample.pid() << " " in GetOrCreateBuilder()
381 LOG(WARNING) << "main mapping mismatch: " << sample.sample.pid() in GetOrCreateBuilder()
387 if (sample.sample.sample_time_ns()) { in GetOrCreateBuilder()
388 per_pid.process_meta->UpdateTimestamps(sample.sample.sample_time_ns()); in GetOrCreateBuilder()
438 perftools::profiles::Sample* sample = per_pid_[pid].sample_map[sample_key]; in AddOrUpdateSample() local
440 if (sample == nullptr) { in AddOrUpdateSample()
442 sample = profile->add_sample(); in AddOrUpdateSample()
443 per_pid_[pid].sample_map[sample_key] = sample; in AddOrUpdateSample()
445 sample->add_location_id(location_id); in AddOrUpdateSample()
448 if (IncludePidLabels() && context.sample.has_pid()) { in AddOrUpdateSample()
449 auto* label = sample->add_label(); in AddOrUpdateSample()
451 label->set_num(static_cast<int64>(context.sample.pid())); in AddOrUpdateSample()
453 if (IncludeTidLabels() && context.sample.has_tid()) { in AddOrUpdateSample()
454 auto* label = sample->add_label(); in AddOrUpdateSample()
456 label->set_num(static_cast<int64>(context.sample.tid())); in AddOrUpdateSample()
459 auto* label = sample->add_label(); in AddOrUpdateSample()
463 if (IncludeTimestampNsLabels() && context.sample.has_sample_time_ns()) { in AddOrUpdateSample()
464 auto* label = sample->add_label(); in AddOrUpdateSample()
467 static_cast<int64>(context.sample.sample_time_ns()); in AddOrUpdateSample()
471 auto* label = sample->add_label(); in AddOrUpdateSample()
475 // Two values per collected event: the first is sample counts, the second is in AddOrUpdateSample()
476 // event counts (unsampled weight for each sample). in AddOrUpdateSample()
479 sample->add_value(0); in AddOrUpdateSample()
480 sample->add_value(0); in AddOrUpdateSample()
485 // If the sample has a period, use that in preference in AddOrUpdateSample()
486 if (context.sample.period() > 0) { in AddOrUpdateSample()
487 weight = context.sample.period(); in AddOrUpdateSample()
497 sample->set_value(2 * event_index, sample->value(2 * event_index) + 1); in AddOrUpdateSample()
498 sample->set_value(2 * event_index + 1, in AddOrUpdateSample()
499 sample->value(2 * event_index + 1) + weight); in AddOrUpdateSample()
549 void PerfDataConverter::Sample(const PerfDataHandler::SampleContext& sample) { in Sample() function in perftools::__anon7d696b850111::PerfDataConverter
550 if (sample.file_attrs_index < 0 || in Sample()
551 sample.file_attrs_index >= perf_data_.file_attrs_size()) { in Sample()
553 << sample.file_attrs_index; in Sample()
557 Pid event_pid = sample.sample.pid(); in Sample()
558 ProfileBuilder *builder = GetOrCreateBuilder(sample); in Sample()
559 SampleKey sample_key = MakeSampleKey(sample, builder); in Sample()
561 uint64 ip = sample.sample_mapping != nullptr ? sample.sample.ip() : 0; in Sample()
563 const auto start = sample.sample_mapping->start; in Sample()
564 const auto limit = sample.sample_mapping->limit; in Sample()
575 AddOrGetLocation(event_pid, ip, sample.sample_mapping, builder)); in Sample()
577 // LBR callstacks include only user call chains. If this is an LBR sample, in Sample()
578 // we get the kernel callstack from the sample's callchain, and the user in Sample()
579 // callstack from the sample's branch_stack. in Sample()
580 const bool lbr_sample = !sample.branch_stack.empty(); in Sample()
582 for (const auto& frame : sample.callchain) { in Sample()
613 for (const auto& frame : sample.branch_stack) { in Sample()
629 AddOrUpdateSample(sample, event_pid, sample_key, builder); in Sample()