xref: /dflybsd-src/usr.bin/top/top.h (revision 8ea225a86ebb665d298184a86bbe59a602191a76)
1dc4f0af1Szrj /*
2dc4f0af1Szrj  * Copyright (c) 1984 through 2008, William LeFebvre
3dc4f0af1Szrj  * All rights reserved.
4dc4f0af1Szrj  *
5dc4f0af1Szrj  * Redistribution and use in source and binary forms, with or without
6dc4f0af1Szrj  * modification, are permitted provided that the following conditions are met:
7dc4f0af1Szrj  *
8dc4f0af1Szrj  *     * Redistributions of source code must retain the above copyright
9dc4f0af1Szrj  * notice, this list of conditions and the following disclaimer.
10dc4f0af1Szrj  *
11dc4f0af1Szrj  *     * Redistributions in binary form must reproduce the above
12dc4f0af1Szrj  * copyright notice, this list of conditions and the following disclaimer
13dc4f0af1Szrj  * in the documentation and/or other materials provided with the
14dc4f0af1Szrj  * distribution.
15dc4f0af1Szrj  *
16dc4f0af1Szrj  *     * Neither the name of William LeFebvre nor the names of other
17dc4f0af1Szrj  * contributors may be used to endorse or promote products derived from
18dc4f0af1Szrj  * this software without specific prior written permission.
19dc4f0af1Szrj  *
20dc4f0af1Szrj  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21dc4f0af1Szrj  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22dc4f0af1Szrj  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23dc4f0af1Szrj  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24dc4f0af1Szrj  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25dc4f0af1Szrj  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26dc4f0af1Szrj  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27dc4f0af1Szrj  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28dc4f0af1Szrj  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29dc4f0af1Szrj  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30dc4f0af1Szrj  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31dc4f0af1Szrj  */
32dc4f0af1Szrj 
33dc4f0af1Szrj /*
34dc4f0af1Szrj  *  Top - a top users display for Berkeley Unix
35dc4f0af1Szrj  *
36dc4f0af1Szrj  *  General (global) definitions
37dc4f0af1Szrj  */
38dc4f0af1Szrj 
39dc4f0af1Szrj #ifndef _TOP_H_
40dc4f0af1Szrj #define _TOP_H_
41dc4f0af1Szrj 
42dc4f0af1Szrj #include <sys/time.h>
43dc4f0af1Szrj 
44dc4f0af1Szrj /* Maximum number of columns allowed for display */
45dc4f0af1Szrj #define MAX_COLS	512
46dc4f0af1Szrj 
47dc4f0af1Szrj /* Log base 2 of 1024 is 10 (2^10 == 1024) */
48dc4f0af1Szrj #define LOG1024		10
49dc4f0af1Szrj 
50dc4f0af1Szrj /* Special atoi routine returns either a non-negative number or one of: */
51dc4f0af1Szrj #define Infinity	-1
52dc4f0af1Szrj #define Invalid		-2
53dc4f0af1Szrj 
54dc4f0af1Szrj /* maximum number we can have */
55dc4f0af1Szrj #define Largest		0x7fffffff
56dc4f0af1Szrj 
57dc4f0af1Szrj /*
58dc4f0af1Szrj  * The entire display is based on these next numbers being defined as is.
59dc4f0af1Szrj  */
60dc4f0af1Szrj 
61dc4f0af1Szrj #define NUM_AVERAGES    3
62dc4f0af1Szrj 
63dc4f0af1Szrj struct ext_decl {
64dc4f0af1Szrj     int (*f_minibar)(char *, int);
65dc4f0af1Szrj     int (*f_display)(char *, int);
66dc4f0af1Szrj };
67dc4f0af1Szrj 
68dc4f0af1Szrj /*
69dc4f0af1Szrj  *  "Table_size" defines the size of the hash tables used to map uid to
70dc4f0af1Szrj  *  username.  Things will work best if the number is a prime number.
71dc4f0af1Szrj  *  We use a number that should be suitable for most installations.
72dc4f0af1Szrj  */
73dc4f0af1Szrj #ifndef Table_size
74dc4f0af1Szrj #define Table_size	8191
75dc4f0af1Szrj #endif
76dc4f0af1Szrj 
77dc4f0af1Szrj void gettime(struct timeval *);
78dc4f0af1Szrj void quit(int);
79dc4f0af1Szrj 
80*8ea225a8SSascha Wildner extern int n_cpus;
81*8ea225a8SSascha Wildner extern int enable_ncpus;
82dc4f0af1Szrj 
83dc4f0af1Szrj #endif /* _TOP_H_ */
84