Phil,

On Fri, May 25, 2007 at 01:27:56PM +0200, Philip J. Mucci wrote:
> Hi man,
> 
> Ok, if you look in lib/libpfms.c, you'll see that the return from
> pfms_create is looking for a return value of 0. But in fact, perfmon2
> returns the file descriptor...
> 
> It uses this both to set up 'desc' as well as to set the return value
> for each thread.
> 
> 453c454
> <       if (ret == 0) *desc = s;
> ---
> >       if (ret >= 0) *desc = s;
> 455c456
> <       return ret ? -1 : 0;
> ---
> >       return (ret >= 0) ? 0 : 1;
> 
Ok, there is an issue but not there. I also fixed an issue
with pfm_load_context(). The changes are in CVS.

The following patch can be used.

Index: lib/libpfms.c
===================================================================
RCS file: /cvsroot/perfmon2/libpfm/libpfms/lib/libpfms.c,v
retrieving revision 1.3
diff -u -p -r1.3 libpfms.c
--- lib/libpfms.c       13 Nov 2006 17:28:54 -0000      1.3
+++ lib/libpfms.c       25 May 2007 11:42:49 -0000
@@ -180,7 +180,7 @@ pfms_thread_mainloop(void *arg)
        int ret = 0;
 
        memset(&load_args, 0, sizeof(load_args));
-
+       load_args.load_pid = mycpu;
        td = tds+mycpu;
 
        ret = pin_cpu(mycpu);
@@ -206,7 +206,8 @@ pfms_thread_mainloop(void *arg)
                                ctx = td->data;
                                myctx = *ctx;
 
-                               ret = fd = pfm_create_context(&myctx, NULL, 
NULL, 0);
+                               fd = pfm_create_context(&myctx, NULL, NULL, 0);
+                               ret = fd < 0 ? -1 : 0;
                                dprint("CPU%u CMD_CTX ret=%d errno=%d fd=%d\n", 
mycpu, ret, errno, fd);
                                break;
 
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to