diff --git a/docs/C_C++_API.md b/docs/C_C++_API.md index d9782a6e145e264341f4fa20ed05dc6e12246f90..12b57ecb0fd30daba1e3a5d451a01947af9f09e0 100644 --- a/docs/C_C++_API.md +++ b/docs/C_C++_API.md @@ -20,7 +20,11 @@ * unsigned numCpu 采集cpu核的个数 * struct EvtAttr *evtAttr - 事件分组列表,和evtList搭配使用,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + 用于对各事件做单独属性定义的列表 + * groupId 事件分组ID,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + * period 如果PmuAttr中useFreq=True则为采样频率,否则为采样间隔 + * excludeUser 排除对用户态数据的采集 + * excludeKernel 排除对内核态数据的采集 * unsigned numGroup 参与分组的事件个数 * union @@ -157,7 +161,6 @@ * unsigned long event 事件ID * unsigned short lat 调度操作到执行操作的周期数 * unsigned short source 记录加载或存储操作的数据来源 - * unsigned short branchRecords brbe数据 * struct * unsigned long nr branchRecords的数量 * struct BranchSampleRecord *branchRecords branch指针数组 diff --git a/docs/Details_Usage.md b/docs/Details_Usage.md index 494ea73de265d66a96a87ca6de296ead0fb7e22c..80ec245ee76842e5af197bfa38ba6639039fa2e5 100644 --- a/docs/Details_Usage.md +++ b/docs/Details_Usage.md @@ -979,11 +979,11 @@ perf stat -e "{inst_retired,inst_spec,cycles}","{inst_retired,cycles}" char *evtList[5] = {"inst_retired", "inst_spec", "cycles", "inst_retired", "cycles"}; // 指定事件分组编号,前三个事件为一组,后两个事件为一组。设置groupId=-1表示对应事件不参与分组。 // 当事件数量numEvt超过指定事件分组数量numGroup时,超过分组数量的事件的groupId默认为-1,即不参与分组。 -EvtAttr groupId[5] = {1,1,1,2,2}; +EvtAttr attrList[5] = {{1},{1},{1},{2},{2}}; PmuAttr attr = {0}; attr.evtList = evtList; attr.numEvt = 5; -attr.evtAttr = groupId; +attr.evtAttr = attrList; attr.numGroup = 5; int pd = PmuOpen(COUNTING, &attr); PmuEnable(pd); @@ -1010,7 +1010,7 @@ from collections import defaultdict evtList = ["inst_retired", "inst_spec", "cycles", "inst_retired", "cycles"] # 指定事件分组编号,前三个事件为一组,后两个事件为一组。 -evtAttrList = [1,1,1,2,2] +evtAttrList = [kperf.EvtAttr(1),kperf.EvtAttr(1),kperf.EvtAttr(1),kperf.EvtAttr(2),kperf.EvtAttr(2)] pmu_attr = kperf.PmuAttr(evtList=evtList, evtAttr = evtAttrList) pd = kperf.open(kperf.PmuTaskType.COUNTING, pmu_attr) kperf.enable(pd) @@ -1036,7 +1036,7 @@ import "time" func main() { evtList := []string{"inst_retired", "inst_spec", "cycles", "inst_retired", "cycles"} - evtAttrList := []int{1,1,1,2,2} + evtAttrList := []kperf.EvtAttr{kperf.EvtAttr{1,0,false,false},kperf.EvtAttr{1,0,false,false},kperf.EvtAttr{1,0,false,false},kperf.EvtAttr{2,0,false,false},kperf.EvtAttr{2,0,false,false}} attr := kperf.PmuAttr{EvtList: evtList, EvtAttr: evtAttrList} pd, err := kperf.PmuOpen(kperf.COUNT, attr) if err != nil { diff --git a/docs/Go_API.md b/docs/Go_API.md index 6f471d02d284404d78e427058e386dfba628ed76..d989f2094f68a1a0962d4dbb62a37a33973fd2a1 100644 --- a/docs/Go_API.md +++ b/docs/Go_API.md @@ -16,8 +16,12 @@ func PmuOpen(collectType C.enum_PmuTaskType, attr PmuAttr) (int, error) 采集的进程id列表 * CpuList []int 指定的使用cpu核采集列表,默认采集所有逻辑核 - * EvtAttr []int - 事件分组列表,和evtList搭配使用,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + * EvtAttr []EvtAttr + 用于对各事件做单独属性定义 + * GroupId 事件分组ID,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + * Period 如果PmuAttr中useFreq=True则为采样频率,否则为采样间隔 + * ExcludeUser 排除对用户态数据的采集 + * ExcludeKernel 排除对内核态数据的采集 * SampleRate uint32 采样频率,可通过/proc/sys/kernel/perf_event_max_sample_rate调整最大的采样频率 * UseFreq bool diff --git a/docs/Python_API.md b/docs/Python_API.md index cdccfb6dc9af838b59133fd5e923029fd54b3896..6a2760e8a606a2653c696a0e02d7885a4449813c 100644 --- a/docs/Python_API.md +++ b/docs/Python_API.md @@ -17,7 +17,11 @@ kperf.open(collector_type: kperf.PmuTaskType, pmu_attr: kperf.PmuAttr) * cpuList 指定的使用cpu核采集列表,默认采集所有逻辑核 * evtAttr - 事件分组列表,和evtList搭配使用,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + 用于对各事件做单独属性定义 + * groupId 事件分组ID,同组事件需要使用相同数字表示,不同组事件使用不同的数字代表,如果数字为-1,则不参与事件分组 + * period 如果PmuAttr中useFreq=True则为采样频率,否则为采样间隔 + * excludeUser 排除对用户态数据的采集 + * excludeKernel 排除对内核态数据的采集 * sampleRate 采样频率,可通过/proc/sys/kernel/perf_event_max_sample_rate调整最大的采样频率 * useFreq