Fix perf counter

This commit is contained in:
pchote
2010-02-20 19:46:02 +13:00
parent 37084f4014
commit a88d0b7be1
4 changed files with 20 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ COMMON_LIBS = System.dll System.Core.dll System.Drawing.dll System.Xml.dll
fileformats_SRCS = $(shell find OpenRa.FileFormats/ -iname '*.cs')
fileformats_TARGET = OpenRa.FileFormats.dll
fileformats_KIND = library
fileformats_LIBS = $(COMMON_LIBS)
fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Glfw.dll
gl_SRCS = $(shell find OpenRa.Gl/ -iname '*.cs')
gl_TARGET = OpenRa.Gl.dll

View File

@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -24,6 +25,8 @@
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
@@ -33,6 +36,7 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -42,6 +46,10 @@
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Tao.Glfw, Version=2.6.0.0, Culture=neutral, PublicKeyToken=2bb092b6587e4402">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.Glfw.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AudLoader.cs" />

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -19,35 +19,26 @@
#endregion
using System.Runtime.InteropServices;
using Tao.Glfw;
namespace OpenRa.Support
{
public class Stopwatch
{
//[DllImport("kernel32.dll")]
static bool QueryPerformanceCounter(out long value) { value = 1; return true; }
//[DllImport("kernel32.dll")]
static bool QueryPerformanceFrequency(out long frequency) { frequency = 1; return true; }
long freq, start;
double start;
public Stopwatch()
{
QueryPerformanceFrequency(out freq);
QueryPerformanceCounter(out start);
Reset();
}
public double ElapsedTime()
{
long current;
QueryPerformanceCounter(out current);
return (current - start) / (double)freq;
return (Glfw.glfwGetTime() - start);
}
public void Reset()
{
QueryPerformanceCounter(out start);
start = Glfw.glfwGetTime();
}
}
}

View File

@@ -66,14 +66,14 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Tao.OpenAl, Version=1.1.0.1, Culture=neutral, PublicKeyToken=a7579dda88828311, processorArchitecture=MSIL" />
<Reference Include="ISE.FreeType, Version=1.0.2885.37773, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\ISE.FreeType.dll</HintPath>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.OpenGl.dll</HintPath>
</Reference>
<Reference Include="ISE.FreeType, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1b34ab585684d5ea">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\ISE.FreeType.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Chat.cs" />