Hi, You do not need system-wide mode here. Your program is counting not sampling. The reason it does not work when you program 2 events is because you have a bug in your program. See below.
On Wed, Oct 28, 2009 at 8:16 PM, Ata E Husain <aehus...@buffalo.edu> wrote: > > for(i=0;i < outp.pfp_pmc_count; i++) { > pc[i].reg_num = outp.pfp_pmcs[i].reg_num; > pc[i].reg_value = outp.pfp_pmcs[i].reg_value; > } > > for(i=0; i < outp.pfp_pmd_count; i++) { > pd[i].reg_num = outp.pfp_pmds[i].reg_num; > pd[i].reg_value = 0; > } > > ctx.ctx_flags |= PFM_FL_SYSTEM_WIDE; Drop this. > fd = pfm_create_context(&ctx, NULL, 0, 0); > > if(fd == -1) { > perror("\nCan't create pfm context\n"); > exit(1); > } > > if(pfm_write_pmcs(fd, pc, outp.pfp_pmc_count) == -1){ > perror("\nCan't perform write to pmcs\n"); > exit(1); > } > > if(pfm_write_pmds(fd, pd, 1) == -1) { Must be out.pfp_pmd_count not 1. Otherwise you are programming only one counter. > if(pfm_read_pmds(fd, pd, inp.pfp_event_count) == -1){ Yes, or could also use outp.pfp_pmd_count. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel