File modules/ta/ta.c

  $Revision: 1.2 $

thread accounting (ta). ta.c - functions to keep track of activities of threads within the server
Status: NOT REVUED, TESTED, COMPLETE
Design and implementation by: Marek Bukowy

Included Files


Preprocessor definitions

#define TA_IMPL

#define TA_HEADER "%-8s %15s %4s %4s %5s %5s %4s %5s %s\n"

#define TA_FORMAT "%-8s %15s %4d %4d %5.1f %5.1f %4d %5.2f %s\n"


Global Variable ta_list

GList* ta_list
Included from include/ta.h
Visible in:  modules/ta/ta.c
Used in: TA_add()modules/ta/ta.c
  TA_delete()modules/ta/ta.c
  TA_increment()modules/ta/ta.c
  TA_setactivity()modules/ta/ta.c
  TA_tostring()modules/ta/ta.c

Global Variable ta_mutex

pthread_mutex_t ta_mutex
Included from include/ta.h
Visible in:  modules/ta/ta.c
Used in: TA_add()modules/ta/ta.c
  TA_delete()modules/ta/ta.c
  TA_increment()modules/ta/ta.c
  TA_setactivity()modules/ta/ta.c
  TA_tostring()modules/ta/ta.c

Global Function TA_add()

void TA_add ( int sock, char* type )
Prototyped in: include/ta.h
Calls: ta_findcreate_l()modules/ta/ta.c
  ta_setactivity_l()modules/ta/ta.c
  UT_timeget(), pthread_mutex_lock(), pthread_mutex_unlock(), pthread_self(), snprintf()
Called by: PM_interact()modules/pm/protocol_mirror.c
  SV_do_config()modules/sv/server.c
  SV_do_mirror()modules/sv/server.c
  SV_do_whois()modules/sv/server.c
References Variables: ta_listmodules/ta/ta.c
  ta_mutexmodules/ta/ta.c

Global Function TA_delete()

void TA_delete ( void )
Prototyped in: include/ta.h
Calls: ta_remove_l()modules/ta/ta.c
  pthread_mutex_lock(), pthread_mutex_unlock(), pthread_self()
Called by: PM_interact()modules/pm/protocol_mirror.c
  SV_do_config()modules/sv/server.c
  SV_do_mirror()modules/sv/server.c
  SV_do_whois()modules/sv/server.c
References Variables: ta_listmodules/ta/ta.c
  ta_mutexmodules/ta/ta.c

Global Function TA_increment()

void TA_increment ( void )
Calls: ta_findcreate_l()modules/ta/ta.c
  UT_timeget(), pthread_mutex_lock(), pthread_mutex_unlock(), pthread_self()
Called by: PC_interact()modules/pc/protocol_config.c
  PW_interact()modules/pw/protocol_whois.c
References Variables: ta_listmodules/ta/ta.c
  ta_mutexmodules/ta/ta.c

Global Function TA_setactivity()

void TA_setactivity ( char* activity )
Prototyped in: include/ta.h
Calls: ta_findcreate_l()modules/ta/ta.c
  ta_setactivity_l()modules/ta/ta.c
  pthread_mutex_lock(), pthread_mutex_unlock(), pthread_self()
Called by: PC_interact()modules/pc/protocol_config.c
  PM_interact()modules/pm/protocol_mirror.c
  PW_interact()modules/pw/protocol_whois.c
References Variables: ta_listmodules/ta/ta.c
  ta_mutexmodules/ta/ta.c

Global Function TA_tostring()

char* TA_tostring ( void )
Prototyped in: include/ta.h
Calls: NOERR()modules/er/er.c
  ta_print_header()modules/ta/ta.c
  ta_printone_l()modules/ta/ta.c
  UT_timeget(), fprintf(), g_list_first(), pthread_mutex_lock(), pthread_mutex_unlock(), strcat(), strlen(), wr_real_realloc()
Called by: show_threads()modules/pc/protocol_config.c
References Variables: ta_listmodules/ta/ta.c
  ta_mutexmodules/ta/ta.c

Local Function ta_findcreate_l()

static ta_str_t* ta_findcreate_l ( GList** list, pthread_t thread_id )
Calls: NOERR()modules/er/er.c
  fprintf(), g_list_append(), g_list_first(), wr_real_calloc()
Called by: TA_add()modules/ta/ta.c
  TA_increment()modules/ta/ta.c
  TA_setactivity()modules/ta/ta.c

Local Function ta_print_header()

static void ta_print_header ( char* buf, int length )
Calls: snprintf()
Called by: TA_tostring()modules/ta/ta.c

Local Function ta_printone_l()

static void ta_printone_l ( ta_str_t* tas, char* buf, int length, ut_timer_t* reftime )
Calls: SK_getpeername()modules/sk/sk_socket.c
  UT_timediff(), snprintf(), wr_real_free()
Called by: TA_tostring()modules/ta/ta.c

Local Function ta_remove_l()

static void ta_remove_l ( GList** list, pthread_t thread_id )
Calls: g_list_first(), g_list_remove_link(), wr_real_clear_list()
Called by: TA_delete()modules/ta/ta.c

Local Function ta_setactivity_l()

static void ta_setactivity_l ( ta_str_t* tas, char* activity )
Calls: strncpy(), strrchr()
Called by: TA_add()modules/ta/ta.c
  TA_setactivity()modules/ta/ta.c