本文整理汇总了C++中PerformanceTimer::start方法的典型用法代码示例。如果您正苦于以下问题:C++ PerformanceTimer::start方法的具体用法?C++ PerformanceTimer::start怎么用?C++ PerformanceTimer::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerformanceTimer
的用法示例。
在下文中一共展示了PerformanceTimer::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traceLight
// Like reference implementation of emit_photons_from_diffuse_point_light as described
// in "Realistic Image Synthesis using Photon Mapping" page 57.
void PhotonTracer::traceLight(const Light& light, int numberOfPhotons)
{
int n = 0, c = 0;
int c2 = numberOfPhotons/50;
PerformanceTimer pt;
pt.start();
while (n < numberOfPhotons)
{
//Vector3 dir = light.emitPhoton();
//Vector3 power = light.power() * light.color();
//Ray ray(light.getPosition(), dir);
PhotonRay photon = light.emitPhoton();
Ray ray(photon.origin, photon.direction);
int photons = tracePhoton(ray, photon.power, 0);
n += photons;
c += photons;
if(c > c2)
{
c = 0;
pt.stop();
printf("%.2f seconds. %.2f %% done. Remaining: %.2f sec.\r",
pt.elapsedSec(),
(n/float(numberOfPhotons))*100.f, pt.elapsedSec()*(float(numberOfPhotons)/float(n) - 1));
pt.start();
}
}
_photonMap->scale_photon_power(1 / (float)numberOfPhotons);
}
示例2: start
/**
* Starts the AAAprofiler trace.
*/
void AAAProfiler::start(void)
{
if (gAAAProfiler.isRequested()) {
gAAAProfiler.formattedTrace("gAAAProfiler", __FUNCTION__);
gAAAProfiler.start();
}
}
示例3:
/**
* Starts the launch2FocusLock trace.
*/
void Launch2FocusLock::start(void)
{
if (gLaunch2FocusLock.isRequested()) {
gLaunch2FocusLock.formattedTrace("Launch2FocusLock", __FUNCTION__);
gLaunch2FocusLock.start();
}
}
示例4: update
void TaskQueue::update(float maxTime)
{
PerformanceTimer timer;
timer.start();
TaskRequest *req;
resultQLock.enter();
while (!resultQ.empty() && (maxTime==0 || timer.getSplitTime() < maxTime))
{
req=resultQ.back();
resultQ.pop_back();
--numResults;
--sm_iTotalNumResults;
resultQLock.leave();
if (req->mainThreadFinish())
{
req->mainThreadOnComplete();
delete req;
}
else
{
// if Finish() returns false, more worker thread processing is needed
asyncRequest(req);
}
resultQLock.enter();
}
resultQLock.leave();
}
示例5: draw
void GLVSyncTestRenderer::draw(QPainter* painter, QPaintEvent* /*event*/) {
PerformanceTimer timer;
//int t5, t6, t7, t8, t9, t10, t11, t12, t13;
timer.start();
TrackPointer pTrack = m_waveformRenderer->getTrackInfo();
if (!pTrack) {
return;
}
ConstWaveformPointer waveform = pTrack->getWaveform();
if (waveform.isNull()) {
return;
}
const int dataSize = waveform->getDataSize();
if (dataSize <= 1) {
return;
}
const WaveformData* data = waveform->data();
if (data == NULL) {
return;
}
double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize;
double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize;
const int firstIndex = int(firstVisualIndex + 0.5);
firstVisualIndex = firstIndex - firstIndex % 2;
const int lastIndex = int(lastVisualIndex + 0.5);
lastVisualIndex = lastIndex + lastIndex % 2;
//t5 = timer.restart(); // 910
// Reset device for native painting
painter->beginNativePainting();
//t6 = timer.restart(); // 29,150
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Removed Unsupported OpenGL functions, so that Mixxx can run on OpenGL-ES systems -- amvanbaren 9/2015
// TODO(XXX) Rewrite OpenGL code in glvsynctestrenderer.cpp to support
// the new OpenGL syntax or use Qt instead
//t12 = timer.restart(); // 22,426
painter->endNativePainting();
//t13 = timer.restart(); // 1,430
//qDebug() << t5 << t6 << t7 << t8 << t9 << t10 << t11 << t12 << t13;
//qDebug() << timer.restart(); // 129,498
}
示例6: update
void ServerPathBuildManager::update ( float timeBudget )
{
PerformanceTimer timer;
timer.start();
updateQueue( &gs_highQueue, timer, timeBudget );
updateQueue( &gs_lowQueue, timer, timeBudget );
}
示例7: getNetworkTimeUs
// static
qint64 EngineNetworkStream::getNetworkTimeUs() {
// This matches the GPL2 implementation found in
// https://github.com/codders/libshout/blob/a17fb84671d3732317b0353d7281cc47e2df6cf6/src/timing/timing.c
// Instead of ms resolution we use a us resolution to allow low latency settings
// will overflow > 200,000 years
#ifdef __WINDOWS__
FILETIME ft;
qint64 t;
// no GetSystemTimePreciseAsFileTime available, fall
// back to GetSystemTimeAsFileTime. This happens before
// Windows 8 and Windows Server 2012
// GetSystemTime?AsFileTime is NTP adjusted
// QueryPerformanceCounter depends on the CPU crystal
if(s_pfpgGetSystemTimeFn) {
s_pfpgGetSystemTimeFn(&ft);
return ((qint64)ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10;
} else {
static qint64 oldNow = 0;
static qint64 incCount = 0;
static PerformanceTimer timerSinceInc;
GetSystemTimeAsFileTime(&ft);
qint64 now = ((qint64)ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10;
if (now == oldNow) {
// timer was not incremented since last call (< 15 ms)
// Add time since last function call after last increment
// This reduces the jitter < one call cycle which is sufficient
LARGE_INTEGER li;
now += timerSinceInc.elapsed().toIntegerMicros();
} else {
// timer was incremented
LARGE_INTEGER li;
timerSinceInc.start();
oldNow = now;
}
return now;
}
#elif defined(__APPLE__)
// clock_gettime is not implemented on OSX
// gettimeofday can go backward due to NTP adjusting
// this will work here, because we take the stream start time for reference
struct timeval mtv;
gettimeofday(&mtv, NULL);
return (qint64)(mtv.tv_sec) * 1000000 + mtv.tv_usec;
#else
// CLOCK_MONOTONIC is NTP adjusted
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000LL + ts.tv_nsec / 1000;
#endif
}
示例8: render
mixxx::Duration GLRGBWaveformWidget::render() {
PerformanceTimer timer;
mixxx::Duration t1;
//mixxx::Duration t2, t3;
timer.start();
// QPainter makes QGLContext::currentContext() == context()
// this may delayed until previous buffer swap finished
QPainter painter(this);
t1 = timer.restart();
draw(&painter, NULL);
//t2 = timer.restart();
//qDebug() << "GLRGBWaveformWidget" << t1 << t2;
return t1; // return timer for painter setup
}
示例9: CloseHandle
OsFile::~OsFile()
{
#ifdef _DEBUG
PerformanceTimer t;
t.start();
#endif
CloseHandle(m_handle);
#ifdef _DEBUG
t.stop();
ms_time+= t.getElapsedTime();
#endif
}
示例10: render
int GLRGBWaveformWidget::render() {
PerformanceTimer timer;
int t1;
//int t2, t3;
timer.start();
// QPainter makes QGLContext::currentContext() == context()
// this may delayed until previous buffer swap finished
QPainter painter(this);
t1 = timer.restart();
draw(&painter, NULL);
//t2 = timer.restart();
// glFinish();
//t3 = timer.restart();
//qDebug() << "GLVSyncTestWidget "<< t1 << t2 << t3;
return t1 / 1000; // return timer for painter setup
}
示例11: while
QList<AnalysisDao::AnalysisInfo> AnalysisDao::loadAnalysesFromQuery(TrackId trackId, QSqlQuery* query) {
QList<AnalysisDao::AnalysisInfo> analyses;
PerformanceTimer time;
time.start();
if (!query->exec()) {
LOG_FAILED_QUERY(*query) << "couldn't get analyses for track" << trackId;
return analyses;
}
int bytes = 0;
QSqlRecord queryRecord = query->record();
const int idColumn = queryRecord.indexOf("id");
const int typeColumn = queryRecord.indexOf("type");
const int descriptionColumn = queryRecord.indexOf("description");
const int versionColumn = queryRecord.indexOf("version");
const int dataChecksumColumn = queryRecord.indexOf("data_checksum");
while (query->next()) {
AnalysisDao::AnalysisInfo info;
info.analysisId = query->value(idColumn).toInt();
info.trackId = trackId;
info.type = static_cast<AnalysisType>(query->value(typeColumn).toInt());
info.description = query->value(descriptionColumn).toString();
info.version = query->value(versionColumn).toString();
int checksum = query->value(dataChecksumColumn).toInt();
QString dataPath = getAnalysisStoragePath().absoluteFilePath(
QString::number(info.analysisId));
QByteArray compressedData = loadDataFromFile(dataPath);
int file_checksum = qChecksum(compressedData.constData(),
compressedData.length());
if (checksum != file_checksum) {
qDebug() << "WARNING: Corrupt analysis loaded from" << dataPath
<< "length" << compressedData.length();
continue;
}
info.data = qUncompress(compressedData);
bytes += info.data.length();
analyses.append(info);
}
qDebug() << "AnalysisDAO fetched" << analyses.size() << "analyses,"
<< bytes << "bytes for track"
<< trackId << "in" << time.elapsed().debugMillisWithUnit();
return analyses;
}
示例12: seek
void OsFile::seek(int newFilePosition)
{
#ifdef _DEBUG
PerformanceTimer t;
t.start();
#endif
if (m_offset != newFilePosition)
{
const DWORD result = SetFilePointer(m_handle, newFilePosition, NULL, FILE_BEGIN);
DEBUG_FATAL(static_cast<int>(result) != newFilePosition, ("SetFilePointer failed"));
UNREF(result);
m_offset = newFilePosition;
}
#ifdef _DEBUG
t.stop();
ms_time += t.getElapsedTime();
#endif
}
示例13: OsFile
OsFile *OsFile::open(const char *fileName, bool randomAccess)
{
#ifdef _DEBUG
PerformanceTimer t;
t.start();
#endif
// attempt to open the file
HANDLE handle = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | (randomAccess ? FILE_FLAG_RANDOM_ACCESS : 0), NULL);
// check to make sure the file opened sucessfully
if (handle == INVALID_HANDLE_VALUE)
return NULL;
#ifdef _DEBUG
t.stop();
ms_time += t.getElapsedTime();
#endif
return new OsFile(handle);
}
示例14: getFileSize
int OsFile::getFileSize(const char *fileName)
{
NOT_NULL(fileName);
#ifdef _DEBUG
PerformanceTimer t;
t.start();
#endif
HANDLE handle = CreateFile(fileName, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
return -1;
int const size = GetFileSize(handle, NULL);
CloseHandle(handle);
#ifdef _DEBUG
t.stop();
ms_time += t.getElapsedTime();
#endif
return size;
}
示例15: updateIndexWithQuery
bool BaseTrackCache::updateIndexWithQuery(const QString& queryString) {
PerformanceTimer timer;
timer.start();
if (sDebug) {
qDebug() << "updateIndexWithQuery issuing query:" << queryString;
}
QSqlQuery query(m_database);
// This causes a memory savings since QSqlCachedResult (what QtSQLite uses)
// won't allocate a giant in-memory table that we won't use at all.
query.setForwardOnly(true); // performance improvement?
query.prepare(queryString);
if (!query.exec()) {
LOG_FAILED_QUERY(query);
return false;
}
int numColumns = columnCount();
int idColumn = query.record().indexOf(m_idColumn);
while (query.next()) {
TrackId trackId(query.value(idColumn));
//m_trackInfo[id] will insert a QVector<QVariant> into the
//m_trackInfo HashTable with the key "id"
QVector<QVariant>& record = m_trackInfo[trackId];
record.resize(numColumns);
for (int i = 0; i < numColumns; ++i) {
record[i] = query.value(i);
}
}
qDebug() << this << "updateIndexWithQuery took" << timer.elapsed().debugMillisWithUnit();
return true;
}