aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-09-02 19:28:08 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-04 20:32:55 -0700
commit31a132935053329fb34c599f4224c7b08e5ac3f9 (patch)
treea8505b5db589e54b750ef82828a5455640235f4c
parentcc3c8c7971c6a610f2cd30d505a916c3fa29a910 (diff)
Adding intel_pmu tools plugin for collectd
Change-Id: I81ff3d43d209e98188855c8b2eb302835bb5d417 Signed-off-by: Neha Vadnere <neha.r.vadnere@intel.com> Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--tests/unit/network_services/nfvi/test_resource.py5
-rw-r--r--yardstick/network_services/nfvi/collectd.conf8
-rwxr-xr-xyardstick/network_services/nfvi/collectd.sh23
-rw-r--r--yardstick/network_services/nfvi/resource.py11
4 files changed, 42 insertions, 5 deletions
diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py
index 072f06edf..21beba882 100644
--- a/tests/unit/network_services/nfvi/test_resource.py
+++ b/tests/unit/network_services/nfvi/test_resource.py
@@ -274,6 +274,7 @@ class TestResourceProfile(unittest.TestCase):
res = self.resource_profile.parse_collectd_result({}, [0, 1, 2])
expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {},
'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'intel_pmu': {},
'virt': {}}
self.assertDictEqual(res, expected_result)
@@ -286,6 +287,7 @@ class TestResourceProfile(unittest.TestCase):
res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
expected_result = {'cpu': {1: {'ipc': '1234'}}, 'dpdkstat': {}, 'hugepages': {},
'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'intel_pmu': {},
'virt': {}}
self.assertDictEqual(res, expected_result)
@@ -294,6 +296,7 @@ class TestResourceProfile(unittest.TestCase):
res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {},
'memory': {'bw': '101'}, 'ovs_stats': {}, 'timestamp': '',
+ 'intel_pmu': {},
'virt': {}}
self.assertDictEqual(res, expected_result)
@@ -305,6 +308,7 @@ class TestResourceProfile(unittest.TestCase):
expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {'free':
'101'},
'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'intel_pmu': {},
'virt': {}}
self.assertDictEqual(res, expected_result)
@@ -321,6 +325,7 @@ class TestResourceProfile(unittest.TestCase):
res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
expected_result = {'cpu': {}, 'dpdkstat': {'tx': '101'}, 'hugepages': {},
'memory': {}, 'ovs_stats': {'tx': '101'}, 'timestamp': '',
+ 'intel_pmu': {},
'virt': {'memory': '101'}}
self.assertDictEqual(res, expected_result)
diff --git a/yardstick/network_services/nfvi/collectd.conf b/yardstick/network_services/nfvi/collectd.conf
index 6d8b73f7f..3928dcbca 100644
--- a/yardstick/network_services/nfvi/collectd.conf
+++ b/yardstick/network_services/nfvi/collectd.conf
@@ -67,6 +67,14 @@ Interval {interval}
Cores ""
</Plugin>
+<Plugin intel_pmu>
+ ReportHardwareCacheEvents true
+ ReportKernelPMUEvents true
+ ReportSoftwareEvents true
+ EventList "/root/.cache/pmu-events/GenuineIntel-6-2D-core.json"
+ HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD"
+</Plugin>
+
<Plugin hugepages>
ReportPerNodeHP true
ReportRootHP true
diff --git a/yardstick/network_services/nfvi/collectd.sh b/yardstick/network_services/nfvi/collectd.sh
index 7666404e4..296c4a213 100755
--- a/yardstick/network_services/nfvi/collectd.sh
+++ b/yardstick/network_services/nfvi/collectd.sh
@@ -104,6 +104,24 @@ else
popd
fi
+ls $INSTALL_NSB_BIN/pmu-tools >/dev/null
+if [ $? -eq 0 ]
+then
+ echo "DPDK already installed. Done"
+else
+ cd $INSTALL_NSB_BIN
+
+ git clone https://github.com/andikleen/pmu-tools.git
+ cd pmu-tools
+ cd jevents
+ sed -i -e 's/CFLAGS := -g -Wall -O2 -Wno-unused-result/CFLAGS := -g -Wall -O2 -Wno-unused-result -fPIC/g' Makefile
+ make
+ sudo make install
+ cd $INSTALL_NSB_BIN/pmu-tools
+ python event_download.py
+fi
+
+cd $INSTALL_NSB_BIN
which $INSTALL_NSB_BIN/collectd/collectd >/dev/null
if [ $? -eq 0 ]
then
@@ -115,9 +133,8 @@ else
git clone https://github.com/collectd/collectd.git
pushd collectd
git stash
- git checkout -b nfvi 47c86ace348a1d7a5352a83d10935209f89aa4f5
./build.sh
- ./configure --with-libpqos=/usr/ --with-libdpdk=/usr --with-libyajl=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats
+ ./configure --with-libpqos=/usr/ --with-libdpdk=/usr --with-libyajl=/usr/local --with-libjevents=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats --enable-intel_pmu --prefix=$INSTALL_NSB_BIN/collectd
make install > /dev/null
popd
echo "Done."
@@ -126,7 +143,7 @@ fi
modprobe msr
cp $INSTALL_NSB_BIN/collectd.conf /opt/collectd/etc/
-
+sudo service rabbitmq-server restart
echo "Check if admin user already created"
rabbitmqctl list_users | grep '^admin$' > /dev/null
if [ $? -eq 0 ];
diff --git a/yardstick/network_services/nfvi/resource.py b/yardstick/network_services/nfvi/resource.py
index 2a9a1a1a2..f0ae67616 100644
--- a/yardstick/network_services/nfvi/resource.py
+++ b/yardstick/network_services/nfvi/resource.py
@@ -35,7 +35,7 @@ CONF = cfg.CONF
ZMQ_OVS_PORT = 5567
ZMQ_POLLING_TIME = 12000
LIST_PLUGINS_ENABLED = ["amqp", "cpu", "cpufreq", "intel_rdt", "memory",
- "hugepages", "dpdkstat", "virt", "ovs_stats"]
+ "hugepages", "dpdkstat", "virt", "ovs_stats", "intel_pmu"]
class ResourceProfile(object):
@@ -109,6 +109,10 @@ class ResourceProfile(object):
def parse_ovs_stats(cls, key, value):
return cls.parse_simple_resource(key, value)
+ @classmethod
+ def parse_intel_pmu_stats(cls, key, value):
+ return {''.join(key): value.split(":")[1]}
+
def parse_collectd_result(self, metrics, core_list):
""" convert collectd data into json"""
result = {
@@ -118,6 +122,7 @@ class ResourceProfile(object):
"dpdkstat": {},
"virt": {},
"ovs_stats": {},
+ "intel_pmu": {},
}
testcase = ""
@@ -148,6 +153,9 @@ class ResourceProfile(object):
elif "ovs_stats" in res_key0:
result["ovs_stats"].update(self.parse_ovs_stats(key_split, value))
+ elif "intel_pmu-all" in res_key0:
+ result["intel_pmu"].update(self.parse_intel_pmu_stats(res_key1, value))
+
result["timestamp"] = testcase
return result
@@ -192,7 +200,6 @@ class ResourceProfile(object):
"loadplugin": loadplugin,
"dpdk_interface": interfaces,
}
-
self._provide_config_file(bin_path, 'collectd.conf', kwargs)
def _start_collectd(self, connection, bin_path):