This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / kernel / vserver / cacct_proc.h
1 #ifndef _VX_CACCT_PROC_H
2 #define _VX_CACCT_PROC_H
3
4 #include <linux/vserver/cacct_int.h>
5
6
7 #define VX_SOCKA_TOP    \
8         "Type\t    recv #/bytes\t\t   send #/bytes\t\t    fail #/bytes\n"
9
10 static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer)
11 {
12         int i,j, length = 0;
13         static char *type[VXA_SOCK_SIZE] = {
14                 "UNSPEC", "UNIX", "INET", "INET6", "PACKET", "OTHER" };
15
16         length += sprintf(buffer + length, VX_SOCKA_TOP);
17         for (i=0; i<VXA_SOCK_SIZE; i++) {
18                 length += sprintf(buffer + length,
19                         "%s:", type[i]);
20                 for (j=0; j<3; j++) {
21                         length += sprintf(buffer + length,
22                                 "\t%10lu/%-10lu"
23                                 ,vx_sock_count(cacct, i, j)
24                                 ,vx_sock_total(cacct, i, j)
25                                 );
26                 }
27                 buffer[length++] = '\n';
28         }
29
30         length += sprintf(buffer + length, "\n");
31         length += sprintf(buffer + length,
32                 "slab:\t %8u %8u %8u %8u\n"
33                 ,atomic_read(&cacct->slab[1])
34                 ,atomic_read(&cacct->slab[4])
35                 ,atomic_read(&cacct->slab[0])
36                 ,atomic_read(&cacct->slab[2])
37                 );
38
39         length += sprintf(buffer + length, "\n");
40         for (i=0; i<5; i++) {
41                 length += sprintf(buffer + length,
42                         "page[%d]: %8u %8u %8u %8u\t %8u %8u %8u %8u\n"
43                         ,i
44                         ,atomic_read(&cacct->page[i][0])
45                         ,atomic_read(&cacct->page[i][1])
46                         ,atomic_read(&cacct->page[i][2])
47                         ,atomic_read(&cacct->page[i][3])
48                         ,atomic_read(&cacct->page[i][4])
49                         ,atomic_read(&cacct->page[i][5])
50                         ,atomic_read(&cacct->page[i][6])
51                         ,atomic_read(&cacct->page[i][7])
52                         );
53         }
54
55         return length;
56 }
57
58 #endif  /* _VX_CACCT_PROC_H */