On 09/29/2010 12:33 AM, stephane eranian wrote: > Corey, > > Please note that once libpfm4-1.0 is released, I'll post a patch > to link the perf tool directly with libpfm4. At that point, you will > not need your little evt2raw program to access any event encoding.
When you say you'll post a patch, did you mean to LKML? I did this already and it was rejected in favor of a more long-term approach that uses sysfs for PMU and event naming. All of the details of that system are still very sketchy, but I don't think you'll be able to get Ingo et al. to commit such a patch. > > What's blocking release 1.0? > > 1- add support for OS-specific event attributes > 2- add Pentium 4 (Netburst) support > > For 1, the idea is to allow you to pass attributes which come from the > OS API and not the HW. For instance, the sampling period, the precise_ip > mode. The list of OS attributes for each event depends on the OS and the > event itself. Sometimes, there are several HW attributes which do overlap > with OS attributes, for instance u, k, precise_ip. The latter is connected to > PEBS on Intel processors. The u, k in perf_events override those set in > HW. > > The reason 1- is delaying the release is because it may have some implications > at the user level API of libpfm4. > That's interesting, and I can see where that would have use for us as well. For example, some of our Power-based systems have full hypervisors and some run the Linux kernel in hypervisor mode. - Corey > > On Wed, Sep 29, 2010 at 9:27 AM, stephane eranian > <eran...@googlemail.com> wrote: >> Corey, >> >> Patch applied. I tweaked the error messages a bit. >> Thanks. >> >> On Mon, Sep 27, 2010 at 8:15 AM, Corey Ashford >> <cjash...@linux.vnet.ibm.com> wrote: >>> Provide a small tool which translates an event string + modifiers to a raw >>> event code for use with the perf tool. >>> >>> This example is very simple and takes a single event string as an argument. >>> >>> Signed-off-by: Corey Ashford<cjash...@us.ibm.com> >>> --- >>> perf_examples/Makefile | 2 +- >>> perf_examples/evt2raw.c | 74 >>> +++++++++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 75 insertions(+), 1 deletions(-) >>> create mode 100644 perf_examples/evt2raw.c >>> >>> diff --git a/perf_examples/Makefile b/perf_examples/Makefile >>> index 1d353d4..8ebb290 100644 >>> --- a/perf_examples/Makefile >>> +++ b/perf_examples/Makefile >>> @@ -55,7 +55,7 @@ ifeq ($(SYS),Linux) >>> LPC_UTILS=perf_util.o >>> TARGETS+=self self_basic self_count task task_attach_timeout syst \ >>> notify_self notify_group task_smpl self_smpl_multi \ >>> - self_pipe syst_count task_cpu syst_smpl >>> + self_pipe syst_count task_cpu syst_smpl evt2raw >>> >>> #XTRA += rtop >>> endif >>> diff --git a/perf_examples/evt2raw.c b/perf_examples/evt2raw.c >>> new file mode 100644 >>> index 0000000..917420f >>> --- /dev/null >>> +++ b/perf_examples/evt2raw.c >>> @@ -0,0 +1,74 @@ >>> +/* >>> + * evt2raw.c - example which converts an event string (event + modifiers) >>> to >>> + * a raw event code usable by the perf tool. >>> + * >>> + * Copyright (c) 2010 IBM Corp. >>> + * Contributed by Corey Ashford<cjash...@us.ibm.com> >>> + * >>> + * Permission is hereby granted, free of charge, to any person obtaining a >>> copy >>> + * of this software and associated documentation files (the "Software"), >>> to deal >>> + * in the Software without restriction, including without limitation the >>> rights >>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or >>> sell copies >>> + * of the Software, and to permit persons to whom the Software is >>> furnished to do so, >>> + * subject to the following conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be included >>> in all >>> + * copies or substantial portions of the Software. >>> + * >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >>> OR IMPLIED, >>> + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS >>> FOR A >>> + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS >>> OR COPYRIGHT >>> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN >>> AN ACTION OF >>> + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH >>> THE SOFTWARE >>> + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. >>> + */ >>> +#include<stdio.h> >>> +#include<stdlib.h> >>> +#include<unistd.h> >>> +#include<perfmon/pfmlib_perf_event.h> >>> + >>> +static void >>> +usage(void) >>> +{ >>> + printf("usage: evt2raw<event>\n" >>> + "<event> is the symbolic event, including modifiers, to " >>> + "translate to a raw code.\n"); >>> +} >>> + >>> +int >>> +main(int argc, char **argv) >>> +{ >>> + int ret; >>> + struct perf_event_attr pea; >>> + char *event_str; >>> + >>> + if (argc != 2) { >>> + usage(); >>> + return 1; >>> + } >>> + event_str = argv[1]; >>> + >>> + ret = pfm_initialize(); >>> + if (ret != PFM_SUCCESS) { >>> + printf("Internal error: pfm_initialize returned %s\n", >>> + pfm_strerror(ret)); >>> + return 1; >>> + } >>> + >>> + ret = pfm_get_perf_event_encoding(event_str, PFM_PLM0|PFM_PLM3,&pea, >>> + NULL, NULL); >>> + if (ret != PFM_SUCCESS) { >>> + printf("Error: pfm_get_perf_encoding returned %s\n", >>> + pfm_strerror(ret)); >>> + return 1; >>> + } >>> + >>> + if (pea.type != PERF_TYPE_RAW) { >>> + printf("Error: %s is not a raw hardware event\n", >>> event_str); >>> + return 1; >>> + } >>> + >>> + printf("r%llx\n", pea.config); >>> + >>> + return 0; >>> +} >>> -- >>> 1.7.0.4 >>> >>> >>> ------------------------------------------------------------------------------ >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing. >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> perfmon2-devel mailing list >>> perfmon2-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel >>> >> ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel