RE: WPP trace - Function Entry/Exit Tracing

I changed the subject line a little as I was getting lost with the
different threads.

Regarding Function Entry/Exit tracing, there is a basic example in the
MSDN.

http://msdn2.microsoft.com/en-us/library/ms797191.aspx

and some presentation here

http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204
a672f11cf/Software_Tracing.ppt

They do show up in searches.

It needs a extra function to finish what Yossi needs.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Thursday, February 15, 2007 12:41 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] New line in WPP trace


From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
] on behalf of Yossi Leybovich[SMTP:xxxxx@mellanox.co.il]
Reply To: Windows System Software Devs Interest List
Sent: Thursday, February 15, 2007 8:34 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] New line in WPP trace

We wrote whole bunch of networking drivers that ran in 10Gbs and in
order to debug races and scenarios that happen when there is
traffic load I found it very helpful to use WPP (and I think it’s the
only way I can see output without loosing performance).

That’s the only reason why I still didn’t rejected the idea of using WPP
completely. But is there a real difference? When traces are turned
on, is there a difference between traditional approach when traces are
printed via DbgPrint() and captured by DebugView and WPP captured some
other way? In both cases there is an overhead which probably differs.
Does anybody have some numbers?

Did you see any differences between both approaches when debugging
races? This is the only area where my traces sometimes cause that
problem can’t be reproduced (but in other cases problem can be
reproduced only with traces :slight_smile:

I don’t think that event log is the right tool for tracing or
debugging
specially not when you debug networking events in 10Gbs.

Sure, event log has quite different purpose.

Maybe there should be a way to ran preprocessor before the WPP
preprocessor so one can use WPP from within macros.

This is one of things which discourages me. Everything would be much
easier if one can use standard preprocessor macros and just call a
function which’d make trace. I also use special macros for function
enter and leave. In addition to ==> and <== they indent/outdent output
and compute time elapsed in the function/block. The whole idea with
special preprocessor for traces is IMO flawed and shows too much power
is harmful, sometimes.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I found the example before but shows only the simple case. And if I understand correctly, %!FUNC! can’t be used in debug prints (if the debug version of driver is built with them instead of WPP). The presentation doesn’t contain the most interesting parts. For example at page 31. And do you really believe this thread would even exist if WPP accomplishes the last point at page 4 (as simple as printf…) :wink:

Well, my code usually looks like this:

NTSTATUS DispatchDevCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
TTRACE_ENTER(Ioctl, TDBG_DEBUG, (“DispatchDevCtrl(%p, %p)”, DeviceObject, Irp));

TTRACE(Ioctl, TDBG_DEBUG, (“Processing IOCTL %x <%s> (input length: %d, output length: %d)”,
IoctlCode, GetIoctlCodeName(IoctlCode), InputBufferLength, OutputBufferLength));

TTRACE_LEAVE((“DispatchDevCtrl() -> %x [%d]”, Status, ReturnedSize));
return(Status);
}

where Ioctl is trace area which contains current trace level. Traces in different sources can and usually have different areas. Note LEAVE macro uses ENTER parameters and measures elapsed time. The appropropriate debug output looks like this:

0.26440164 <0:0> Ioctl[1006]: ==> DispatchDevCtrl(89D50B00, 8AA9CF20)
0.26475674 <0:0> Ioctl[1082]: Processing IOCTL 81c06070 <tcusb_ioctl_get_version> (input length: 0, output length: 16)
0.26480985 <0:0> Ioctl[1799]: <== (0.395) DispatchDevCtrl() -> 0 [16]

