version 1.1.1.1, 2012/02/21 17:26:12
|
version 1.1.1.3, 2013/07/21 23:54:39
|
Line 1
|
Line 1
|
/* Thread management routine header. |
/* Thread management routine header. |
* Copyright (C) 1998 Kunihiro Ishiguro |
* Copyright (C) 1998 Kunihiro Ishiguro |
|
* Portions Copyright (c) 2008 Everton da Silva Marques <everton.marques@gmail.com> |
* |
* |
* This file is part of GNU Zebra. |
* This file is part of GNU Zebra. |
* |
* |
Line 22
|
Line 23
|
#ifndef _ZEBRA_THREAD_H |
#ifndef _ZEBRA_THREAD_H |
#define _ZEBRA_THREAD_H |
#define _ZEBRA_THREAD_H |
|
|
|
#include <zebra.h> |
|
|
struct rusage_t |
struct rusage_t |
{ |
{ |
#ifdef HAVE_RUSAGE |
#ifdef HAVE_RUSAGE |
Line 59 struct thread_master
|
Line 62 struct thread_master
|
|
|
typedef unsigned char thread_type; |
typedef unsigned char thread_type; |
|
|
|
/* ISO C99 maximum function name length is 63 */ |
|
#define FUNCNAME_LEN 64 |
|
|
/* Thread itself. */ |
/* Thread itself. */ |
struct thread |
struct thread |
{ |
{ |
Line 74 struct thread
|
Line 80 struct thread
|
int fd; /* file descriptor in case of read/write. */ |
int fd; /* file descriptor in case of read/write. */ |
struct timeval sands; /* rest of time sands value. */ |
struct timeval sands; /* rest of time sands value. */ |
} u; |
} u; |
RUSAGE_T ru; /* Indepth usage info. */ | struct timeval real; |
struct cpu_thread_history *hist; /* cache pointer to cpu_history */ |
struct cpu_thread_history *hist; /* cache pointer to cpu_history */ |
char* funcname; | char funcname[FUNCNAME_LEN]; |
}; |
}; |
|
|
struct cpu_thread_history |
struct cpu_thread_history |
{ |
{ |
int (*func)(struct thread *); |
int (*func)(struct thread *); |
char *funcname; |
|
unsigned int total_calls; |
unsigned int total_calls; |
struct time_stats |
struct time_stats |
{ |
{ |
Line 92 struct cpu_thread_history
|
Line 97 struct cpu_thread_history
|
struct time_stats cpu; |
struct time_stats cpu; |
#endif |
#endif |
thread_type types; |
thread_type types; |
|
char funcname[FUNCNAME_LEN]; |
}; |
}; |
|
|
/* Clocks supported by Quagga */ |
/* Clocks supported by Quagga */ |
Line 135 enum quagga_clkid {
|
Line 141 enum quagga_clkid {
|
do { \ |
do { \ |
if (! thread) \ |
if (! thread) \ |
thread = thread_add_timer (master, func, arg, time); \ |
thread = thread_add_timer (master, func, arg, time); \ |
|
} while (0) |
|
|
|
#define THREAD_TIMER_MSEC_ON(master,thread,func,arg,time) \ |
|
do { \ |
|
if (! thread) \ |
|
thread = thread_add_timer_msec (master, func, arg, time); \ |
} while (0) |
} while (0) |
|
|
#define THREAD_OFF(thread) \ |
#define THREAD_OFF(thread) \ |