## include/ta.h

/* [<][>][^][v][top][bottom][index][help] */

## FUNCTIONS

This source file includes following functions.

       1 /******************
       2   Copyright (c) 2002                                        RIPE NCC
       3
       4   All Rights Reserved
       5
       6   Permission to use, copy, modify, and distribute this software and its
       7   documentation for any purpose and without fee is hereby granted,
       8   provided that the above copyright notice appear in all copies and that
       9   both that copyright notice and this permission notice appear in
      10   supporting documentation, and that the name of the author not be
      11   used in advertising or publicity pertaining to distribution of the
      12   software without specific, written prior permission.
      13
      14   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      15   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      16   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      17   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      18   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      19   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      20   ***************************************/
      21
      22 #ifndef TA_H
      23 #define TA_H
      24
      25 #include <glib.h>
      26 #include <pthread.h>
      27 #include <stdio.h>
      28
      29 #include "stubs.h"
      30 #include "memwrap.h"
      31 #include "sk.h"
      32 #include "timediff.h"
      33
      34 /* thread activity monitor */
      35 #define TA_TYPE_LEN 16
      36 #define TA_ACT_LEN 256
      37 #define TA_PRINT_LEN (TA_ACT_LEN+64)
      38
      39 typedef struct
      40 {
      41   pthread_t  thread_id;                /* thread id */
      42   ut_timer_t sessionstart;             /* time the session started */
      43   ut_timer_t taskstart;                /* time the last task started */
      44   int        sock;                     /* socket */
      45   sk_conn_st *condat;                  /* sk's connection data struct */
      46   char       type[TA_TYPE_LEN];
      47   char       activity[TA_ACT_LEN];     /* current activity (eg query) */
      48   int        tasks;                   /* number of activities(used to calculate the average) */
      49 } ta_str_t;
      50
      51
      52 #ifdef TA_IMPL
      53 /* GLOBALs (private to the module)*/
      54 GList *ta_list = NULL;
      55 pthread_mutex_t ta_mutex = PTHREAD_MUTEX_INITIALIZER;
      56 #endif
      57
      58 #ifdef __cplusplus
      59 extern "C" {
      60 #endif
      61
      62
      63 /* prototypes */
      64 void TA_add(int  sock, char *type);
      65 void TA_delete(void);
      66 void TA_setactivity(char *activity);
      67 void TA_setcondat(sk_conn_st *condat);
      68 char * TA_tostring(void);
      69 void TA_increment(void);
      70 void TA_trigger(char *type, int sock, pthread_t thread_id);
      71 void TA_reset_counters(pthread_t thread_id);
      72
      73 #ifdef __cplusplus
      74 }
      75 #endif
      76
      77
      78 #endif
      79

/* [<][>][^][v][top][bottom][index][help] */