diff --git a/README.md b/README.md index b8c11fa..7755cfe 100644 --- a/README.md +++ b/README.md @@ -69,39 +69,41 @@ Customize path to pcm executable is also possible by setting environment variabl To learn more about Intel PCM visit http://www.intel.com/software/pcm ### Collected Metrics -This plugin has the ability to gather the following metrics: - -Namespace | Description ------------- | ------------- -/intel/pcm/ACYC| Number of clockticks. This takes turbo and power saving modes into account. -/intel/pcm/AFREQ| Frequency relative to nominal CPU frequency excluding the time when the CPU is sleeping. -/intel/pcm/C0res%| Core 0 residency -/intel/pcm/C1res%| Core 1 residency -/intel/pcm/C2res%| Core 2 residency -/intel/pcm/C3res%| Core 3 residency -/intel/pcm/Cres%| Cores residency -/intel/pcm/EXEC| Instructions per nominal CPU cycle, i.e. in respect to the CPU frequency ignoring turbo and power saving. -/intel/pcm/FREQ| Frequency relative to nominal CPU frequency, equals clockticks/invariant_timer_ticks. -/intel/pcm/INST| Number of instructions retired -/intel/pcm/INSTnom| Instructions per nominal cycle multiplied by number of threads per core. -/intel/pcm/INSTnom%| Instructions per nominal cycle multiplied by number of threads per core relative to maximum IPC. The maximum IPC is 2 for Atom and 4 for all other supported processors. -/intel/pcm/IPC| Instructions per cycle, this measures how effectively you are using the core. -/intel/pcm/L2CLK| Very rough estimate of cycles lost to L2 cache misses vs. clockticks. -/intel/pcm/L2HIT| L2 cache hit ratio (0.00-1.00) -/intel/pcm/L2MISS| L2 cache line misses -/intel/pcm/L2MPI| L2 cache misses per instruction -/intel/pcm/L3CLK| Very rough estimate of cycles lost to L3 cache misses vs. clockticks. -/intel/pcm/L3HIT| L3 cache hit ratio (0.00-1.00) -/intel/pcm/L3MISS| L3 cache line misses -/intel/pcm/L3MPI| L3 cache misses per instruction -/intel/pcm/PhysIPC| Instructions per cycle (IPC) multiplied by number of threads per core. -/intel/pcm/PhysIPC%| Instructions per cycle (IPC) multiplied by number of threads per core relative to maximum IPC. -/intel/pcm/Proc_Energy_Joules| The energy consumed by the processor in Joules. Divide by the time to get the power consumption in watt -/intel/pcm/READ| Bytes read from memory controller in GBytes. -/intel/pcm/SKT0| CPU energy in Joules per socket 0 -/intel/pcm/TEMP| Temperature reading in degree Celsius relative to the TjMax temperature (thermal headroom; max_design_temp - current_temp) -/intel/pcm/TIME_ticks| Number of invariant clockticks. This is invariant to turbo and power saving modes. -/intel/pcm/WRITE| Bytes written to memory controller in GBytes. +This plugin has the ability to gather metrics for various components (like system, particular socket, dram etc.). Namespaces are constructed using following rule `/intel/pcm/[component name]/[metric name]` + +Here are abbreviations for metric names [source](https://software.intel.com/en-us/blogs/2014/07/18/intel-pcm-column-names-decoder-ring): + +The following metrics are available on all levels: + +Namespace | Description +----------- | -------------- +/intel/pcm/[Component]/EXEC | Instructions per nominal CPU cycle, i.e. in respect to the CPU frequency ignoring turbo and power saving +/intel/pcm/[Component]/IPC | Instructions per cycle. This measures how effectively you are using the core. +/intel/pcm/[Component]/FREQ | Frequency relative to nominal CPU frequency (“clockticks”/”invariant timer ticks”) +/intel/pcm/[Component]/AFREQ | Frequency relative to nominal CPU frequency excluding the time when the CPU is sleeping +/intel/pcm/[Component]/L3MISS | L3 cache line misses in millions +/intel/pcm/[Component]/L2MISS | L2 cache line misses in millions +/intel/pcm/[Component]/L3HIT | L3 Cache hit ratio (hits/reference) +/intel/pcm/[Component]/L2HIT | L2 Cache hit ratio (hits/reference) +/intel/pcm/[Component]/L3CLK | Very rough estimate of cycles lost to L3 cache misses vs. clockticks +/intel/pcm/[Component]/L2CLK | Very rough estimate of cycles lost to L2 cache misses vs. clockticks +/intel/pcm/[Component]/READ | Memory read traffic on this socket in GB +/intel/pcm/[Component]/WRITE | Memory write traffic on this socket in GB +/intel/pcm/[Component]/C[CoreNumber]res | Core residency +/intel/pcm/[Socket]/Proc_Energy_Joules | The energy consumed by the processor in Joules. Divide by the time to get the power consumption in watt +/intel/pcm/[Socket]/DRAM_Energy_Joules | The energy consumed by the DRAM attached to this socket in Joules. Divide by the time to get the power consumption in watt +/intel/pcm/[Socket]/TEMP | Thermal headroom in Kelvin (max design temperature – current temperature) +/intel/pcm/[System]/INST | Number of instructions retired +/intel/pcm/[System]/ACYC | Number of clockticks, This takes turbo and power saving modes into account. +/intel/pcm/[System]/TIME_ticks | Number of invariant clockticks. This is invariant to turbo and power saving modes. +/intel/pcm/[System]/PhysIPC | Instructions per cycle (IPC) multiplied by number of threads per core. See section "Core Cycles-per-Instruction (CPI) and Thread CPI" in Performance Insights to Intel® Hyper-Threading Technology for some background information. +/intel/pcm/[System]/PhysIPC% | Instructions per cycle (IPC) multiplied by number of threads per core relative to maximum IPC +/intel/pcm/[System]/INSTnom | Instructions per nominal cycle multiplied by number of threads per core +/intel/pcm/[System]/INSTnom% | Instructions per nominal cycle multiplied by number of threads per core relative to maximum IPC. The maximum IPC is 2 for Atom and 4 for all other supported processors. +/intel/pcm/[System]/TotalQPIin | QPI data traffic estimation (data traffic coming to CPU/socket through QPI links) in MB (1024*1024) +/intel/pcm/[System]/QPItoMC | Ratio of QPI traffic to memory traffic +/intel/pcm/[System]/TotalQPIout | QPI traffic estimation (data and non-data traffic outgoing from CPU/socket through QPI links) in MB (1024*1024) + Metrics exposed by "pcm" are system related and might be varied. @@ -139,30 +141,7 @@ Create a task JSON file (exemplary file in examples/tasks/pcm-file.json): "workflow": { "collect": { "metrics": { - "/intel/pcm/IPC": {}, - "/intel/pcm/L2HIT": {}, - "/intel/pcm/L2MISS": {}, - "/intel/pcm/EXEC": {}, - "/intel/pcm/FREQ": {}, - "/intel/pcm/INST": {}, - "/intel/pcm/INSTnom": {}, - "/intel/pcm/INSTnom%": {}, - "/intel/pcm/L3HIT": {}, - "/intel/pcm/L3MISS": {}, - "/intel/pcm/PhysIPC": {}, - "/intel/pcm/PhysIPC%": {}, - "/intel/pcm/Proc_Energy_Joules": {}, - "/intel/pcm/READ": {}, - "/intel/pcm/SKT0": {}, - "/intel/pcm/TEMP": {}, - "/intel/pcm/TIME_ticks": {}, - "/intel/pcm/WRITE": {} - }, - "config": { - "/intel/pcm": { - "user": "root", - "password": "secret" - } + "/intel/pcm/*": {} }, "process": null, "publish": [ @@ -183,36 +162,76 @@ Create a task: snaptel task create -t examples/tasks/pcm-file.json Using task manifest to create task Task created -ID: 156366f2-e497-4c10-ad22-560fc71986af -Name: Task-156366f2-e497-4c10-ad22-560fc71986af +ID: 44c01cd0-7133-49b1-a95c-a444db064b40 +Name: Task-44c01cd0-7133-49b1-a95c-a444db064b40 State: Running ``` See sample output from `snaptel task watch ` ``` -$ snaptel task watch 156366f2-e497-4c10-ad22-560fc71986af - -Watching Task (156366f2-e497-4c10-ad22-560fc71986af): -NAMESPACE DATA TIMESTAMP SOURCE -/intel/pcm/EXEC 0.0138 2015-12-02 08:19:46.001151927 -0500 EST gklab-108-166 -/intel/pcm/FREQ 0.00639 2015-12-02 08:19:46.001150464 -0500 EST gklab-108-166 -/intel/pcm/INST 379 2015-12-02 08:19:46.001150975 -0500 EST gklab-108-166 -/intel/pcm/INSTnom 0.0276 2015-12-02 08:19:46.001147704 -0500 EST gklab-108-166 -/intel/pcm/INSTnom% 0.691 2015-12-02 08:19:46.001148234 -0500 EST gklab-108-166 -/intel/pcm/IPC 2.16 2015-12-02 08:19:46.001148772 -0500 EST gklab-108-166 -/intel/pcm/L2HIT 0.483 2015-12-02 08:19:46.00114933 -0500 EST gklab-108-166 -/intel/pcm/L2MISS 0.719 2015-12-02 08:19:46.001151493 -0500 EST gklab-108-166 -/intel/pcm/L3HIT 0.423 2015-12-02 08:19:46.001152449 -0500 EST gklab-108-166 -/intel/pcm/L3MISS 0.415 2015-12-02 08:19:46.001144495 -0500 EST gklab-108-166 -/intel/pcm/PhysIPC 4.33 2015-12-02 08:19:46.001145292 -0500 EST gklab-108-166 -/intel/pcm/PhysIPC% 108 2015-12-02 08:19:46.001149828 -0500 EST gklab-108-166 -/intel/pcm/Proc_Energy_Joules 8.46 2015-12-02 08:19:46.001145857 -0500 EST gklab-108-166 -/intel/pcm/READ 0.084 2015-12-02 08:19:46.00114662 -0500 EST gklab-108-166 -/intel/pcm/SKT0 8.46 2015-12-02 08:19:46.001152938 -0500 EST gklab-108-166 -/intel/pcm/TEMP 70 2015-12-02 08:19:46.001153401 -0500 EST gklab-108-166 -/intel/pcm/TIME_ticks 3430 2015-12-02 08:19:46.001153955 -0500 EST gklab-108-166 -/intel/pcm/WRITE 0.0563 2015-12-02 08:19:46.00114718 -0500 EST gklab-108-166 +$ snaptel task watch 44c01cd0-7133-49b1-a95c-a444db064b40 + +Watching Task (44c01cd0-7133-49b1-a95c-a444db064b40): +NAMESPACE DATA TIMESTAMP +/intel/pcm/SKT0_Core_C-State/C0res% 1.13 2017-04-18 14:52:05.410848537 +0200 CEST +/intel/pcm/SKT0_Core_C-State/C1res% 26 2017-04-18 14:52:05.410835819 +0200 CEST +/intel/pcm/SKT0_Core_C-State/C3res% 0.00878 2017-04-18 14:52:05.410855565 +0200 CEST +/intel/pcm/SKT0_Core_C-State/C6res% 0.361 2017-04-18 14:52:05.410829547 +0200 CEST +/intel/pcm/SKT0_Core_C-State/C7res% 72.5 2017-04-18 14:52:05.410842087 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C10res% 0 2017-04-18 14:52:05.41061602 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C2res% 26.6 2017-04-18 14:52:05.410630665 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C3res% 0 2017-04-18 14:52:05.410623662 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C6res% 0 2017-04-18 14:52:05.410660845 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C7res% 0 2017-04-18 14:52:05.410637857 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C8res% 0 2017-04-18 14:52:05.410644744 +0200 CEST +/intel/pcm/SKT0_Package_C-State/C9res% 0 2017-04-18 14:52:05.410653227 +0200 CEST +/intel/pcm/Socket0/AFREQ 0.383 2017-04-18 14:52:05.410772622 +0200 CEST +/intel/pcm/Socket0/EXEC 0.005 2017-04-18 14:52:05.410818398 +0200 CEST +/intel/pcm/Socket0/FREQ 0.00432 2017-04-18 14:52:05.410797095 +0200 CEST +/intel/pcm/Socket0/IPC 1.16 2017-04-18 14:52:05.410767806 +0200 CEST +/intel/pcm/Socket0/L2HIT 0.57 2017-04-18 14:52:05.410782617 +0200 CEST +/intel/pcm/Socket0/L2MISS 0.472 2017-04-18 14:52:05.410802963 +0200 CEST +/intel/pcm/Socket0/L2MPI 0.00346 2017-04-18 14:52:05.410823254 +0200 CEST +/intel/pcm/Socket0/L3HIT 0.719 2017-04-18 14:52:05.410787351 +0200 CEST +/intel/pcm/Socket0/L3MISS 0.12 2017-04-18 14:52:05.410813474 +0200 CEST +/intel/pcm/Socket0/L3MPI 0.00088 2017-04-18 14:52:05.410763201 +0200 CEST +/intel/pcm/Socket0/READ 0.651 2017-04-18 14:52:05.410777707 +0200 CEST +/intel/pcm/Socket0/TEMP 68 2017-04-18 14:52:05.410807757 +0200 CEST +/intel/pcm/Socket0/WRITE 0.0908 2017-04-18 14:52:05.410792212 +0200 CEST +/intel/pcm/System/ACYC 118 2017-04-18 14:52:05.410506608 +0200 CEST +/intel/pcm/System/AFREQ 0.383 2017-04-18 14:52:05.410534795 +0200 CEST +/intel/pcm/System/EXEC 0.005 2017-04-18 14:52:05.410603378 +0200 CEST +/intel/pcm/System/FREQ 0.00432 2017-04-18 14:52:05.410567768 +0200 CEST +/intel/pcm/System/INST 136 2017-04-18 14:52:05.410524764 +0200 CEST +/intel/pcm/System/INSTnom 0.01 2017-04-18 14:52:05.410587925 +0200 CEST +/intel/pcm/System/INSTnom% 0.25 2017-04-18 14:52:05.410558073 +0200 CEST +/intel/pcm/System/IPC 1.16 2017-04-18 14:52:05.410501595 +0200 CEST +/intel/pcm/System/L2HIT 0.57 2017-04-18 14:52:05.410539947 +0200 CEST +/intel/pcm/System/L2MISS 0.472 2017-04-18 14:52:05.410598547 +0200 CEST +/intel/pcm/System/L2MPI 0.00346 2017-04-18 14:52:05.410578095 +0200 CEST +/intel/pcm/System/L3HIT 0.719 2017-04-18 14:52:05.410582892 +0200 CEST +/intel/pcm/System/L3MISS 0.12 2017-04-18 14:52:05.410496412 +0200 CEST +/intel/pcm/System/L3MPI 0.00088 2017-04-18 14:52:05.410593533 +0200 CEST +/intel/pcm/System/PhysIPC 2.32 2017-04-18 14:52:05.410563088 +0200 CEST +/intel/pcm/System/PhysIPC% 57.9 2017-04-18 14:52:05.410490594 +0200 CEST +/intel/pcm/System/READ 0.651 2017-04-18 14:52:05.410572346 +0200 CEST +/intel/pcm/System/TIME_ticks 3410 2017-04-18 14:52:05.410608886 +0200 CEST +/intel/pcm/System/WRITE 0.0908 2017-04-18 14:52:05.410529645 +0200 CEST +/intel/pcm/System_Core_C-States/C0res% 1.13 2017-04-18 14:52:05.410731258 +0200 CEST +/intel/pcm/System_Core_C-States/C1res% 26 2017-04-18 14:52:05.410723708 +0200 CEST +/intel/pcm/System_Core_C-States/C3res% 0.00878 2017-04-18 14:52:05.41075228 +0200 CEST +/intel/pcm/System_Core_C-States/C6res% 0.361 2017-04-18 14:52:05.410738707 +0200 CEST +/intel/pcm/System_Core_C-States/C7res% 72.5 2017-04-18 14:52:05.410745516 +0200 CEST +/intel/pcm/System_Pack_C-States/C10res% 0 2017-04-18 14:52:05.410696658 +0200 CEST +/intel/pcm/System_Pack_C-States/C2res% 26.6 2017-04-18 14:52:05.410716662 +0200 CEST +/intel/pcm/System_Pack_C-States/C3res% 0 2017-04-18 14:52:05.410667741 +0200 CEST +/intel/pcm/System_Pack_C-States/C6res% 0 2017-04-18 14:52:05.410674519 +0200 CEST +/intel/pcm/System_Pack_C-States/C7res% 0 2017-04-18 14:52:05.410703432 +0200 CEST +/intel/pcm/System_Pack_C-States/C8res% 0 2017-04-18 14:52:05.410689679 +0200 CEST +/intel/pcm/System_Pack_C-States/C9res% 0 2017-04-18 14:52:05.410709942 +0200 CEST +/intel/pcm/System_Pack_C-States/Proc_Energy_Joules 3.07 2017-04-18 14:52:05.410682756 +0200 CEST + ``` (Keys `ctrl+c` terminate task watcher) @@ -220,9 +239,9 @@ These data are published to file and stored there (in this example in /tmp/publi Stop task: ``` -$ snaptel task stop 156366f2-e497-4c10-ad22-560fc71986af +$ snaptel task stop 44c01cd0-7133-49b1-a95c-a444db064b40 Task stopped: -ID: 156366f2-e497-4c10-ad22-560fc71986af +ID: 44c01cd0-7133-49b1-a95c-a444db064b40 ``` ### Roadmap diff --git a/examples/tasks/pcm-file.json b/examples/tasks/pcm-file.json index 978dc45..7521d45 100644 --- a/examples/tasks/pcm-file.json +++ b/examples/tasks/pcm-file.json @@ -7,22 +7,7 @@ "workflow": { "collect": { "metrics": { - "/intel/pcm/IPC": {}, - "/intel/pcm/L2HIT": {}, - "/intel/pcm/L2MISS": {}, - "/intel/pcm/EXEC": {}, - "/intel/pcm/FREQ": {}, - "/intel/pcm/INST": {}, - "/intel/pcm/INSTnom": {}, - "/intel/pcm/INSTnom%": {}, - "/intel/pcm/L3HIT": {}, - "/intel/pcm/L3MISS": {}, - "/intel/pcm/PhysIPC": {}, - "/intel/pcm/PhysIPC%": {}, - "/intel/pcm/READ": {}, - "/intel/pcm/TEMP": {}, - "/intel/pcm/TIME_ticks": {}, - "/intel/pcm/WRITE": {} + "/intel/pcm/*": {} }, "config": {}, "process": null, diff --git a/examples/tasks/pcm-influxdb.json b/examples/tasks/pcm-influxdb.json index 2e8ce63..1f602e4 100644 --- a/examples/tasks/pcm-influxdb.json +++ b/examples/tasks/pcm-influxdb.json @@ -7,22 +7,7 @@ "workflow": { "collect": { "metrics": { - "/intel/pcm/IPC": {}, - "/intel/pcm/L2HIT": {}, - "/intel/pcm/L2MISS": {}, - "/intel/pcm/EXEC": {}, - "/intel/pcm/FREQ": {}, - "/intel/pcm/INST": {}, - "/intel/pcm/INSTnom": {}, - "/intel/pcm/INSTnom%": {}, - "/intel/pcm/L3HIT": {}, - "/intel/pcm/L3MISS": {}, - "/intel/pcm/PhysIPC": {}, - "/intel/pcm/PhysIPC%": {}, - "/intel/pcm/READ": {}, - "/intel/pcm/TEMP": {}, - "/intel/pcm/TIME_ticks": {}, - "/intel/pcm/WRITE": {} + "/intel/pcm/*": {} }, "config": {}, "process": null, diff --git a/pcm/pcm.go b/pcm/pcm.go index dcd53f0..f26bb1d 100644 --- a/pcm/pcm.go +++ b/pcm/pcm.go @@ -44,11 +44,13 @@ const ( // Name of plugin name = "pcm" // Version of plugin - version = 10 + version = 11 // Type of plugin pluginType = plugin.CollectorPluginType ) +var fieldsToSkip = 2 + func Meta() *plugin.PluginMeta { return plugin.NewPluginMeta(name, version, pluginType, []string{plugin.SnapGOBContentType}, []string{plugin.SnapGOBContentType}) } @@ -182,20 +184,30 @@ func (pcm *PCM) parse(reader io.Reader) { // read the data from stdout scanner := bufio.NewScanner(reader) first := true + header := []string{} for scanner.Scan() { if first { first = false + currentKey := "" + keys := strings.Split(strings.TrimSuffix(scanner.Text(), ";"), ";") + for _, key := range keys { + if key != "" { + currentKey = key + } + header = append(header, currentKey) + } continue } if len(pcm.keys) == 0 { pcm.mutex.Lock() keys := strings.Split(strings.TrimSuffix(scanner.Text(), ";"), ";") //skip the date and time fields - pcm.keys = make([]string, len(keys[2:])) - for i, k := range keys[2:] { + pcm.keys = make([]string, len(keys[fieldsToSkip:])) + for i, k := range keys[fieldsToSkip:] { // removes all spaces from metric key metricKey := ns.ReplaceNotAllowedCharsInNamespacePart(k) - pcm.keys[i] = fmt.Sprintf("/intel/pcm/%s", metricKey) + metricComponent := ns.ReplaceNotAllowedCharsInNamespacePart(header[i+fieldsToSkip]) + pcm.keys[i] = fmt.Sprintf("/intel/pcm/%s/%s", metricComponent, metricKey) } pcm.mutex.Unlock() continue @@ -203,7 +215,7 @@ func (pcm *PCM) parse(reader io.Reader) { pcm.mutex.Lock() datal := strings.Split(strings.TrimSuffix(scanner.Text(), ";"), ";") - for i, d := range datal[2:] { + for i, d := range datal[fieldsToSkip:] { v, err := strconv.ParseFloat(strings.TrimSpace(d), 64) if err == nil { pcm.data[pcm.keys[i]] = v diff --git a/pcm/pcm_test.go b/pcm/pcm_test.go index 4ab58be..4aef6cf 100644 --- a/pcm/pcm_test.go +++ b/pcm/pcm_test.go @@ -32,36 +32,70 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -var mockCmdOut = `System;;;;;;;;;;;;;;;;;;;;;System Core C-States;;;;System Pack C-States;;;Socket0;;;;;;;;;;;;;SKT0 Core C-State;;;;SKT0 Package C-State;;; -Date;Time;EXEC;IPC;FREQ;AFREQ;L3MISS;L2MISS;L3HIT;L2HIT;L3MPI;L2MPI;READ;WRITE;INST;ACYC;TIME(ticks);PhysIPC;PhysIPC%;INSTnom;INSTnom%;C0res%;C1res%;C3res%;C6res%;C3res%;C6res%;C7res%;EXEC;IPC;FREQ;AFREQ;L3MISS;L2MISS;L3HIT;L2HIT;L3MPI;L2MPI;READ;WRITE;TEMP;C0res%;C1res%;C3res%;C6res%;C3res%;C6res%;C7res%; -2016-11-02;14:10:27.600;0.0175;1.13;0.0155;0.84;0.0925;0.617;0.85;0.335;0.000237;0.00158;0.0361;0.0157;391;347;2.8e+03;2.26;56.4;0.0349;0.873;1.85;2.13;1.14;94.9;0.382;76.6;0;0.0175;1.13;0.0155;0.84;0.0925;0.617;0.85;0.335;0.000237;0.00158;0.0361;0.0157;N/A;1.85;2.13;1.14;94.9;0.382;76.6;0; +var mockCmdOut = `System;;;;;;;;;;;;;;;;;;;;;System Core C-States;;;;;System Pack C-States;;;;;;;;Socket0;;;;;;;;;;;;;SKT0 Core C-State;;;;;SKT0 Package C-State;;;;;;;Proc Energy (Joules); +Date;Time;EXEC;IPC;FREQ;AFREQ;L3MISS;L2MISS;L3HIT;L2HIT;L3MPI;L2MPI;READ;WRITE;INST;ACYC;TIME(ticks);PhysIPC;PhysIPC%;INSTnom;INSTnom%;C0res%;C1res%;C3res%;C6res%;C7res%;C2res%;C3res%;C6res%;C7res%;C8res%;C9res%;C10res%;Proc Energy (Joules);EXEC;IPC;FREQ;AFREQ;L3MISS;L2MISS;L3HIT;L2HIT;L3MPI;L2MPI;READ;WRITE;TEMP;C0res%;C1res%;C3res%;C6res%;C7res%;C2res%;C3res%;C6res%;C7res%;C8res%;C9res%;C10res%;SKT0; +2017-04-14;13:52:31.359;0.00245;0.589;0.00415;0.262;0.249;0.666;0.613;0.439;0.00372;0.00997;0.761;0.134;66.8;113;3.41e+03;1.18;29.5;0.0049;0.122;1.59;12.6;0.0181;1.64;84.1;50.1;0;0;0;0;0;0;2.37;0.00245;0.589;0.00415;0.262;0.249;0.666;0.613;0.439;0.00372;0.00997;0.761;0.134;69;1.59;12.6;0.0181;1.64;84.1;50.1;0;0;0;0;0;0;2.37; ` var refMap = map[string]float64{ - "/intel/pcm/L3MPI": 0.000237, - "/intel/pcm/INST": 391, - "/intel/pcm/ACYC": 347, - "/intel/pcm/PhysIPC%": 56.4, - "/intel/pcm/C0res%": 1.85, - "/intel/pcm/C6res%": 76.6, - "/intel/pcm/EXEC": 0.0175, - "/intel/pcm/L2MISS": 0.617, - "/intel/pcm/C7res%": 0, - "/intel/pcm/AFREQ": 0.84, - "/intel/pcm/L3HIT": 0.85, - "/intel/pcm/L2MPI": 0.00158, - "/intel/pcm/READ": 0.0361, - "/intel/pcm/WRITE": 0.0157, - "/intel/pcm/TIME_ticks": 2800, - "/intel/pcm/INSTnom%": 0.873, - "/intel/pcm/IPC": 1.13, - "/intel/pcm/L3MISS": 0.0925, - "/intel/pcm/PhysIPC": 2.26, - "/intel/pcm/INSTnom": 0.0349, - "/intel/pcm/C1res%": 2.13, - "/intel/pcm/C3res%": 0.382, - "/intel/pcm/FREQ": 0.0155, - "/intel/pcm/L2HIT": 0.335, + "/intel/pcm/System/L2MPI": 0.00997, + "/intel/pcm/SKT0_Core_C-State/C7res%": 84.1, + "/intel/pcm/SKT0_Package_C-State/C3res%": 0, + "/intel/pcm/System/FREQ": 0.00415, + "/intel/pcm/System_Pack_C-States/Proc_Energy_Joules": 2.37, + "/intel/pcm/System/IPC": 0.589, + "/intel/pcm/System/INSTnom%": 0.122, + "/intel/pcm/Socket0/FREQ": 0.00415, + "/intel/pcm/Socket0/L3MISS": 0.249, + "/intel/pcm/System/AFREQ": 0.262, + "/intel/pcm/Socket0/L2HIT": 0.439, + "/intel/pcm/System/ACYC": 113, + "/intel/pcm/Socket0/IPC": 0.589, + "/intel/pcm/Proc_Energy_Joules/SKT0": 2.37, + "/intel/pcm/System_Core_C-States/C3res%": 0.0181, + "/intel/pcm/SKT0_Core_C-State/C1res%": 12.6, + "/intel/pcm/System/INSTnom": 0.0049, + "/intel/pcm/System_Core_C-States/C6res%": 1.64, + "/intel/pcm/System_Pack_C-States/C2res%": 50.1, + "/intel/pcm/Socket0/L3MPI": 0.00372, + "/intel/pcm/SKT0_Core_C-State/C6res%": 1.64, + "/intel/pcm/System_Pack_C-States/C3res%": 0, + "/intel/pcm/SKT0_Core_C-State/C3res%": 0.0181, + "/intel/pcm/System_Pack_C-States/C6res%": 0, + "/intel/pcm/System_Pack_C-States/C8res%": 0, + "/intel/pcm/Socket0/WRITE": 0.134, + "/intel/pcm/SKT0_Package_C-State/C7res%": 0, + "/intel/pcm/SKT0_Package_C-State/C10res%": 0, + "/intel/pcm/System/READ": 0.761, + "/intel/pcm/System/PhysIPC": 1.18, + "/intel/pcm/Socket0/AFREQ": 0.262, + "/intel/pcm/Socket0/L3HIT": 0.613, + "/intel/pcm/Socket0/READ": 0.761, + "/intel/pcm/System/L3HIT": 0.613, + "/intel/pcm/System_Pack_C-States/C7res%": 0, + "/intel/pcm/Socket0/L2MPI": 0.00997, + "/intel/pcm/Socket0/TEMP": 69, + "/intel/pcm/System/EXEC": 0.00245, + "/intel/pcm/System/L3MISS": 0.249, + "/intel/pcm/Socket0/L2MISS": 0.666, + "/intel/pcm/SKT0_Package_C-State/C8res%": 0, + "/intel/pcm/SKT0_Package_C-State/C9res%": 0, + "/intel/pcm/System/WRITE": 0.134, + "/intel/pcm/System/TIME_ticks": 3410, + "/intel/pcm/System_Core_C-States/C1res%": 12.6, + "/intel/pcm/System_Core_C-States/C7res%": 84.1, + "/intel/pcm/Socket0/EXEC": 0.00245, + "/intel/pcm/System/L3MPI": 0.00372, + "/intel/pcm/System/PhysIPC%": 29.5, + "/intel/pcm/System_Core_C-States/C0res%": 1.59, + "/intel/pcm/SKT0_Core_C-State/C0res%": 1.59, + "/intel/pcm/System/L2HIT": 0.439, + "/intel/pcm/System/INST": 66.8, + "/intel/pcm/System_Pack_C-States/C9res%": 0, + "/intel/pcm/System_Pack_C-States/C10res%": 0, + "/intel/pcm/SKT0_Package_C-State/C2res%": 50.1, + "/intel/pcm/System/L2MISS": 0.666, + "/intel/pcm/SKT0_Package_C-State/C6res%": 0, } func TestPCMPlugin(t *testing.T) { @@ -100,8 +134,8 @@ func TestPCMPlugin(t *testing.T) { So(func() { pcm.CollectMetrics(mockMts) }, ShouldNotPanic) result, err := pcm.CollectMetrics(mockMts) - So(len(result), ShouldEqual, 24) So(err, ShouldBeNil) + So(len(result), ShouldEqual, len(refMap)) m := make(map[string]float64, len(result)) @@ -115,7 +149,7 @@ func TestPCMPlugin(t *testing.T) { Convey("Get metric types", func() { mts, err := pcm.GetMetricTypes(plugin.ConfigType{}) So(err, ShouldBeNil) - So(len(mts), ShouldEqual, 46) + So(len(mts), ShouldEqual, len(refMap)) namespaces := []string{} for _, m := range mts {