Lines Matching full:sample

348     const event_t& event, PerfDataProto_SampleEvent* sample) const {  in SerializeSampleEvent()
354 if (sample_type & PERF_SAMPLE_IP) sample->set_ip(sample_info.ip); in SerializeSampleEvent()
356 sample->set_pid(sample_info.pid); in SerializeSampleEvent()
357 sample->set_tid(sample_info.tid); in SerializeSampleEvent()
360 sample->set_sample_time_ns(sample_info.time); in SerializeSampleEvent()
361 if (sample_type & PERF_SAMPLE_ADDR) sample->set_addr(sample_info.addr); in SerializeSampleEvent()
363 sample->set_id(sample_info.id); in SerializeSampleEvent()
365 sample->set_stream_id(sample_info.stream_id); in SerializeSampleEvent()
366 if (sample_type & PERF_SAMPLE_CPU) sample->set_cpu(sample_info.cpu); in SerializeSampleEvent()
367 if (sample_type & PERF_SAMPLE_PERIOD) sample->set_period(sample_info.period); in SerializeSampleEvent()
368 if (sample_type & PERF_SAMPLE_RAW) sample->set_raw_size(sample_info.raw_size); in SerializeSampleEvent()
372 PerfDataProto_ReadInfo* read_info = sample->mutable_read_info(); in SerializeSampleEvent()
391 sample->mutable_callchain()->Reserve(sample_info.callchain->nr); in SerializeSampleEvent()
393 sample->add_callchain(sample_info.callchain->ips[i]); in SerializeSampleEvent()
397 sample->add_branch_stack(); in SerializeSampleEvent()
399 sample->mutable_branch_stack(i)->set_from_ip(entry.from); in SerializeSampleEvent()
400 sample->mutable_branch_stack(i)->set_to_ip(entry.to); in SerializeSampleEvent()
401 sample->mutable_branch_stack(i)->set_mispredicted(entry.flags.mispred); in SerializeSampleEvent()
405 if (sample_type & PERF_SAMPLE_WEIGHT) sample->set_weight(sample_info.weight); in SerializeSampleEvent()
407 sample->set_data_src(sample_info.data_src); in SerializeSampleEvent()
409 sample->set_transaction(sample_info.transaction); in SerializeSampleEvent()
415 const PerfDataProto_SampleEvent& sample, event_t* event) const { in DeserializeSampleEvent() argument
417 if (sample.has_ip()) sample_info.ip = sample.ip(); in DeserializeSampleEvent()
418 if (sample.has_pid()) { in DeserializeSampleEvent()
419 CHECK(sample.has_tid()) << "Cannot have PID without TID."; in DeserializeSampleEvent()
420 sample_info.pid = sample.pid(); in DeserializeSampleEvent()
421 sample_info.tid = sample.tid(); in DeserializeSampleEvent()
423 if (sample.has_sample_time_ns()) sample_info.time = sample.sample_time_ns(); in DeserializeSampleEvent()
424 if (sample.has_addr()) sample_info.addr = sample.addr(); in DeserializeSampleEvent()
425 if (sample.has_id()) sample_info.id = sample.id(); in DeserializeSampleEvent()
426 if (sample.has_stream_id()) sample_info.stream_id = sample.stream_id(); in DeserializeSampleEvent()
427 if (sample.has_cpu()) sample_info.cpu = sample.cpu(); in DeserializeSampleEvent()
428 if (sample.has_period()) sample_info.period = sample.period(); in DeserializeSampleEvent()
429 if (sample.has_read_info()) { in DeserializeSampleEvent()
432 const PerfDataProto_ReadInfo& read_info = sample.read_info(); in DeserializeSampleEvent()
455 if (sample.callchain_size() > 0) { in DeserializeSampleEvent()
456 uint64_t callchain_size = sample.callchain_size(); in DeserializeSampleEvent()
461 sample_info.callchain->ips[i] = sample.callchain(i); in DeserializeSampleEvent()
463 if (sample.raw_size() > 0) { in DeserializeSampleEvent()
464 sample_info.raw_size = sample.raw_size(); in DeserializeSampleEvent()
465 sample_info.raw_data = new uint8_t[sample.raw_size()]; in DeserializeSampleEvent()
466 memset(sample_info.raw_data, 0, sample.raw_size()); in DeserializeSampleEvent()
468 if (sample.branch_stack_size() > 0) { in DeserializeSampleEvent()
469 uint64_t branch_stack_size = sample.branch_stack_size(); in DeserializeSampleEvent()
477 entry.from = sample.branch_stack(i).from_ip(); in DeserializeSampleEvent()
478 entry.to = sample.branch_stack(i).to_ip(); in DeserializeSampleEvent()
479 entry.flags.mispred = sample.branch_stack(i).mispredicted(); in DeserializeSampleEvent()
484 if (sample.has_weight()) sample_info.weight = sample.weight(); in DeserializeSampleEvent()
485 if (sample.has_data_src()) sample_info.data_src = sample.data_src(); in DeserializeSampleEvent()
486 if (sample.has_transaction()) sample_info.transaction = sample.transaction(); in DeserializeSampleEvent()
488 const SampleInfoReader* writer = GetSampleInfoReaderForId(sample.id()); in DeserializeSampleEvent()
494 PerfDataProto_MMapEvent* sample) const { in SerializeMMapEvent()
496 sample->set_pid(mmap.pid); in SerializeMMapEvent()
497 sample->set_tid(mmap.tid); in SerializeMMapEvent()
498 sample->set_start(mmap.start); in SerializeMMapEvent()
499 sample->set_len(mmap.len); in SerializeMMapEvent()
500 sample->set_pgoff(mmap.pgoff); in SerializeMMapEvent()
501 sample->set_filename(mmap.filename); in SerializeMMapEvent()
502 sample->set_filename_md5_prefix(Md5Prefix(mmap.filename)); in SerializeMMapEvent()
504 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeMMapEvent()
507 bool PerfSerializer::DeserializeMMapEvent(const PerfDataProto_MMapEvent& sample, in DeserializeMMapEvent() argument
510 mmap.pid = sample.pid(); in DeserializeMMapEvent()
511 mmap.tid = sample.tid(); in DeserializeMMapEvent()
512 mmap.start = sample.start(); in DeserializeMMapEvent()
513 mmap.len = sample.len(); in DeserializeMMapEvent()
514 mmap.pgoff = sample.pgoff(); in DeserializeMMapEvent()
515 snprintf(mmap.filename, PATH_MAX, "%s", sample.filename().c_str()); in DeserializeMMapEvent()
517 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeMMapEvent()
521 const event_t& event, PerfDataProto_MMapEvent* sample) const { in SerializeMMap2Event()
523 sample->set_pid(mmap.pid); in SerializeMMap2Event()
524 sample->set_tid(mmap.tid); in SerializeMMap2Event()
525 sample->set_start(mmap.start); in SerializeMMap2Event()
526 sample->set_len(mmap.len); in SerializeMMap2Event()
527 sample->set_pgoff(mmap.pgoff); in SerializeMMap2Event()
528 sample->set_maj(mmap.maj); in SerializeMMap2Event()
529 sample->set_min(mmap.min); in SerializeMMap2Event()
530 sample->set_ino(mmap.ino); in SerializeMMap2Event()
531 sample->set_ino_generation(mmap.ino_generation); in SerializeMMap2Event()
532 sample->set_prot(mmap.prot); in SerializeMMap2Event()
533 sample->set_flags(mmap.flags); in SerializeMMap2Event()
534 sample->set_filename(mmap.filename); in SerializeMMap2Event()
535 sample->set_filename_md5_prefix(Md5Prefix(mmap.filename)); in SerializeMMap2Event()
537 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeMMap2Event()
541 const PerfDataProto_MMapEvent& sample, event_t* event) const { in DeserializeMMap2Event() argument
543 mmap.pid = sample.pid(); in DeserializeMMap2Event()
544 mmap.tid = sample.tid(); in DeserializeMMap2Event()
545 mmap.start = sample.start(); in DeserializeMMap2Event()
546 mmap.len = sample.len(); in DeserializeMMap2Event()
547 mmap.pgoff = sample.pgoff(); in DeserializeMMap2Event()
548 mmap.maj = sample.maj(); in DeserializeMMap2Event()
549 mmap.min = sample.min(); in DeserializeMMap2Event()
550 mmap.ino = sample.ino(); in DeserializeMMap2Event()
551 mmap.ino_generation = sample.ino_generation(); in DeserializeMMap2Event()
552 mmap.prot = sample.prot(); in DeserializeMMap2Event()
553 mmap.flags = sample.flags(); in DeserializeMMap2Event()
554 snprintf(mmap.filename, PATH_MAX, "%s", sample.filename().c_str()); in DeserializeMMap2Event()
556 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeMMap2Event()
560 PerfDataProto_CommEvent* sample) const { in SerializeCommEvent()
562 sample->set_pid(comm.pid); in SerializeCommEvent()
563 sample->set_tid(comm.tid); in SerializeCommEvent()
564 sample->set_comm(comm.comm); in SerializeCommEvent()
565 sample->set_comm_md5_prefix(Md5Prefix(comm.comm)); in SerializeCommEvent()
567 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeCommEvent()
570 bool PerfSerializer::DeserializeCommEvent(const PerfDataProto_CommEvent& sample, in DeserializeCommEvent() argument
573 comm.pid = sample.pid(); in DeserializeCommEvent()
574 comm.tid = sample.tid(); in DeserializeCommEvent()
575 snprintf(comm.comm, sizeof(comm.comm), "%s", sample.comm().c_str()); in DeserializeCommEvent()
583 GetSampleInfoReaderForId(sample.sample_info().id()); in DeserializeCommEvent()
590 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeCommEvent()
594 const event_t& event, PerfDataProto_ForkEvent* sample) const { in SerializeForkExitEvent()
596 sample->set_pid(fork.pid); in SerializeForkExitEvent()
597 sample->set_ppid(fork.ppid); in SerializeForkExitEvent()
598 sample->set_tid(fork.tid); in SerializeForkExitEvent()
599 sample->set_ptid(fork.ptid); in SerializeForkExitEvent()
600 sample->set_fork_time_ns(fork.time); in SerializeForkExitEvent()
602 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeForkExitEvent()
606 const PerfDataProto_ForkEvent& sample, event_t* event) const { in DeserializeForkExitEvent() argument
608 fork.pid = sample.pid(); in DeserializeForkExitEvent()
609 fork.ppid = sample.ppid(); in DeserializeForkExitEvent()
610 fork.tid = sample.tid(); in DeserializeForkExitEvent()
611 fork.ptid = sample.ptid(); in DeserializeForkExitEvent()
612 fork.time = sample.fork_time_ns(); in DeserializeForkExitEvent()
614 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeForkExitEvent()
618 PerfDataProto_LostEvent* sample) const { in SerializeLostEvent()
620 sample->set_id(lost.id); in SerializeLostEvent()
621 sample->set_lost(lost.lost); in SerializeLostEvent()
623 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeLostEvent()
626 bool PerfSerializer::DeserializeLostEvent(const PerfDataProto_LostEvent& sample, in DeserializeLostEvent() argument
629 lost.id = sample.id(); in DeserializeLostEvent()
630 lost.lost = sample.lost(); in DeserializeLostEvent()
632 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeLostEvent()
636 const event_t& event, PerfDataProto_ThrottleEvent* sample) const { in SerializeThrottleEvent()
638 sample->set_time_ns(throttle.time); in SerializeThrottleEvent()
639 sample->set_id(throttle.id); in SerializeThrottleEvent()
640 sample->set_stream_id(throttle.stream_id); in SerializeThrottleEvent()
642 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeThrottleEvent()
646 const PerfDataProto_ThrottleEvent& sample, event_t* event) const { in DeserializeThrottleEvent() argument
648 throttle.time = sample.time_ns(); in DeserializeThrottleEvent()
649 throttle.id = sample.id(); in DeserializeThrottleEvent()
650 throttle.stream_id = sample.stream_id(); in DeserializeThrottleEvent()
652 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeThrottleEvent()
656 PerfDataProto_ReadEvent* sample) const { in SerializeReadEvent()
658 sample->set_pid(read.pid); in SerializeReadEvent()
659 sample->set_tid(read.tid); in SerializeReadEvent()
660 sample->set_value(read.value); in SerializeReadEvent()
661 sample->set_time_enabled(read.time_enabled); in SerializeReadEvent()
662 sample->set_time_running(read.time_running); in SerializeReadEvent()
663 sample->set_id(read.id); in SerializeReadEvent()
668 bool PerfSerializer::DeserializeReadEvent(const PerfDataProto_ReadEvent& sample, in DeserializeReadEvent() argument
671 read.pid = sample.pid(); in DeserializeReadEvent()
672 read.tid = sample.tid(); in DeserializeReadEvent()
673 read.value = sample.value(); in DeserializeReadEvent()
674 read.time_enabled = sample.time_enabled(); in DeserializeReadEvent()
675 read.time_running = sample.time_running(); in DeserializeReadEvent()
676 read.id = sample.id(); in DeserializeReadEvent()
682 PerfDataProto_AuxEvent* sample) const { in SerializeAuxEvent()
684 sample->set_aux_offset(aux.aux_offset); in SerializeAuxEvent()
685 sample->set_aux_size(aux.aux_size); in SerializeAuxEvent()
686 sample->set_is_truncated(aux.flags & PERF_AUX_FLAG_TRUNCATED ? true : false); in SerializeAuxEvent()
687 sample->set_is_overwrite(aux.flags & PERF_AUX_FLAG_OVERWRITE ? true : false); in SerializeAuxEvent()
688 sample->set_is_partial(aux.flags & PERF_AUX_FLAG_PARTIAL ? true : false); in SerializeAuxEvent()
694 return SerializeSampleInfo(event, sample->mutable_sample_info()); in SerializeAuxEvent()
697 bool PerfSerializer::DeserializeAuxEvent(const PerfDataProto_AuxEvent& sample, in DeserializeAuxEvent() argument
700 aux.aux_offset = sample.aux_offset(); in DeserializeAuxEvent()
701 aux.aux_size = sample.aux_size(); in DeserializeAuxEvent()
702 aux.flags |= sample.is_truncated() ? PERF_AUX_FLAG_TRUNCATED : 0; in DeserializeAuxEvent()
703 aux.flags |= sample.is_overwrite() ? PERF_AUX_FLAG_OVERWRITE : 0; in DeserializeAuxEvent()
704 aux.flags |= sample.is_partial() ? PERF_AUX_FLAG_PARTIAL : 0; in DeserializeAuxEvent()
706 return DeserializeSampleInfo(sample.sample_info(), event); in DeserializeAuxEvent()
710 const event_t& event, PerfDataProto_SampleInfo* sample) const { in SerializeSampleInfo()
719 sample->set_pid(sample_info.pid); in SerializeSampleInfo()
720 sample->set_tid(sample_info.tid); in SerializeSampleInfo()
723 sample->set_sample_time_ns(sample_info.time); in SerializeSampleInfo()
725 sample->set_id(sample_info.id); in SerializeSampleInfo()
726 if (sample_type & PERF_SAMPLE_CPU) sample->set_cpu(sample_info.cpu); in SerializeSampleInfo()
728 sample->set_stream_id(sample_info.stream_id); in SerializeSampleInfo()
733 const PerfDataProto_SampleInfo& sample, event_t* event) const { in DeserializeSampleInfo() argument
737 if (sample.has_tid()) { in DeserializeSampleInfo()
738 sample_info.pid = sample.pid(); in DeserializeSampleInfo()
739 sample_info.tid = sample.tid(); in DeserializeSampleInfo()
741 if (sample.has_sample_time_ns()) sample_info.time = sample.sample_time_ns(); in DeserializeSampleInfo()
742 if (sample.has_id()) sample_info.id = sample.id(); in DeserializeSampleInfo()
743 if (sample.has_cpu()) sample_info.cpu = sample.cpu(); in DeserializeSampleInfo()
744 if (sample.has_stream_id()) sample_info.stream_id = sample.stream_id(); in DeserializeSampleInfo()
746 const SampleInfoReader* writer = GetSampleInfoReaderForId(sample.id()); in DeserializeSampleInfo()
823 const event_t& event, PerfDataProto_AuxtraceEvent* sample) const { in SerializeAuxtraceEvent()
825 sample->set_size(auxtrace.size); in SerializeAuxtraceEvent()
826 sample->set_offset(auxtrace.offset); in SerializeAuxtraceEvent()
827 sample->set_reference(auxtrace.reference); in SerializeAuxtraceEvent()
828 sample->set_idx(auxtrace.idx); in SerializeAuxtraceEvent()
829 sample->set_tid(auxtrace.tid); in SerializeAuxtraceEvent()
830 sample->set_cpu(auxtrace.cpu); in SerializeAuxtraceEvent()
846 const PerfDataProto_AuxtraceEvent& sample, event_t* event) const { in DeserializeAuxtraceEvent() argument
848 auxtrace.size = sample.size(); in DeserializeAuxtraceEvent()
849 auxtrace.offset = sample.offset(); in DeserializeAuxtraceEvent()
850 auxtrace.reference = sample.reference(); in DeserializeAuxtraceEvent()
851 auxtrace.idx = sample.idx(); in DeserializeAuxtraceEvent()
852 auxtrace.tid = sample.tid(); in DeserializeAuxtraceEvent()
853 auxtrace.cpu = sample.cpu(); in DeserializeAuxtraceEvent()
1088 event_id = event.sample.array[event_id_pos]; in GetSampleInfoReaderForEvent()
1090 // Pretend this is a sample event--ie, an array of u64. Find the length in GetSampleInfoReaderForEvent()
1091 // of the array. The sample id is at the end of the array, and in GetSampleInfoReaderForEvent()
1095 event_id = event.sample.array[event_end_pos - event_id_pos]; in GetSampleInfoReaderForEvent()