Files
dolphin/Source/Core/Common/Timer.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
684 B
C++
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2008-12-08 04:46:09 +00:00
#pragma once
2008-12-08 04:46:09 +00:00
2014-02-17 05:18:15 -05:00
#include "Common/CommonTypes.h"
2010-01-21 19:55:01 +00:00
2008-07-12 17:40:22 +00:00
namespace Common
{
class Timer
{
public:
static u64 NowUs();
static u64 NowMs();
2008-12-08 04:46:09 +00:00
void Start();
// Start(), then decrement start time by the offset.
// Effectively "resumes" a timer
void StartWithOffset(u64 offset);
void Stop();
u64 ElapsedMs() const;
2008-12-08 04:46:09 +00:00
// The rest of these functions probably belong somewhere else
static u64 GetLocalTimeSinceJan1970();
2008-12-08 04:46:09 +00:00
static void IncreaseResolution();
static void RestoreResolution();
2008-12-08 04:46:09 +00:00
2010-01-21 19:55:01 +00:00
private:
u64 m_start_ms{0};
u64 m_end_ms{0};
bool m_running{false};
2008-07-12 17:40:22 +00:00
};
2009-03-28 08:57:34 +00:00
} // Namespace Common