device.cpp

[code="java"][/code]#include "device.h"
#include <math.h>

//Class Timer member function implementation
int Timer::createTimer()
{
_start = 0;
_clocks = 0;

#ifdef _WIN32
QueryPerformanceFrequency((LARGE_INTEGER* )&_freq);
#else
_freq = (long long)1.0E3;
#endif
return SDK_SUCCESS;
}

//Start the Timer
int Timer::startTimer()
{
#ifdef _WIN32
QueryPerformanceCounter((LARGE_INTEGER*)&_start);
#else
struct timeval s;
gettimeofday(&s,0);
_start = (long long)s.tv_sec * (long long)1.0E3 + (long long)s.tv_usec / (long long)1.0E3;
#endif
return SDK_SUCCESS;
}

//Reset the Timer
int Timer::resetTimer()
{
_start = 0;
_clocks = 0;
return SDK_SUCCESS;
}

//Stop the Timer
int Timer::stopTimer()
{
long long n = 0;
#ifdef _WIN32
QueryPerformanceCounter((LARGE_INTEGER*)&n);
#else
struct timeval s;
gettimeofday(&s,0);
n = (long long)s.tv_sec * (long long)1.0E3 + (long long)s.tv_usec / (long long)1.0E3;
#endif
n -= _start;
_start = 0;
_clocks += n;
return SDK_SUCCESS;
}

//Get the elapsed time between the Timer start and end
double Timer::readTimer()
{
totaltime = double(_clocks);
totaltime = double(totaltime / _freq);
return totaltime;
}


//class Device member function implement

//Construction
Device::Device()
{
globalThreads[0] = WIDTH / 4/GROUP;
globalThreads[1] = HEIGHT;

localThreads[0] = 64;
localThreads[1] = 4;
}

//Deconstruction
Device::~Device()
{
//deconstuctor
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值