当前位置: 首页>>代码示例>>C++>>正文


C++ PerformanceTimer::start方法代码示例

本文整理汇总了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); 
}
开发者ID:apartridge,项目名称:Crayon,代码行数:36,代码来源:PhotonTracer.cpp

示例2: start

/**
 * Starts the AAAprofiler trace.
 */
void AAAProfiler::start(void)
{
    if (gAAAProfiler.isRequested()) {
        gAAAProfiler.formattedTrace("gAAAProfiler", __FUNCTION__);
        gAAAProfiler.start();
    }
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:10,代码来源:PerformanceTraces.cpp

示例3:

/**
 * Starts the launch2FocusLock trace.
 */
void Launch2FocusLock::start(void)
{
    if (gLaunch2FocusLock.isRequested()) {
        gLaunch2FocusLock.formattedTrace("Launch2FocusLock", __FUNCTION__);
        gLaunch2FocusLock.start();
    }
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:10,代码来源:PerformanceTraces.cpp

示例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();
}
开发者ID:grserver,项目名称:infinity,代码行数:31,代码来源:DbTaskQueue.cpp

示例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
}
开发者ID:amvanbaren,项目名称:mixxx,代码行数:60,代码来源:glesvsynctestrenderer.cpp

示例6: update

void ServerPathBuildManager::update ( float timeBudget )
{
	PerformanceTimer timer;

	timer.start();

	updateQueue( &gs_highQueue, timer, timeBudget );

	updateQueue( &gs_lowQueue, timer, timeBudget );
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:10,代码来源:ServerPathBuildManager.cpp

示例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
}
开发者ID:MLudgate,项目名称:mixxx,代码行数:51,代码来源:enginenetworkstream.cpp

示例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
}
开发者ID:mixxxdj,项目名称:mixxx,代码行数:14,代码来源:glrgbwaveformwidget.cpp

示例9: CloseHandle

OsFile::~OsFile()
{
#ifdef _DEBUG
    PerformanceTimer t;
    t.start();
#endif

    CloseHandle(m_handle);

#ifdef _DEBUG
    t.stop();
    ms_time+= t.getElapsedTime();
#endif
}
开发者ID:grserver,项目名称:infinity,代码行数:14,代码来源:OsFile.cpp

示例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
}
开发者ID:flashpig,项目名称:mixxx,代码行数:16,代码来源:glrgbwaveformwidget.cpp

示例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;
}
开发者ID:Alppasa,项目名称:mixxx,代码行数:45,代码来源:analysisdao.cpp

示例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
}
开发者ID:grserver,项目名称:infinity,代码行数:20,代码来源:OsFile.cpp

示例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);
}
开发者ID:grserver,项目名称:infinity,代码行数:21,代码来源:OsFile.cpp

示例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;
}
开发者ID:grserver,项目名称:infinity,代码行数:22,代码来源:OsFile.cpp

示例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;
}
开发者ID:PeteDevoy,项目名称:mixxx,代码行数:38,代码来源:basetrackcache.cpp


注:本文中的PerformanceTimer::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。