Source File include/ta.h

    1    | #ifndef TA_H
    2    | #define TA_H
    3    |
    4    | #include <glib.h>
    5    | #include <pthread.h>
    6    | #include <stdio.h>
    7    |
    8    | #include "stubs.h"
    9    | #include "memwrap.h"
    10   | #include "sk.h"
    11   | #include "timediff.h"
    12   |
    13   | /* thread activity monitor */
    14   | #define TA_TYPE_LEN 16
    15   | #define TA_ACT_LEN 256
    16   | #define TA_PRINT_LEN (TA_ACT_LEN+64)
    17   |
    18   | typedef struct
    19   | {
    20   |   pthread_t  thread_id;                /* thread id */
    21   |   ut_timer_t sessionstart;             /* time the session started */
    22   |   ut_timer_t taskstart;                /* time the last task started */
    23   |   int        sock;                     /* socket */
    24   |   sk_conn_st *condat;                  /* sk's connection data struct */
    25   |   char       type[TA_TYPE_LEN];
    26   |   char       activity[TA_ACT_LEN];     /* current activity (eg query) */
    27   |   int        tasks;                   /* number of activities(used to calculate the average) */
    28   | } ta_str_t;
    29   |
    30   |
    31   | #ifdef TA_IMPL
    32   | /* GLOBALs (private to the module)*/
    33   | GList *ta_list = NULL;
    34   | pthread_mutex_t ta_mutex = PTHREAD_MUTEX_INITIALIZER;
    35   | #endif
    36   |
    37   | /* prototypes */
    38   | void TA_add(int  sock, char *type);
    39   | void TA_delete(void);
    40   | void TA_setactivity(char *activity);
    41   | void TA_setcondat(sk_conn_st *condat);
    42   | char * TA_tostring(void);
    43   | void TA_increment(void);
    44   | void TA_trigger(char *type, int sock, pthread_t thread_id);
    45   | void TA_reset_counters(pthread_t thread_id);
    46   | #endif