module jacorb {
    module util {
        module tracing
        {
            const long TracingContextID = 0xff00ff00;

            typedef long PointId;
            typedef long long RequestId;
            typedef long long MSec;
            
            struct Request{
                PointId originator;
                RequestId rid;
                //rid is 64 bit long
                //MSB|      32 bit        |   16 bit   |  16 bit  |LSB
                //   |  target.hashCode() | originator | GIOP rid |
            };
         
            struct TraceData {
                sequence <TraceData> subtrace;

                // id of the position that logs this
                PointId tracer_id;

                string operation;

                MSec client_time;
                MSec trace_system_time;   
            };

            interface TracingService
            {                    
                PointId get_id();                
                
                exception NoSuchRequestId {};
                
                /* retrive trace data for a call */
                
                TraceData getTrace( in Request source ) 
                    raises (NoSuchRequestId);
                
                /* log trace data for a call trace */
                
                oneway void logTraceAtPoint( in Request origin,
                                             in string operation,
                                             in MSec client_time,
                                             in MSec server_time )
                    raises (NoSuchRequestId);

                /* registers a trace as a subtrace in another */

                oneway void registerSubTrace(
                          in Request original, // original call
                          in Request nested ) // nested call
                    raises (NoSuchRequestId);
            };

        };
    };
};
