Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/memlat/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ func parsePerf(fileName string) *database {
}
}

if err := rs.Err(); err != nil {
fmt.Printf("error while reading record: %s\n", err)
os.Exit(1)
}

if numSamples == 0 {
fmt.Printf("no memory latency samples in %s (did you use \"perf mem record\"?)\n", fileName)
os.Exit(1)
Expand Down
11 changes: 9 additions & 2 deletions perffile/records.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,18 @@ func (r *Records) Next() bool {

// Parse common sample_id fields
if r.f.sampleIDAll && hdr.Type != RecordTypeSample && hdr.Type < recordTypeUserStart {
// mmap records in the prologue don't have eventAttrs
// some records in the prologue don't have eventAttrs
// in recent perf versions, but that's okay.
//
// TODO: When is perf okay with missing eventAttrs?
r.parseCommon(bd, &common, hdr.Type == RecordTypeMmap)
missingOk := (hdr.Type == RecordTypeMmap) ||
(hdr.Type == RecordTypeFork) ||
(hdr.Type == RecordTypeComm) ||
(hdr.Type == recordTypeMmap2)
r.parseCommon(bd, &common, missingOk)
if r.err != nil {
return false
}
}

// Parse record
Expand Down