Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*----------------------------------------------------------------------------*/
- /* */
- /* StatTimer.h: interface for the CStatTimer class. */
- /* */
- /* Author: Mark Carrier (mark@carrierlabs.com) */
- /* */
- /*----------------------------------------------------------------------------*/
- /* Copyright (c) 2006 CarrierLabs, LLC. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. The name "CarrierLabs" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * mark@carrierlabs.com.
- *
- * THIS SOFTWARE IS PROVIDED BY MARK CARRIER ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MARK CARRIER OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *----------------------------------------------------------------------------*/
- #ifndef __CSTATTIMER_H__
- #define __CSTATTIMER_H__
- #include <string.h>
- #if defined(WIN32) || defined(_WIN32)
- #include <Winsock2.h>
- #include <time.h>
- #endif
- #if defined(_LINUX) || defined(__MACH__) || defined(MACH)
- #include <stdio.h>
- #include <sys/time.h>
- #endif
- #include "Host.h"
- #if defined(WIN32) || defined(_WIN32)
- #define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
- #else
- #define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
- #endif
- #define MILLISECONDS_CONVERSION 1000
- #define MICROSECONDS_CONVERSION 1000000
- #if __cplusplus >= 201103L
- #include <cstdint>
- #define int8 int8_t
- #define int16 int16_t
- #define int32 int32_t
- #define uint8 uint8_t
- #define uint16 uint16_t
- #define uint32 uint32_t
- #endif
- /// Class to abstract socket communications in a cross platform manner.
- /// This class is designed
- class CStatTimer {
- public:
- CStatTimer()
- {
- };
- ~CStatTimer()
- {
- };
- void Initialize()
- {
- //memset(&m_startTime, 0, sizeof(struct timeval));
- //memset(&m_endTime, 0, sizeof(struct timeval));
- };
- struct timeval GetStartTime() {timeval tmp; return tmp; };
- void SetStartTime() { /*GET_CLOCK_COUNT(&m_startTime); */};
- struct timeval GetEndTime() {timeval tmp; return tmp; };
- void SetEndTime() { /*GET_CLOCK_COUNT(&m_endTime); */};
- uint32 GetMilliSeconds() { return 0;};
- uint32 GetMicroSeconds() { return 0;};
- uint32 GetSeconds() { return 0;};
- uint32 GetCurrentTime()
- {
- return 0;
- };
- };
- #endif // __CSTATTIMER_H__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement