Source File modules/ta/ta.h

    1    | #ifndef TA_H
    2    | #define TA_H
    3    |
    4    | #include <glib.h>
    5    | #include <pthread.h>
    6    | #include <stubs.h>
    7    | #include <memwrap.h>
    8    | #include <stdio.h>
    9    | #include <socket.h>
    10   |
    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   |   char       type[TA_TYPE_LEN];
    25   |   char       activity[TA_ACT_LEN];     /* current activity (eg query) */
    26   |   int        tasks;                   /* number of activities(used to calculate the average) */
    27   | } ta_str_t;
    28   |
    29   |
    30   | #ifdef TA_IMPL
    31   | /* GLOBALs (private to the module)*/
    32   | GList *ta_list = NULL;
    33   | pthread_mutex_t ta_mutex = PTHREAD_MUTEX_INITIALIZER;
    34   | #endif
    35   |
    36   | /* prototypes */
    37   | void TA_add(int sock, char *type);
    38   | void TA_delete(void);
    39   | void TA_setactivity(char *activity);
    40   | char * TA_tostring(void);
    41   | void TA_increment(void);
    42   | #endif