Hi Anuj,

You may need to provide a few more details, but DTrace allows you to  
trace exactly what you want. Just specify the function component of  
the pid provider probe:

   pid123::foo:entry

You should take a look at the chapter in the DTrace docs on tracing  
user-land processes.

- ahl

[$]

On Feb 20, 2008, at 6:06 PM, Anuj Goyal <[EMAIL PROTECTED]> wrote:

> How would I get a set of functions being called from within a  
> thread?  eg. I want bar() and collect() to be flagged, but not foo()  
> and main().
>
> e.g. I would want
>
>
>  #include <stdio.h>
>  #include <math.h>
>  #include <pthread.h>
>
>  #define NGRPS 30
>  #define NTHRS 10
>
>  int object_count = 0;
>  int* object_array;
>  int group_array[NGRPS];
>  int total_count = 0;
>
> void bar(){return;}
>
>  void* collect(void* arg)
>  {
>     int j;
>
>     int group_id = *((int *) arg);
>     int group_count = 0;
>
>     for (j = 0; j < object_count; j++) {
>        int current_object = object_array[j];
>        group_count++;
>     }
>     total_count += group_count;
>     bar();
>     return NULL;
>  }
>
> void foo() {int i;}
>
>  int main(int argc, char** argv)
>  {
>     int i;
>     pthread_t pids[NTHRS -1];
>
>     object_count = argv[1];
>
>     for (i = 0; i < NTHRS; i++) {
>        pthread_create(&pids[i], NULL, collect, (void*) &i);
>     }
>
>     if (total_count != object_count) {
>        printf(" the collected object count %d doesn't match the  
> original object count %d\n",
>           total_count, object_count);
>    }
>    return 0;
>  }
>
>
> _______________________________________________
> dtrace-discuss mailing list
> [email protected]
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to