timer.h #1

  • //
  • guest/
  • perforce_software/
  • p4/
  • 2014-1/
  • sys/
  • timer.h
  • View
  • Commits
  • Open Download .zip Download (1 KB)
/*
 * Copyright 2001 Perforce Software.  All rights reserved.
 *
 * This file is part of Perforce - the FAST SCM System.
 */

/*
 * Timer - lapse timer
 *
 * Timer is a OS specific object that measures lapse time.
 *
 * Classes:
 *	Timer - lapse and CPU timer
 *	FmtMs() - format milliseconds with varying precision
 *
 * Public methods:
 *	Timer::Start() - restart the timer
 *	Timer::Message() - format an OS-specific resource usage message
 *	Timer::Time() - return MS since Start()
 *	Timer::Reset() - restart the timer to the time of the last check
 */

class StrBuf;

class StrMs : public StrPtr {

    public:
		StrMs( int ms );

    private:

	char	buf[ 24 ];

} ;
 
class Timer {

    public:
	void	        Start();
        void	        Message( StrBuf &msg ) 
                        { msg << StrMs( Time() ) << "s"; }
        int	        Time();
	void		Restart();

        const StrPtr &	Fmt( StrBuf &b ) const;
        void		Parse( const StrPtr &v );

    private:

	struct timer {
		long	sec;
		long	usec;
	} start, stop;

	static void Set( struct timer &t );

} ;

# Change User Description Committed
#1 15902 Matt Attaway A second renaming that I will not obliterate as a badge of shame
//guest/perforce_software/p4/2014_1/sys/timer.h
#1 15901 Matt Attaway Clean up code to fit modern Workshop naming standards
//guest/perforce_software/p4/2014.1/sys/timer.h
#1 12188 Matt Attaway Move 'main' p4 into a release specific directory in prep for new releases
//guest/perforce_software/p4/sys/timer.h
#1 9129 Matt Attaway Initial commit of the 2014.1 p4/p4api source code