Also note indent for intermediate trace message. Is it possible to achieve the same effect with WPP? I don’t need to see code, just if it is even possible.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Ian Service[SMTP:xxxxx@microsoft.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Thursday, February 15, 2007 10:33 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing
>
> I changed the subject line a little as I was getting lost with the
> different threads.
>
> Regarding Function Entry/Exit tracing, there is a basic example in the
> MSDN.
>
> http://msdn2.microsoft.com/en-us/library/ms797191.aspx
>
> and some presentation here
>
> http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204
> a672f11cf/Software_Tracing.ppt
>
> They do show up in searches.
>
> It needs a extra function to finish what Yossi needs.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
> Sent: Thursday, February 15, 2007 12:41 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] New line in WPP trace
>
> > ----------
> > From:
> xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
>] on behalf of Yossi Leybovich[SMTP:xxxxx@mellanox.co.il]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Thursday, February 15, 2007 8:34 AM
> > To: Windows System Software Devs Interest List
> > Subject: RE: [ntdev] New line in WPP trace
> >
> > We wrote whole bunch of networking drivers that ran in 10Gbs and in
> > order to debug races and scenarios that happen when there is
> > traffic load I found it very helpful to use WPP (and I think it’s the
> > only way I can see output without loosing performance).
> >
> That’s the only reason why I still didn’t rejected the idea of using WPP
> completely. But is there a real difference? When traces are turned
> on, is there a difference between traditional approach when traces are
> printed via DbgPrint() and captured by DebugView and WPP captured some
> other way? In both cases there is an overhead which probably differs.
> Does anybody have some numbers?>
>
> Did you see any differences between both approaches when debugging
> races? This is the only area where my traces sometimes cause that
> problem can’t be reproduced (but in other cases problem can be
> reproduced only with traces :slight_smile:
>
> > I don’t think that event log is the right tool for tracing or
> debugging
> > specially not when you debug networking events in 10Gbs.
> >
> Sure, event log has quite different purpose.
>
> > Maybe there should be a way to ran preprocessor before the WPP
> > preprocessor so one can use WPP from within macros.
> >
> This is one of things which discourages me. Everything would be much
> easier if one can use standard preprocessor macros and just call a
> function which’d make trace. I also use special macros for function
> enter and leave. In addition to ==> and <== they indent/outdent output
> and compute time elapsed in the function/block. The whole idea with
> special preprocessor for traces is IMO flawed and shows too much power
> is harmful, sometimes.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
></tcusb_ioctl_get_version>

You can tell WPP which are your Trace functions TTRACE_ENTER, etc

The easiest way to do this is with a config block that WPP scans, also
can be done with a command line option. See the TraceDrv sample for how
the config block works, it has detailed explanation. Also my
presentation from DevCon2005 had details.

//begin_wpp config
//USEPREFIX (TTRACE_ENTER, “%!STDPREFIX! ===>”); //here is where you
add the prefix
//FUNC TTRACE_ENTER(FLAGS,LEVEL,(MSG,…));
//end_wpp // you can also add a suffix

Not sure how you are doing the elapsed time.

But ETW logs a timestamp with the event, PID, TID, processor, and some
other values. Other starndard values are taken from the TMF, like format
string, component name, etc.
Bottom line is that you can correlate the ENTER/EXIT events to get the
elapsed time.

So yes you can do all that, and as simple as printf and better, because
we support extended format strings.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Thursday, February 15, 2007 3:38 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

I found the example before but shows only the simple case. And if I
understand correctly, %!FUNC! can’t be used in debug prints (if the
debug version of driver is built with them instead of WPP). The
presentation doesn’t contain the most interesting parts. For example at
page 31. And do you really believe this thread would even exist if WPP
accomplishes the last point at page 4 (as simple as printf…) :wink:

Well, my code usually looks like this:

NTSTATUS DispatchDevCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
TTRACE_ENTER(Ioctl, TDBG_DEBUG, (“DispatchDevCtrl(%p, %p)”,
DeviceObject, Irp));

TTRACE(Ioctl, TDBG_DEBUG, (“Processing IOCTL %x <%s> (input length:
%d, output length: %d)”,
IoctlCode, GetIoctlCodeName(IoctlCode),
InputBufferLength, OutputBufferLength));

TTRACE_LEAVE((“DispatchDevCtrl() -> %x [%d]”, Status,
ReturnedSize));
return(Status);
}

where Ioctl is trace area which contains current trace level. Traces in
different sources can and usually have different areas. Note LEAVE macro
uses ENTER parameters and measures elapsed time. The appropropriate
debug output looks like this:

0.26440164 <0:0> Ioctl[1006]: ==> DispatchDevCtrl(89D50B00,
8AA9CF20)
0.26475674 <0:0> Ioctl[1082]: Processing IOCTL 81c06070
<tcusb_ioctl_get_version> (input length: 0, output length: 16)
0.26480985 <0:0> Ioctl[1799]: <== (0.395) DispatchDevCtrl() -> 0
[16]

