ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/devel.h
Revision: 1.1
Committed: Fri Dec 26 10:36:42 2008 UTC (15 years, 5 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_74
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 /*
2     * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3     *
4     * Copyright (©) 2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5     *
6     * Deliantra is free software: you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation, either version 3 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program. If not, see <http://www.gnu.org/licenses/>.
18     *
19     * The authors can be reached via e-mail to <support@deliantra.net>
20     */
21    
22     // This file is only included with -DDEVEL, and is only part
23     // of the distributon for completeness, it is not supposed to
24     // be useful outside the developers machines.
25    
26     #ifndef DEVEL_H
27     #define DEVEL_H
28    
29     // used for benchmarking (x86/amd64-specific)
30     typedef unsigned int cstamp;
31    
32     static inline cstamp
33     stamp (void)
34     {
35     cstamp tsc;
36     asm volatile ("rdtsc":"=a" (tsc)::"edx");
37    
38     return tsc;
39     }
40    
41     static inline cstamp
42     measure (cstamp t)
43     {
44     cstamp tsc;
45     asm volatile ("rdtsc":"=a" (tsc)::"edx");
46    
47     if (tsc > t)
48     return tsc - t;
49     else
50     return t - tsc;
51     }
52    
53     // cstamp s = stamp ();
54     // s = measure (s);
55    
56     #endif
57