Navigation


Changeset 895:fbf77629cb7b in freeDiameter for include


Ignore:
Timestamp:
Nov 30, 2012, 8:44:10 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Added received and sent timestamps in the messages; added logs on emission and reception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r894 r895  
    203203#define FCTS 6  /* Display entry parameters of most functions */
    204204#define CALL 9  /* Display calls to most functions (with CHECK macros) */
    205 
    206 #define TIMING INFO /* Display the message handing time information with this level */
    207205
    208206/* Increment the debug level for a file at compilation time by defining -DTRACE_LEVEL=FULL for example. */
     
    596594          || (((ts1)->tv_sec  == (ts2)->tv_sec ) && ((ts1)->tv_nsec < (ts2)->tv_nsec) ))
    597595
     596/* Compute diff between two timespecs (pointers) */
     597#define TS_DIFFERENCE( tsdiff, tsstart, tsend ) {                                       \
     598        if ((tsend)->tv_nsec < (tsstart)->tv_nsec ) {                                   \
     599                (tsdiff)->tv_sec = (tsend)->tv_sec - (tsstart)->tv_sec - 1;             \
     600                (tsdiff)->tv_nsec = (tsend)->tv_nsec + 1000000000 - (tsstart)->tv_nsec; \
     601        } else {                                                                        \
     602                (tsdiff)->tv_sec  = (tsend)->tv_sec  - (tsstart)->tv_sec;               \
     603                (tsdiff)->tv_nsec = (tsend)->tv_nsec - (tsstart)->tv_nsec;              \
     604        }}
     605               
     606
    598607/* This gives a good size for buffered reads */
    599608#ifndef BUFSIZ
     
    22212230        FD_MSG_LOG_RECEIVED,     /* message received from the network */
    22222231        FD_MSG_LOG_SENT,         /* message sent to another peer */
    2223         FD_MSG_LOG_NODELIVER     /* message could not be delivered to any peer */
    2224 };
    2225 #define FD_MSG_LOG_MAX FD_MSG_LOG_NODELIVER
     2232        FD_MSG_LOG_NODELIVER,    /* message could not be delivered to any peer */
     2233        FD_MSG_LOG_TIMING        /* profiling messages */
     2234};
     2235#define FD_MSG_LOG_MAX FD_MSG_LOG_TIMING
    22262236void fd_msg_log( enum fd_msg_log_cause cause, struct msg * msg, const char * prefix_format, ... );
    22272237
     
    23842394int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict );
    23852395int fd_msg_source_get( struct msg * msg, DiamId_t *diamid, size_t * diamidlen );
     2396
     2397/*
     2398 * FUNCTION:    fd_msg_ts_*
     2399 *
     2400 * PARAMETERS:
     2401 *  msg         : A msg object.
     2402 *  ts          : A struct timespec pointer, indexed on CLOCK_REALTIME
     2403 *
     2404 * DESCRIPTION:
     2405 *   Associate or retrieve timestamps meaningful for the message.
     2406 *  A timestamp with a value of { 0, 0 } means: not set.
     2407 *
     2408 * RETURN VALUE:
     2409 *  0           : Operation complete.
     2410 *  !0          : an error occurred.
     2411 */
     2412/* when msg was received from network */
     2413int fd_msg_ts_set_recv( struct msg * msg, struct timespec * ts );
     2414int fd_msg_ts_get_recv( struct msg * msg, struct timespec * ts );
     2415int fd_msg_ts_set_sent( struct msg * msg, struct timespec * ts );
     2416int fd_msg_ts_get_sent( struct msg * msg, struct timespec * ts );
     2417
    23862418
    23872419/*
Note: See TracChangeset for help on using the changeset viewer.