Also note indent for intermediate trace message. Is it possible to
achieve the same effect with WPP? I don’t need to see code, just if it
is even possible.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
] on behalf of Ian Service[SMTP:xxxxx@microsoft.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Thursday, February 15, 2007 10:33 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing
>
> I changed the subject line a little as I was getting lost with the
> different threads.
>
> Regarding Function Entry/Exit tracing, there is a basic example in the
> MSDN.
>
> http://msdn2.microsoft.com/en-us/library/ms797191.aspx
>
> and some presentation here
>
>
http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204
> a672f11cf/Software_Tracing.ppt
>
> They do show up in searches.
>
> It needs a extra function to finish what Yossi needs.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
> Sent: Thursday, February 15, 2007 12:41 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] New line in WPP trace
>
> > ----------
> > From:
>
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
>] on behalf of Yossi Leybovich[SMTP:xxxxx@mellanox.co.il]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Thursday, February 15, 2007 8:34 AM
> > To: Windows System Software Devs Interest List
> > Subject: RE: [ntdev] New line in WPP trace
> >
> > We wrote whole bunch of networking drivers that ran in 10Gbs and in
> > order to debug races and scenarios that happen when there is
> > traffic load I found it very helpful to use WPP (and I think it’s
the
> > only way I can see output without loosing performance).
> >
> That’s the only reason why I still didn’t rejected the idea of using
WPP
> completely. But is there a real difference? When traces are turned
> on, is there a difference between traditional approach when traces are
> printed via DbgPrint() and captured by DebugView and WPP captured some
> other way? In both cases there is an overhead which probably differs.
> Does anybody have some numbers?>
>
> Did you see any differences between both approaches when debugging
> races? This is the only area where my traces sometimes cause that
> problem can’t be reproduced (but in other cases problem can be
> reproduced only with traces :slight_smile:
>
> > I don’t think that event log is the right tool for tracing or
> debugging
> > specially not when you debug networking events in 10Gbs.
> >
> Sure, event log has quite different purpose.
>
> > Maybe there should be a way to ran preprocessor before the WPP
> > preprocessor so one can use WPP from within macros.
> >
> This is one of things which discourages me. Everything would be much
> easier if one can use standard preprocessor macros and just call a
> function which’d make trace. I also use special macros for function
> enter and leave. In addition to ==> and <== they indent/outdent output
> and compute time elapsed in the function/block. The whole idea with
> special preprocessor for traces is IMO flawed and shows too much power
> is harmful, sometimes.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</tcusb_ioctl_get_version>

Elapsed time: I just save a timestamp to a local variable in ENTER (which opens block by { ) and substract it from current time in LEAVE (which closes block). Displaying elapsed time is quite helpful as I can see anomalies quickly when looking to the log. DebugView also displays timestamps but seeing elapsed time is much more convenient than trying to correlate ENTER/LEAVE and compute.

What about indenting? Next thing which I’d really miss.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Jose Sua[SMTP:xxxxx@windows.microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 1:42 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

You can tell WPP which are your Trace functions TTRACE_ENTER, etc

The easiest way to do this is with a config block that WPP scans, also
can be done with a command line option. See the TraceDrv sample for how
the config block works, it has detailed explanation. Also my
presentation from DevCon2005 had details.

//begin_wpp config
//USEPREFIX (TTRACE_ENTER, “%!STDPREFIX! ===>”); //here is where you
add the prefix
//FUNC TTRACE_ENTER(FLAGS,LEVEL,(MSG,…));
//end_wpp // you can also add a suffix

Not sure how you are doing the elapsed time.

But ETW logs a timestamp with the event, PID, TID, processor, and some
other values. Other starndard values are taken from the TMF, like format
string, component name, etc.
Bottom line is that you can correlate the ENTER/EXIT events to get the
elapsed time.

So yes you can do all that, and as simple as printf and better, because
we support extended format strings.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Thursday, February 15, 2007 3:38 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

I found the example before but shows only the simple case. And if I
understand correctly, %!FUNC! can’t be used in debug prints (if the
debug version of driver is built with them instead of WPP). The
presentation doesn’t contain the most interesting parts. For example at
page 31. And do you really believe this thread would even exist if WPP
accomplishes the last point at page 4 (as simple as printf…) :wink:

Well, my code usually looks like this:

NTSTATUS DispatchDevCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
TTRACE_ENTER(Ioctl, TDBG_DEBUG, (“DispatchDevCtrl(%p, %p)”,
DeviceObject, Irp));

TTRACE(Ioctl, TDBG_DEBUG, (“Processing IOCTL %x <%s> (input length:
%d, output length: %d)”,
IoctlCode, GetIoctlCodeName(IoctlCode),
InputBufferLength, OutputBufferLength));

TTRACE_LEAVE((“DispatchDevCtrl() -> %x [%d]”, Status,
ReturnedSize));
return(Status);
}

where Ioctl is trace area which contains current trace level. Traces in
different sources can and usually have different areas. Note LEAVE macro
uses ENTER parameters and measures elapsed time. The appropropriate
debug output looks like this:

0.26440164 <0:0> Ioctl[1006]: ==> DispatchDevCtrl(89D50B00,
8AA9CF20)
0.26475674 <0:0> Ioctl[1082]: Processing IOCTL 81c06070
<tcusb_ioctl_get_version> (input length: 0, output length: 16)
> 0.26480985 <0:0> Ioctl[1799]: <== (0.395) DispatchDevCtrl() -> 0
> [16]
>
> Also note indent for intermediate trace message. Is it possible to
> achieve the same effect with WPP? I don’t need to see code, just if it
> is even possible.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.>
> [xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From:
> xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
>] on behalf of Ian Service[SMTP:xxxxx@microsoft.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Thursday, February 15, 2007 10:33 PM
> > To: Windows System Software Devs Interest List
> > Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing
> >
> > I changed the subject line a little as I was getting lost with the
> > different threads.
> >
> > Regarding Function Entry/Exit tracing, there is a basic example in the
> > MSDN.
> >
> > http://msdn2.microsoft.com/en-us/library/ms797191.aspx
> >
> > and some presentation here
> >
> >
> http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204
> > a672f11cf/Software_Tracing.ppt
> >
> > They do show up in searches.
> >
> > It needs a extra function to finish what Yossi needs.
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
> > Sent: Thursday, February 15, 2007 12:41 PM
> > To: Windows System Software Devs Interest List
> > Subject: RE: [ntdev] New line in WPP trace
> >
> > > ----------
> > > From:
> >
> xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
> >] on behalf of Yossi Leybovich[SMTP:xxxxx@mellanox.co.il]
> > > Reply To: Windows System Software Devs Interest List
> > > Sent: Thursday, February 15, 2007 8:34 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: RE: [ntdev] New line in WPP trace
> > >
> > > We wrote whole bunch of networking drivers that ran in 10Gbs and in
> > > order to debug races and scenarios that happen when there is
> > > traffic load I found it very helpful to use WPP (and I think it’s
> the
> > > only way I can see output without loosing performance).
> > >
> > That’s the only reason why I still didn’t rejected the idea of using
> WPP
> > completely. But is there a real difference? When traces are turned
> > on, is there a difference between traditional approach when traces are
> > printed via DbgPrint() and captured by DebugView and WPP captured some
> > other way? In both cases there is an overhead which probably differs.
> > Does anybody have some numbers?>
> >
> > Did you see any differences between both approaches when debugging
> > races? This is the only area where my traces sometimes cause that
> > problem can’t be reproduced (but in other cases problem can be
> > reproduced only with traces :slight_smile:
> >
> > > I don’t think that event log is the right tool for tracing or
> > debugging
> > > specially not when you debug networking events in 10Gbs.
> > >
> > Sure, event log has quite different purpose.
> >
> > > Maybe there should be a way to ran preprocessor before the WPP
> > > preprocessor so one can use WPP from within macros.
> > >
> > This is one of things which discourages me. Everything would be much
> > easier if one can use standard preprocessor macros and just call a
> > function which’d make trace. I also use special macros for function
> > enter and leave. In addition to ==> and <== they indent/outdent output
> > and compute time elapsed in the function/block. The whole idea with
> > special preprocessor for traces is IMO flawed and shows too much power
> > is harmful, sometimes.
> >
> > Best regards,
> >
> > Michal Vodicka
> > UPEK, Inc.
> > [xxxxx@upek.com, http://www.upek.com]
> >
> >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at>
> http://www.osronline.com/page.cfm?name=ListServer
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
></tcusb_ioctl_get_version>

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Jose Sua[SMTP:xxxxx@windows.microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 1:42 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

//begin_wpp config
//USEPREFIX (TTRACE_ENTER, “%!STDPREFIX! ===>”); //here is where you
add the prefix
//FUNC TTRACE_ENTER(FLAGS,LEVEL,(MSG,…));
//end_wpp // you can also add a suffix

Can be prefix formatted? Like this:

USEPREFIX(TTRACE_ENTER, “%!STDPREFIX! %*s==>”, GetIndentLevel(), “”);

It’d solve indenting.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

Yes Michal, that would work, but it would be an additional parameter
that you would log with the event.

The Ideal is to not have to log a value for the indention, we had a
parameter but is not working.

But below code will work fine.

Another point that is missed on WPP is that because it uses ETW, one can
enable all the related providers to a trace session.

So if I have a scenario, where an application has ETW or WPP tracing, I
can enable the application provider GUIDs(be it several EXE and/or DLLs)
and my driver into a single trace session and collect the trace.

Thanks
Jose

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Thursday, February 15, 2007 5:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing


From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
] on behalf of Jose Sua[SMTP:xxxxx@windows.microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 1:42 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

//begin_wpp config
//USEPREFIX (TTRACE_ENTER, “%!STDPREFIX! ===>”); //here is where you
add the prefix
//FUNC TTRACE_ENTER(FLAGS,LEVEL,(MSG,…));
//end_wpp // you can also add a suffix

Can be prefix formatted? Like this:

USEPREFIX(TTRACE_ENTER, “%!STDPREFIX! %*s==>”, GetIndentLevel(), “”);

It’d solve indenting.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Jose Sua[SMTP:xxxxx@windows.microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 6:41 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

Yes Michal, that would work, but it would be an additional parameter
that you would log with the event.

Thanks, good to know. Not a problem with additional parameter; I have it now, too.

Another point that is missed on WPP is that because it uses ETW, one can
enable all the related providers to a trace session.

So if I have a scenario, where an application has ETW or WPP tracing, I
can enable the application provider GUIDs(be it several EXE and/or DLLs)
and my driver into a single trace session and collect the trace.

That’s obvious :slight_smile: I use it routinely with out standard traces, too.

What about events ordering? Are events from all providers logged in correct order?

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Friday, February 16, 2007 3:14 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing


From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com
] on behalf of Jose Sua[SMTP:xxxxx@windows.microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 1:42 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

//begin_wpp config
//USEPREFIX (TTRACE_ENTER, “%!STDPREFIX! ===>”); //here is where you
add the prefix
//FUNC TTRACE_ENTER(FLAGS,LEVEL,(MSG,…));
//end_wpp // you can also add a suffix

Can be prefix formatted? Like this:

USEPREFIX(TTRACE_ENTER, “%!STDPREFIX! %*s==>”, GetIndentLevel(), “”);

[Yossi Leybovich] Do you have simple way to calculate the indent level?
I wanted to use it in my code but I found it very complicate to
implement it if you work with user/kernel driver and layered drivers.

It’d solve indenting.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Yossi Leybovich[SMTP:xxxxx@mellanox.co.il]
Reply To: Windows System Software Devs Interest List
Sent: Friday, February 16, 2007 9:48 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP trace - Function Entry/Exit Tracing

[Yossi Leybovich] Do you have simple way to calculate the indent level?
I wanted to use it in my code but I found it very complicate to
implement it if you work with user/kernel driver and layered drivers.

Very simple. Just interlocked increment at enter and decrement at exit.

In user mode we have configurable indent level per thread, process or whole system. We use TLS and/or shared memory (named sections) for this purpose. I usually use per-thread level because this way different threads activity is easily visible and output can be filtered without disturbing other threads output.

In the kernel I just have one level per driver. I experimented with one level per CPU but it was confusing when execution migrated to other CPU. Instead, I print CPU number in the prefix.

There is no ideal solution; try to experiment to see the best for you.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]