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