1/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
2/*
3 * stats.h
4 *
5 * $Id: stats.h,v 1.3 2000/12/27 17:02:23 jp Exp $
6 *
7 * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca>
8 *                and Remi Lefebvre <remi@debian.org>
9 *
10 * atftp is free software; you can redistribute them and/or modify them
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef stats_h
18#define stats_h
19
20#include <pthread.h>
21#include <sys/time.h>
22#include <sys/times.h>
23
24/* structure to collect some stats */
25struct server_stats {
26     /* updated by main thread */
27     struct timeval start_time;
28     struct timeval end_time;
29     struct tms tms;
30
31     /* connection statistics, updated by main thread */
32     int max_simul_threads;     /* maximum number of simultaneous server */
33     struct timeval min_time;   /* time between connection stats */
34     struct timeval max_time;
35     struct timeval curr_time;  /* temporary usage for calculation */
36     struct timeval prev_time;
37     struct timeval diff_time;
38
39     /* updated by server thread */
40     pthread_mutex_t mutex;
41     struct tms tms_thread;
42     int number_of_server;      /* number of server that return successfully */
43     int number_of_abort;       /* when number max of client is reached */
44     int number_of_err;         /* send or receive that return with error */
45     int num_file_send;
46     int num_file_recv;
47     int byte_send;             /* total byte transfered to client (file) */
48     int byte_recv;             /* total byte read from client (file) */
49};
50
51/* Functions defined in stats.c */
52void stats_start(void);
53void stats_end(void);
54void stats_send_locked(void);
55void stats_recv_locked(void);
56void stats_err_locked(void);
57void stats_abort_locked(void);
58void stats_new_thread(int number_of_thread);
59void stats_thread_usage_locked(void);
60void stats_print(void);
61
62#endif
63