linux-perf-0.3: Read files generated by perf on Linux

Portabilityghc
Stabilityexperimental
Maintainerflorbitous@gmail.com
Safe HaskellNone

Profiling.Linux.Perf.Types

Contents

Description

Types for representing the parsed contents of a perf.data file output the perf record command on Linux (Linux performance counter information).

There is an intentional close correspondence between the types in this module and the representation in the C implementation of perf.

Synopsis

Identifiers

newtype PID Source

Process ID.

Constructors

PID 

Fields

pid :: Word32
 

Instances

newtype TID Source

Thread ID.

Constructors

TID 

Fields

tid :: Word32
 

Instances

newtype EventID Source

Event ID. Not really an identity. This number is used to link an event to an event type. Multiple events can have the same EventID, which means they all have the same event type.

Constructors

EventID 

Fields

eventID :: Word64
 

newtype EventTypeID Source

Event type ID (magic unique number of an event type).

Constructors

EventTypeID 

Fields

eventTypeID :: Word64
 

Byte counters

newtype ByteCount64 Source

A 64 bit measurement in bytes. For example the size of an object, or an offset.

Constructors

ByteCount64 

Fields

byteCount64 :: Word64
 

newtype ByteCount32 Source

A 32 bit measurement in bytes. For example the size of an object, or an offset.

Constructors

ByteCount32 

Fields

byteCount32 :: Word32
 

newtype ByteCount16 Source

A 16 bit measurement in bytes. For example the size of an object, or an offset.

Constructors

ByteCount16 

Fields

byteCount16 :: Word16
 

Timestamps

newtype TimeStamp Source

Measurement of time passed in nanoseconds since a given point.

Constructors

TimeStamp 

Fields

timeStamp :: Word64
 

File structure

data FileSection Source

Corresponds with the perf_file_section struct in <perf source>/util/header.h

Constructors

FileSection 

Fields

sec_offset :: ByteCount64

File offset to the section.

sec_size :: ByteCount64

Size of the section in bytes.

Instances

data FileHeader Source

Corresponds with the perf_file_header struct in <perf source>/util/header.h

Constructors

FileHeader 

Fields

fh_size :: ByteCount64

Size of (this) header.

fh_attr_size :: ByteCount64

Size of one attribute section.

fh_attrs_offset :: ByteCount64

File offset to the attribute section.

fh_attrs_size :: ByteCount64

Size of the attribute section in bytes.

fh_data_offset :: ByteCount64

File offset to the data section.

fh_data_size :: ByteCount64

Size of the data section in bytes.

fh_event_offset :: ByteCount64

File offset to the event section.

fh_event_size :: ByteCount64

Size of the event section in bytes.

fh_adds_features :: [Word32]

Bitfield.

Instances

data FileAttr Source

Layout of event attribute and attribute ids.

Constructors

FileAttr 

Fields

fa_attr :: EventAttr

The attribute payload.

fa_ids_offset :: ByteCount64

File offset to the ids section.

fa_ids_size :: ByteCount64

Size of the ids section in bytes.

Instances

Event data

data Event Source

A Single event record.

Constructors

Event 

Fields

ev_header :: EventHeader

Information about the structure of the event.

ev_payload :: EventPayload

The event data.

Instances

data EventAttr Source

Corresponds with the perf_event_attr struct in include/linux/perf_event.h

Constructors

EventAttr 

Fields

ea_type :: EventSource

Major type: hardwaresoftwaretracepoint/etc. defined as enum perf_type_id in includelinuxperf_event.h

ea_size :: ByteCount32

Size of the attr structure, for fwd/bwd compat.

ea_config :: EventTypeID

Link to .event id of perf trace event type.

ea_sample_period_or_freq :: Word64

Number of events when a sample is generated if .freq is not set or frequency for sampling if .freq is set.

ea_sample_type :: SampleTypeBitMap

Information about what is stored in the sampling record.

ea_read_format :: Word64
 
ea_flags :: Word64
 
ea_wakeup_events_or_watermark :: Word32

Wakeup every n events or bytes before wakeup.

ea_bp_type :: Word32
 
ea_bp_addr_or_config1 :: Word64
 
ea_bp_len_or_config2 :: Word64
 

Instances

data EventHeader Source

Corresponds with the perf_event_header struct in <perf source>/util/perf_event.h

Instances

data EventPayload Source

Constructors

CommEvent 

Fields

eventPayload_pid :: PID

process id

eventPayload_tid :: TID

thread id

eventPayload_CommName :: ByteString

name of the application

MmapEvent 

Fields

eventPayload_pid :: PID

process id

eventPayload_tid :: TID

thread id

eventPayload_MmapStart :: Word64

start of memory range

eventPayload_MmapLen :: Word64

size of memory range

eventPayload_MmapPgoff :: Word64

page offset

eventPayload_MmapFilename :: ByteString

binary file using this range

ForkEvent 

Fields

eventPayload_pid :: PID

process id

eventPayload_ppid :: PID

parent proecess id

eventPayload_tid :: TID

thread id

eventPayload_ptid :: TID

parent thread id

eventPayload_time :: TimeStamp

timestamp

ExitEvent 

Fields

eventPayload_pid :: PID

process id

eventPayload_ppid :: PID

parent proecess id

eventPayload_tid :: TID

thread id

eventPayload_ptid :: TID

parent thread id

eventPayload_time :: TimeStamp

timestamp

LostEvent 
ReadEvent 
SampleEvent 
ThrottleEvent 
UnThrottleEvent 
UnknownEvent

An unrecognised event was encountered.

Event type information

data SampleFormat Source

Information about what is stored in a sample event.

data TraceEventType Source

Identity and printable name of an event type.

Constructors

TraceEventType 

Fields

te_event_id :: EventTypeID

This entry belongs to the perf event attr entry where .config has the same value as this id.

te_name :: ByteString
 

data EventAttrFlag Source

See struct perf_event_attr in linux/perf_event.h

Constructors

Disabled

off by default

Inherit

children inherit it

Pinned

must always be on PMU

Exclusive

only group on PMU

ExcludeUser

don't count user

ExcludeKernel

ditto kernel

ExcludeHV

ditto hypervisor

ExcludeIdle

don't count when idle

Mmap

include mmap data

Comm

include comm data

Freq

use freq, not period

InheritStat

per task counts

EnableOnExec

next exec enables

Task

trace fork/exit

WaterMark

wakeup_watermark

ArbitrarySkid

precise_ip, See also PERF_RECORD_MISC_EXACT_IP

ConstantSkid

precise_ip, See also PERF_RECORD_MISC_EXACT_IP

RequestedZeroSkid

precise_ip, See also PERF_RECORD_MISC_EXACT_IP

CompulsoryZeroSkid

precise_ip, See also PERF_RECORD_MISC_EXACT_IP

MmapData

non-exec mmap data

SampleIdAll

sample_type all events

newtype SampleTypeBitMap Source

A bitmap encoding information about the content of sample events.

Constructors

SampleTypeBitMap 

testEventAttrFlag :: Word64 -> EventAttrFlag -> BoolSource

Test if a given EventAttrFlag is set.

An abstract representation of the perf data file

data PerfData Source

The various parts of the perf.data file collected together.

Constructors

PerfData 

Fields

perfData_fileHeader :: FileHeader

File header explains the structure of the file.

perfData_attrs :: [FileAttr]

Common attributes of events.

perfData_idss :: [[EventID]]

Event identifiers to be associated with the event attributes.

perfData_types :: [TraceEventType]

Event type information.

perfData_events :: [Event]

The event payload.