Hi
I am able to use multiple flags in DoTraceMessage and DoTraceLevelMessage
but i just want to confirm that what i am doing is right or not or is their
any simple and easy way to achieve the same.
Basically i have made the following changes. Suppose we are using three
flags
Error, Noise and Unusual
then we have to define
#define WPP_BIT_Error Error
#define WPP_BIT_Noise Noise
#define WPP_BIT_Unusual Unusual
The purpose of defining these three #defines is to use Error instead of
WPP_BIT_Error in the whole code
also we need to define few macros
#define WPP_LEVEL_ENABLED(CTL) (WPP_CONTROL(CTL).Flags[WPP_FLAG_NO(CTL)] &
Var(CTL))
#define WPP_LEVEL_FLAGS_LOGGER(level,flags) WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAGS_ENABLED(level, flags) (WPP_LEVEL_ENABLED(flags) &&
WPP_CONTROL(flags).Level >= level)
the purpose of defining these macros is to override by default macro and to
provide our own. I have changed the definition of first macro a bit
suppose I want to log based upon two flags
DoTraceMessage(Error | Noise,“IOCTL count is %d”, ioctlcount);
since the value of Error is 1 and the value of Noise is 2 so we have to
device a mechnism to compute 2pow(0) | 2pow(1).
for doing the same I have define a struct and overload | (bitwise OR)
operator and computed 2pow(0) | 2pow(1).
struct A
{
A()
{
val = 0;
}
int Result ()
{
int ret=val;
val=0;
return ret;
}
A& operator | (int pval)
{
val |= 1<<(pval - 1);
return *this;
}
int val;
};
extern A obj;
#define Var(exp) (obj|exp).Result()
I guess it will work fine. Please suggest me if you find any bug in this
approach. I have sompiled the code and also seen the C-preprocessor output
and observe that everything is expected as i want. Note that Var macro is
used inside WPP_LEVEL_ENABLED macro
Regards
Rohit Gauba
On Tue, Mar 3, 2009 at 11:49 AM, Amit Kulkarni > wrote:
> Hi Rohit,
>
> Please go through http://msdn.microsoft.com/en-us/library/ms793169.aspx
>
> The flags that you are talking about are from WPP_CONTROL_GUIDS and first
> parameter to DoTraceLevelMessage is ETW Level defined in evntrace.h. So that
> is the difference.
>
> And what I have explained in previous post is explanation of the flags in
> WPP_CONTROL_GUIDS and not of ETW Level.
> Thanks & Regards,
> Amit.
>
> ------------------------------
> Did you know? You can CHAT without downloading messenger. Click herehttp:</http:>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
–
Regards
Rohit Gauba
“A positive thought is the seed of a positive result”