Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] UST simple example not working
@ 2010-06-21 16:01 George Stephen-RVGG20
  2010-06-21 16:12 ` Mathieu Desnoyers
  0 siblings, 1 reply; 3+ messages in thread
From: George Stephen-RVGG20 @ 2010-06-21 16:01 UTC (permalink / raw)


Hello,

 

I tried this simple example for trace_marker and get incorrect values
for  "return" in "ust.factorial" (return: 0). 

The trace for "ust.args" works. I even tried this in a C version of the
sample with same  errors.

Using g++ -o sample -g  -lust sample.cpp; usttrace ./sample on a PowerPC
target. 

 

class Factorial1 : public Factorial

{

public:

                Factorial1(){}

                virtual ~Factorial1(){}

                unsigned long long do_factorial(unsigned long long n)

                {              

                                // user space trace instrumentation

                                trace_mark(ust, args, "in_arg %d", n);

                                if (n <= 1)

                                                return 1;

                                else

                                                return n *
do_factorial(n-1);

                }

};

 

class Factorial2 : public Factorial

{

public:

                Factorial2(){}

                virtual ~Factorial2(){}

                unsigned long long do_factorial(unsigned long long n)

                {

                                unsigned long long ret = 1;

                                for ( int i = 1; i <= n; i++){

                                                ret *= i;

                                }

                                // user space trace instrumentation

                                trace_mark(ust, factorial, "in_arg %d
return %d", n, ret);                              

                                return ret;

                }

};

 

In another case I tried just: trace_mark(ust, factorial, "return %d",
ret) and the value for ret was the value for n.

 

Thanks for the help,

Stephen G.

 

                                

 

 

   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.casi.polymtl.ca/pipermail/lttng-dev/attachments/20100621/8253d100/attachment-0003.htm>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ltt-dev] UST simple example not working
  2010-06-21 16:01 [ltt-dev] UST simple example not working George Stephen-RVGG20
@ 2010-06-21 16:12 ` Mathieu Desnoyers
  2010-06-22 15:39   ` George Stephen-RVGG20
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2010-06-21 16:12 UTC (permalink / raw)


* George Stephen-RVGG20 (RVGG20 at freescale.com) wrote:
> Hello,
> 
>  
> 
> I tried this simple example for trace_marker and get incorrect values
> for  "return" in "ust.factorial" (return: 0). 
> 
> The trace for "ust.args" works. I even tried this in a C version of the
> sample with same  errors.
> 
> Using g++ -o sample -g  -lust sample.cpp; usttrace ./sample on a PowerPC
> target. 
> 
>  
> 
> class Factorial1 : public Factorial
> 
> {
> 
> public:
> 
>                 Factorial1(){}
> 
>                 virtual ~Factorial1(){}
> 
>                 unsigned long long do_factorial(unsigned long long n)
> 
>                 {              
> 
>                                 // user space trace instrumentation
> 
>                                 trace_mark(ust, args, "in_arg %d", n);
> 
>                                 if (n <= 1)
> 
>                                                 return 1;
> 
>                                 else
> 
>                                                 return n *
> do_factorial(n-1);
> 
>                 }
> 
> };
> 
>  
> 
> class Factorial2 : public Factorial
> 
> {
> 
> public:
> 
>                 Factorial2(){}
> 
>                 virtual ~Factorial2(){}
> 
>                 unsigned long long do_factorial(unsigned long long n)
> 
>                 {
> 
>                                 unsigned long long ret = 1;
> 
>                                 for ( int i = 1; i <= n; i++){
> 
>                                                 ret *= i;
> 
>                                 }
> 
>                                 // user space trace instrumentation
> 
>                                 trace_mark(ust, factorial, "in_arg %d
> return %d", n, ret);                              


Do you really have a '\n' in your format string ? This might be causing
your trouble.

Mathieu

> 
>                                 return ret;
> 
>                 }
> 
> };
> 
>  
> 
> In another case I tried just: trace_mark(ust, factorial, "return %d",
> ret) and the value for ret was the value for n.
> 
>  
> 
> Thanks for the help,
> 
> Stephen G.
> 
>  
> 
>                                 
> 
>  
> 
>  
> 
>    
> 

> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ltt-dev] UST simple example not working
  2010-06-21 16:12 ` Mathieu Desnoyers
@ 2010-06-22 15:39   ` George Stephen-RVGG20
  0 siblings, 0 replies; 3+ messages in thread
From: George Stephen-RVGG20 @ 2010-06-22 15:39 UTC (permalink / raw)


OK, Found what I was doing wrong. 
The format code for unsigned long long  is "%llu". 
I had used "%d".

Stephen G.


-----Original Message-----
From: Mathieu Desnoyers [mailto:compudj@krystal.dyndns.org] 
Sent: Monday, June 21, 2010 11:12 AM
To: George Stephen-RVGG20
Cc: ltt-dev at lists.casi.polymtl.ca
Subject: Re: [ltt-dev] UST simple example not working

* George Stephen-RVGG20 (RVGG20 at freescale.com) wrote:
> Hello,
> 
>  
> 
> I tried this simple example for trace_marker and get incorrect values
> for  "return" in "ust.factorial" (return: 0). 
> 
> The trace for "ust.args" works. I even tried this in a C version of
the
> sample with same  errors.
> 
> Using g++ -o sample -g  -lust sample.cpp; usttrace ./sample on a
PowerPC
> target. 
> 
>  
> 
> class Factorial1 : public Factorial
> 
> {
> 
> public:
> 
>                 Factorial1(){}
> 
>                 virtual ~Factorial1(){}
> 
>                 unsigned long long do_factorial(unsigned long long n)
> 
>                 {              
> 
>                                 // user space trace instrumentation
> 
>                                 trace_mark(ust, args, "in_arg %d", n);
> 
>                                 if (n <= 1)
> 
>                                                 return 1;
> 
>                                 else
> 
>                                                 return n *
> do_factorial(n-1);
> 
>                 }
> 
> };
> 
>  
> 
> class Factorial2 : public Factorial
> 
> {
> 
> public:
> 
>                 Factorial2(){}
> 
>                 virtual ~Factorial2(){}
> 
>                 unsigned long long do_factorial(unsigned long long n)
> 
>                 {
> 
>                                 unsigned long long ret = 1;
> 
>                                 for ( int i = 1; i <= n; i++){
> 
>                                                 ret *= i;
> 
>                                 }
> 
>                                 // user space trace instrumentation
> 
>                                 trace_mark(ust, factorial, "in_arg %d
> return %d", n, ret);                              


Do you really have a '\n' in your format string ? This might be causing
your trouble.

Mathieu

> 
>                                 return ret;
> 
>                 }
> 
> };
> 
>  
> 
> In another case I tried just: trace_mark(ust, factorial, "return %d",
> ret) and the value for ret was the value for n.
> 
>  
> 
> Thanks for the help,
> 
> Stephen G.
> 
>  
> 
>                                 
> 
>  
> 
>  
> 
>    
> 

> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-22 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 16:01 [ltt-dev] UST simple example not working George Stephen-RVGG20
2010-06-21 16:12 ` Mathieu Desnoyers
2010-06-22 15:39   ` George Stephen-RVGG20

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox