File: stats.h

package info (click to toggle)
atftp 0.7.dfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,144 kB
  • ctags: 538
  • sloc: ansic: 6,384; sh: 3,892; makefile: 81
file content (62 lines) | stat: -rw-r--r-- 2,018 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
/*
 * stats.h
 *
 * $Id: stats.h,v 1.3 2000/12/27 17:02:23 jp Exp $
 *
 * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca>
 *                and Remi Lefebvre <remi@debian.org>
 *
 * atftp is free software; you can redistribute them and/or modify them
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 */

#ifndef stats_h
#define stats_h

#include <pthread.h>
#include <sys/time.h>
#include <sys/times.h>

/* structure to collect some stats */
struct server_stats {
     /* updated by main thread */
     struct timeval start_time;
     struct timeval end_time;
     struct tms tms;
     
     /* connection statistics, updated by main thread */
     int max_simul_threads;     /* maximum number of simultaneous server */
     struct timeval min_time;   /* time between connection stats */
     struct timeval max_time;
     struct timeval curr_time;  /* temporary usage for calculation */
     struct timeval prev_time;
     struct timeval diff_time;

     /* updated by server thread */
     pthread_mutex_t mutex;
     struct tms tms_thread;
     int number_of_server;      /* number of server that return successfully */
     int number_of_abort;       /* when number max of client is reached */
     int number_of_err;         /* send or receive that return with error */
     int num_file_send;
     int num_file_recv;
     int byte_send;             /* total byte transfered to client (file) */
     int byte_recv;             /* total byte read from client (file) */
};

/* Functions defined in stats.c */
void stats_start(void);
void stats_end(void);
void stats_send_locked(void);
void stats_recv_locked(void);
void stats_err_locked(void);
void stats_abort_locked(void);
void stats_new_thread(int number_of_thread);
void stats_thread_usage_locked(void);
void stats_print(void);

#endif