xref: /haiku/headers/os/support/StopWatch.h (revision 087882c26e81eabf9a459e634a33f8e978d8a66b)
1 /*
2  * Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _STOP_WATCH_H
6 #define _STOP_WATCH_H
7 
8 
9 #include <BeBuild.h>
10 #include <SupportDefs.h>
11 
12 
13 class BStopWatch {
14 	public:
15 		BStopWatch(const char* name, bool silent = false);
16 		virtual ~BStopWatch();
17 
18 		void		Suspend();
19 		void		Resume();
20 		bigtime_t	Lap();
21 		bigtime_t	ElapsedTime() const;
22 		void		Reset();
23 		const char*	Name() const;
24 
25 	private:
26 		virtual	void _ReservedStopWatch1();
27 		virtual	void _ReservedStopWatch2();
28 
29 		bigtime_t	fStart;
30 		bigtime_t	fSuspendTime;
31 		bigtime_t	fLaps[10];
32 		int32		fLap;
33 		const char*	fName;
34 		uint32		_reserved[2];
35 		bool		fSilent;
36 };
37 
38 #endif // _STOP_WATCH_H
39