kernel/eka/include/drivers/resmanus_trace.h
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
    24 */
    24 */
    25 #ifndef __RESMANUSCONTROL_TRACE_H__
    25 #ifndef __RESMANUSCONTROL_TRACE_H__
    26 #define __RESMANUSCONTROL_TRACE_H__
    26 #define __RESMANUSCONTROL_TRACE_H__
    27 #ifdef BTRACE_RESMANUS
    27 #ifdef BTRACE_RESMANUS
    28 
    28 
       
    29 //Function to format the output.
       
    30 static void UsTraceFormatPrint(TDes8& aBuf, const char* aFmt, ...)
       
    31 	{
       
    32 	if(!(&aBuf))
       
    33 		return;
       
    34 	VA_LIST list;
       
    35 	VA_START(list,aFmt);
       
    36 	Kern::AppendFormat(aBuf,aFmt,list);
       
    37 	}
       
    38 
    29 //definition of subcategories.
    39 //definition of subcategories.
    30 #define PRM_US_OPEN_CHANNEL_START				BTrace::EOpenChannelUsStart
    40 #define PRM_US_OPEN_CHANNEL_START				BTrace::EOpenChannelUsStart
    31 #define PRM_US_OPEN_CHANNEL_END					BTrace::EOpenChannelUsEnd
    41 #define PRM_US_OPEN_CHANNEL_END					BTrace::EOpenChannelUsEnd
    32 #define PRM_US_REGISTER_CLIENT_START			BTrace::ERegisterClientUsStart
    42 #define PRM_US_REGISTER_CLIENT_START			BTrace::ERegisterClientUsStart
    33 #define PRM_US_REGISTER_CLIENT_END				BTrace::ERegisterClientUsEnd
    43 #define PRM_US_REGISTER_CLIENT_END				BTrace::ERegisterClientUsEnd
    40 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START  BTrace::ECancelGetResourceStateUsStart
    50 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START  BTrace::ECancelGetResourceStateUsStart
    41 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END	BTrace::ECancelGetResourceStateUsEnd
    51 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END	BTrace::ECancelGetResourceStateUsEnd
    42 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START	BTrace::ECancelSetResourceStateUsStart
    52 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START	BTrace::ECancelSetResourceStateUsStart
    43 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END	BTrace::ECancelSetResourceStateUsEnd
    53 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END	BTrace::ECancelSetResourceStateUsEnd
    44 
    54 
    45 #define APPEND_VAL(val)                                                                        \
       
    46     {                                                                                               \
       
    47     printBuf.Append((TUint8 *)&(val), sizeof(val));                                                       \
       
    48     }     
       
    49 #define APPEND_STRING(des_ptr)                                                                           \
       
    50     {                                                                                               \
       
    51     TUint length = (des_ptr)->Length();                                                              \
       
    52     printBuf.Append((TUint8 *)&length, sizeof(TUint));                                                     \
       
    53     printBuf.Append(*(des_ptr));                                                                       \
       
    54     }
       
    55 
       
    56 // Macro to output identification information provided in a request to open a channel
    55 // Macro to output identification information provided in a request to open a channel
    57 #define PRM_US_OPEN_CHANNEL_START_TRACE						\
    56 #define PRM_US_OPEN_CHANNEL_START_TRACE						\
    58 	{														\
    57 	{														\
    59 	Kern::Printf("PRM_US_OPEN_CHANNEL_START_TRACE");\
    58     TBuf8<256> printBuf;									\
    60 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_START, (TInt)(iClient), iUserNameUsed->Length(), iUserNameUsed->Ptr(), iUserNameUsed->Length()); \
    59     printBuf.Zero();										\
       
    60     UsTraceFormatPrint(printBuf, "%S", iUserNameUsed);	\
       
    61 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_START, 0, (TInt)(iClient), printBuf.Ptr(), printBuf.Length()); \
    61 	}
    62 	}
    62 
    63 
    63 // Macro to output identification information generated during a request to open a channel
    64 // Macro to output identification information generated during a request to open a channel
    64 #define PRM_US_OPEN_CHANNEL_END_TRACE						\
    65 #define PRM_US_OPEN_CHANNEL_END_TRACE						\
    65 	{														\
    66 	{														\
    66 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_END, (TInt)(ClientHandle()), iUserNameUsed->Length(), iUserNameUsed->Ptr(), iUserNameUsed->Length()); \
    67     TBuf8<256> printBuf;									\
       
    68     printBuf.Zero();										\
       
    69     UsTraceFormatPrint(printBuf, "%S", iUserNameUsed);		\
       
    70 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_END, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
    67 	}
    71 	}
    68 
    72 
    69 // Macro to output information provided for a request to register with the Resource Controller
    73 // Macro to output information provided for a request to register with the Resource Controller
    70 #define PRM_US_REGISTER_CLIENT_START_TRACE					\
    74 #define PRM_US_REGISTER_CLIENT_START_TRACE					\
    71 	{														\
    75 	{														\
    72     TUint32 stateRes32 = ((stateRes[0]&0xFF) << 16) | ((stateRes[1]&0xFF) << 8) | ((stateRes[2]&0xFF));\
    76     TBuf8<256> printBuf;									\
    73     TBuf8<80> printBuf;									\
       
    74     printBuf.Zero();										\
    77     printBuf.Zero();										\
    75     APPEND_STRING(iUserNameUsed);                      \
    78     UsTraceFormatPrint(printBuf, "%S 0x%x %d", iUserNameUsed, (TInt)(ClientHandle()),(TInt)(stateRes[0]));	\
    76 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_START, (TInt)ClientHandle(), stateRes32, printBuf.Ptr(), printBuf.Length()); \
    79 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_START, (TInt)(stateRes[1]), (TInt)(stateRes[2]), printBuf.Ptr(), printBuf.Length()); \
    77 	}
    80 	}
    78 
    81 
    79 // Macro to output information after issuing a request to register with the Resource Controller
    82 // Macro to output information after issuing a request to register with the Resource Controller
    80 #define PRM_US_REGISTER_CLIENT_END_TRACE					\
    83 #define PRM_US_REGISTER_CLIENT_END_TRACE					\
    81 	{														\
    84 	{														\
    83 	}
    86 	}
    84 
    87 
    85 // Macro to output information provided for a request to de-register with the Resource Controller
    88 // Macro to output information provided for a request to de-register with the Resource Controller
    86 #define PRM_US_DEREGISTER_CLIENT_START_TRACE				\
    89 #define PRM_US_DEREGISTER_CLIENT_START_TRACE				\
    87 	{														\
    90 	{														\
    88 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_START, (TInt)(ClientHandle()), iUserNameUsed->Length(), iUserNameUsed->Ptr(), iUserNameUsed->Length()); \
    91     TBuf8<256> printBuf;									\
       
    92     printBuf.Zero();										\
       
    93     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
    94 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_START, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
    89 	}
    95 	}
    90 
    96 
    91 // Macro to output information after issuing a request to de-register with the Resource Controller
    97 // Macro to output information after issuing a request to de-register with the Resource Controller
    92 #define PRM_US_DEREGISTER_CLIENT_END_TRACE					\
    98 #define PRM_US_DEREGISTER_CLIENT_END_TRACE					\
    93 	{														\
    99 	{														\
    95 	}
   101 	}
    96 
   102 
    97 // Macro to output information provided for a request to get the state of a resource
   103 // Macro to output information provided for a request to get the state of a resource
    98 #define PRM_US_GET_RESOURCE_STATE_START_TRACE				\
   104 #define PRM_US_GET_RESOURCE_STATE_START_TRACE				\
    99 	{														\
   105 	{														\
   100     TBuf8<80> printBuf;                                    \
   106     TBuf8<256> printBuf;									\
   101     printBuf.Zero();                                        \
   107     printBuf.Zero();										\
   102     APPEND_STRING(iUserNameUsed);                      \
   108     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
   103 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_START, resourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   109 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_START, resourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   104 	}
   110 	}
   105 
   111 
   106 // Macro to output information on completion of a request to get the state of a resource
   112 // Macro to output information on completion of a request to get the state of a resource
   107 #define PRM_US_GET_RESOURCE_STATE_END_TRACE					\
   113 #define PRM_US_GET_RESOURCE_STATE_END_TRACE					\
   108 	{														\
   114 	{														\
   109     TBuf8<80> printBuf;									\
   115     TBuf8<256> printBuf;									\
   110     printBuf.Zero();										\
   116     printBuf.Zero();										\
   111     APPEND_VAL(aClient);                                    \
   117     UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult);	\
   112     APPEND_VAL(aResult);                                    \
       
   113 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
   118 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
   114 	}
   119 	}
   115 
   120 
   116 // Macro to output information provided for a request to set the state of a resource
   121 // Macro to output information provided for a request to set the state of a resource
   117 #define PRM_US_SET_RESOURCE_STATE_START_TRACE				\
   122 #define PRM_US_SET_RESOURCE_STATE_START_TRACE				\
   118 	{														\
   123 	{														\
   119     TBuf8<80> printBuf;									\
   124     TBuf8<256> printBuf;									\
   120     printBuf.Zero();										\
   125     printBuf.Zero();										\
   121     TInt ch = ClientHandle();                               \
   126     UsTraceFormatPrint(printBuf, "%S %d", iUserNameUsed, (TInt)(ClientHandle()));	\
   122     APPEND_VAL(ch);                                         \
       
   123     APPEND_STRING(iUserNameUsed);                      \
       
   124 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_START, resourceId, newState, printBuf.Ptr(), printBuf.Length()); \
   127 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_START, resourceId, newState, printBuf.Ptr(), printBuf.Length()); \
   125 	}
   128 	}
   126 
   129 
   127 // Macro to output information on completion of a request to set the state of a resource
   130 // Macro to output information on completion of a request to set the state of a resource
   128 #define PRM_US_SET_RESOURCE_STATE_END_TRACE					\
   131 #define PRM_US_SET_RESOURCE_STATE_END_TRACE					\
   129 	{														\
   132 	{														\
   130     TBuf8<80> printBuf;									\
   133     TBuf8<256> printBuf;									\
   131     printBuf.Zero();										\
   134     printBuf.Zero();										\
   132     APPEND_VAL(aClient);                                    \
   135     UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult);	\
   133     APPEND_VAL(aResult);                                    \
       
   134 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
   136 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
   135 	}
   137 	}
   136 
   138 
   137 // Macro to output information provided for a request to cancel the get resource state requests for a resource
   139 // Macro to output information provided for a request to cancel the get resource state requests for a resource
   138 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE		\
   140 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE		\
   139 	{														\
   141 	{														\
   140     TBuf8<80> printBuf;                                    \
   142     TBuf8<256> printBuf;									\
   141     printBuf.Zero();                                        \
   143     printBuf.Zero();										\
   142     APPEND_STRING(iUserNameUsed);                      \
   144     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
   143 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   145 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   144 	}
   146 	}
   145 
   147 
   146 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
   148 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
   147 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE			\
   149 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE			\
   148 	{														\
   150 	{														\
   149     TBuf8<80> printBuf;                                    \
   151     TBuf8<256> printBuf;									\
   150     printBuf.Zero();                                        \
   152     printBuf.Zero();										\
   151     APPEND_STRING(iUserNameUsed);                      \
   153     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
   152 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   154 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   153 	}
   155 	}
   154 
   156 
   155 // Macro to output information provided for a request to cancel the set resource state requests for a resource
   157 // Macro to output information provided for a request to cancel the set resource state requests for a resource
   156 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE		\
   158 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE		\
   157 	{														\
   159 	{														\
   158     TBuf8<80> printBuf;                                    \
   160     TBuf8<256> printBuf;									\
   159     printBuf.Zero();                                        \
   161     printBuf.Zero();										\
   160     APPEND_STRING(iUserNameUsed);                      \
   162     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
   161 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   163 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   162 	}
   164 	}
   163 
   165 
   164 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
   166 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
   165 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE			\
   167 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE			\
   166 	{														\
   168 	{														\
   167     TBuf8<80> printBuf;                                    \
   169     TBuf8<256> printBuf;									\
   168     printBuf.Zero();                                        \
   170     printBuf.Zero();										\
   169     APPEND_STRING(iUserNameUsed);                      \
   171     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
   170 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   172 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
   171 	}
   173 	}
   172 
   174 
   173 
   175 
   174 #else
   176 #else