summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7a8d537)
raw | patch | inline | side by side (parent: 7a8d537)
author | Pshyk, SerhiyX <serhiyx.pshyk@intel.com> | |
Fri, 26 May 2017 14:51:54 +0000 (15:51 +0100) | ||
committer | Pshyk, SerhiyX <serhiyx.pshyk@intel.com> | |
Tue, 30 May 2017 09:29:57 +0000 (10:29 +0100) |
- cleanup of configure.ac
- add config option EventList to avoid dependency on environment variables
Change-Id: I987095b6e71bcf05103e773793c0a40c815f729b
Signed-off-by: Serhiy Pshyk <serhiyx.pshyk@intel.com>
- add config option EventList to avoid dependency on environment variables
Change-Id: I987095b6e71bcf05103e773793c0a40c815f729b
Signed-off-by: Serhiy Pshyk <serhiyx.pshyk@intel.com>
diff --git a/configure.ac b/configure.ac
index af3bcfea4ec313fcb311e61fabd8fa6f1e5b891f..7b5045f70d3b7e0aa92d7ca5b5ebd3b5243c0343 100644 (file)
--- a/configure.ac
+++ b/configure.ac
# --with-libjevents {{{
with_libjevents_cppflags=""
with_libjevents_ldflags=""
-AC_ARG_WITH(libjevents, [AS_HELP_STRING([--with-libjevents@<:@=PREFIX@:>@], [Path to libjevents.])],
-[
- if test "x$withval" != "xno" && test "x$withval" != "xyes"
- then
- with_libjevents_cppflags="-I$withval/include"
- with_libjevents_ldflags="-L$withval/lib"
- with_libjevents="yes"
- else
- with_libjevents="$withval"
- fi
-],
-[
- with_libjevents="yes"
-])
+AC_ARG_WITH([libjevents],
+ [AS_HELP_STRING([--with-libjevents@<:@=PREFIX@:>@], [Path to libjevents.])],
+ [
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ then
+ with_libjevents_cppflags="-I$withval/include"
+ with_libjevents_ldflags="-L$withval/lib"
+ with_libjevents="yes"
+ else
+ with_libjevents="$withval"
+ fi
+ ],
+ [with_libjevents="yes"]
+)
+
if test "x$with_libjevents" = "xyes"
then
SAVE_CPPFLAGS="$CPPFLAGS"
fi
if test "x$with_libjevents" = "xyes"
then
- SAVE_CPPFLAGS="$CPPFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
- CPPFLAGS="$CPPFLAGS $with_libjevents_cppflags"
LDFLAGS="$LDFLAGS $with_libjevents_ldflags"
AC_CHECK_LIB(jevents, json_events, [with_libjevents="yes"], [with_libjevents="no (Can't find libjevents)"])
- CPPFLAGS="$SAVE_CPPFLAGS"
- LDFLAGS="$SAVE_LDFLAGS"
-fi
-if test "x$with_libjevents" = "xyes"
-then
- SAVE_CPPFLAGS="$CPPFLAGS"
- SAVE_LDFLAGS="$LDFLAGS"
- SAVE_LIBS="$LIBS"
- CPPFLAGS="$CPPFLAGS -fPIC"
- LDFLAGS="$LDFLAGS -shared"
- LIBS="-ljevents"
- AC_LINK_IFELSE([AC_LANG_SOURCE(
- [[
- #include <stdio.h>
- #include "jevents.h"
- void print_cpu(void){
- printf("%s", get_cpu_str());
- }
- ]]
- )],
- [with_libjevents="yes"], [with_libjevents="no (could not link to libjevents. Check jevents is compiled with -fPIC.)"])
- CPPFLAGS="$SAVE_CPPFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
- LIBS="$SAVE_LIBS"
fi
if test "x$with_libjevents" = "xyes"
then
BUILD_WITH_LIBJEVENTS_CPPFLAGS="$with_libjevents_cppflags"
BUILD_WITH_LIBJEVENTS_LDFLAGS="$with_libjevents_ldflags"
BUILD_WITH_LIBJEVENTS_LIBS="-ljevents"
- AC_SUBST(BUILD_WITH_LIBJEVENTS_CPPFLAGS)
- AC_SUBST(BUILD_WITH_LIBJEVENTS_LDFLAGS)
- AC_SUBST(BUILD_WITH_LIBJEVENTS_LIBS)
fi
+AC_SUBST(BUILD_WITH_LIBJEVENTS_CPPFLAGS)
+AC_SUBST(BUILD_WITH_LIBJEVENTS_LDFLAGS)
+AC_SUBST(BUILD_WITH_LIBJEVENTS_LIBS)
# }}}
# --with-libprotobuf {{{
index efd922a6bf01b00d57081349efef4f412605a7c9..5f3e907f29160281e912ff0ddf4304745900a0dc 100644 (file)
ProtectSystem=full
ProtectHome=true
-# Some plugins require access to data located in a specified folder, to access
-# this data you'll have to specify the path by using the Environment directive
-# below.
-#
-# Here's a (incomplete) list of the plugins known environment requirements:
-# intel_pmu XDG_CACHE_HOME
-#
-# Example, if you use the intel_pmu plugin and cache is located in the /opt
-# directory:
-# Environment=XDG_CACHE_HOME=/opt
-#
-# By default, the HOME directory is chosen:
-Environment=
-
# A few plugins won't work without some privileges, which you'll have to
# specify using the CapabilityBoundingSet directive below.
#
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 1a2823b73b40d62713a62d97d570be5f8caeaf07..1b40bf4059754576bb96f166a707d45ec79d9bed 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# ReportHardwareCacheEvents true
# ReportKernelPMUEvents true
# ReportSoftwareEvents true
+# EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json"
# HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD"
#</Plugin>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 36053cd0f7d09b89cefef60e0210cfe5f25a5345..30544d09d1e21c4cfc4ad2b62f594efd71c96fab 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
ReportHardwareCacheEvents true
ReportKernelPMUEvents true
ReportSoftwareEvents true
+ EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json"
HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD"
</Plugin>
- alignment-faults
- emulation-faults
+=item B<EventList> I<filename>
+
+JSON performance counter event list file name. To be able to monitor all Intel
+CPU specific events JSON event list file should be downloaded. Use the pmu-tools
+event_download.py script to download event list for current CPU.
+
=item B<HardwareEvents> I<events>
This field is a list of event names or groups of comma separated event names.
-To be able to monitor all Intel CPU specific events JSON event list file should
-be downloaded. Use the pmu-tools event_download.py script for this.
+This option requires B<EventList> option to be configured.
=back
diff --git a/src/intel_pmu.c b/src/intel_pmu.c
index e332c37b106bef33989c93653f969c9062829df4..87a713be6ab8676912e6438f2735f0ff1fcedd8c 100644 (file)
--- a/src/intel_pmu.c
+++ b/src/intel_pmu.c
_Bool hw_cache_events;
_Bool kernel_pmu_events;
_Bool sw_events;
+ char event_list_fn[PATH_MAX];
char **hw_events;
size_t hw_events_count;
struct eventlist *event_list;
ret = cf_util_get_boolean(child, &g_ctx.hw_cache_events);
} else if (strcasecmp("ReportKernelPMUEvents", child->key) == 0) {
ret = cf_util_get_boolean(child, &g_ctx.kernel_pmu_events);
+ } else if (strcasecmp("EventList", child->key) == 0) {
+ ret = cf_util_get_string_buffer(child, g_ctx.event_list_fn,
+ sizeof(g_ctx.event_list_fn));
} else if (strcasecmp("HardwareEvents", child->key) == 0) {
ret = pmu_config_hw_events(child);
} else if (strcasecmp("ReportSoftwareEvents", child->key) == 0) {
/* parse events names if config option is present and is not empty */
if (g_ctx.hw_events_count) {
+
+ ret = read_events(g_ctx.event_list_fn);
+ if (ret != 0) {
+ ERROR(PMU_PLUGIN ": Failed to read event list file '%s'.",
+ g_ctx.event_list_fn);
+ return ret;
+ }
+
ret = pmu_add_hw_events(g_ctx.event_list, g_ctx.hw_events,
g_ctx.hw_events_count);
if (ret != 0) {