Пример #1
0
void vtuneInit()
{
    domain = __itt_domain_create("x265");
    size_t length = sizeof(stringNames) / sizeof(const char *);
    for (size_t i = 0; i < length; i++)
        taskHandle[i] = __itt_string_handle_create(stringNames[i]);
}
Пример #2
0
SceneViewport::SceneViewport(Scene *scene, RenderContext *renderCtx, QWidget *parent) : QGLWidget(parent)
{
    setMinimumSize(640, 480);
    m_scene = scene;
    m_renderCtx = renderCtx;
    m_gameTimer = new QElapsedTimer();
    m_renderTimer = new QTimer(this);
    m_renderTimer->setInterval(0);
    m_statsTimer = new QTimer(this);
    m_statsTimer->setInterval(1000);
#ifdef USE_VTUNE_PROFILER
    m_traceDomain = __itt_domain_create("SceneViewport");
#endif
    setAutoFillBackground(false);
    connect(m_statsTimer, SIGNAL(timeout()), this, SLOT(updateStats()));
    connect(m_renderTimer, SIGNAL(timeout()), this, SLOT(update()));
}
Пример #3
0
static __itt_domain* GetDomain(){
    static __itt_domain* pTheDomain  = __itt_domain_create("MediaSDK");
    return pTheDomain;
}
Пример #4
0
static void ITT_init_domains() {
    fgt_domain = __itt_domain_create( _T("tbb.flow") );
    fgt_domain->flags = 1;
}
Пример #5
0
#include <conio.h>
#include <vector>

// ITT Metadata are sometimes useful for telling a bunch of tasks apart.
// Here, we have a function that accepts a parameter that, depending on its
// value, will cause the function to run quickly or slowly.
// 
// If we trace this function without a parameter, all we will see is 
// that one of these functions is really long, but won't know why.
//
// The __itt_metadata_add call below adds the actual index value to the trace
// In the GUI, we can then use this captured parameter to decide whether there
// is a correlation between the parameter and the function's duration.
//

__itt_domain* pD = __itt_domain_create(L"gpa_metadata_sample");
__itt_string_handle* pSH1 = __itt_string_handle_createA("Example");
__itt_string_handle* pSH2 = __itt_string_handle_create(L"index");

void Example(int index)
{
	__itt_task_begin(pD, __itt_null, __itt_null, pSH1);

	__itt_metadata_add(pD, __itt_null, pSH2, __itt_metadata_s32, 1, (void*)&index);

	__itt_metadata_str_add(pD, __itt_null, pSH1, L"Example is running", 0);

    if(index == 10) 
	{
        Sleep(30);
    } 
Пример #6
0
namespace livre
{

#ifdef _ITT_DEBUG_
#include "ittnotify.h"
__itt_domain* ittTextureLoadDomain = __itt_domain_create("Texture Loading");
__itt_string_handle* ittTextureComputationTask =
        __itt_string_handle_create("Texture loading computation");
__itt_string_handle* ittTextureLoadTask = __itt_string_handle_create("Texture loading task");
#endif // _ITT_DEBUG_


// Dont forget to apply cache policy after each traversal
class TextureLoaderVisitor : public RenderNodeVisitor
{
public:
    TextureLoaderVisitor( DashTreePtr dashTree,
                          TextureCache& textureCache,
                          ProcessorInputPtr processorInput,
                          ProcessorOutputPtr processorOutput,
                          bool& needRedraw )
        : RenderNodeVisitor( dashTree )
        , _cache( textureCache )
        , _input( processorInput )
        , _output( processorOutput )
        , _allLoaded( true ) // be optimistic; will be set to false on first
                             // non-loaded data during visit
        , _synchronous( false )
        , _needRedraw( needRedraw )
    {}

    void visit( DashRenderNode& renderNode, VisitState& state ) final;

    bool isAllDataLoaded() const { return _allLoaded; }

    bool isSynchronous() const { return _synchronous; }
    void setSynchronous( const bool synchronous ) { _synchronous = synchronous;}

private:
    TextureCache& _cache;
    ProcessorInputPtr _input;
    ProcessorOutputPtr _output;
    bool _allLoaded;
    bool _synchronous;
    bool& _needRedraw;
};

class CollectVisiblesVisitor : public RenderNodeVisitor
{
public:
    CollectVisiblesVisitor( DashTreePtr dashTree,
                            CacheIdSet& currentVisibleSet )
     : RenderNodeVisitor( dashTree ),
       currentVisibleSet_( currentVisibleSet ) {}

    void visit( DashRenderNode& renderNode, VisitState& state ) final
    {
        const LODNode& lodNode = renderNode.getLODNode();

        if( !renderNode.isInFrustum( ))
             state.setVisitChild( false );

        if( renderNode.isLODVisible( ))
        {
            currentVisibleSet_.insert( lodNode.getNodeId().getId( ));
            state.setVisitChild( false );
        }
    }

private:
    CacheIdSet& currentVisibleSet_;
};

TextureUploadProcessor::TextureUploadProcessor( DashTreePtr dashTree,
                                                GLContextPtr shareContext,
                                                GLContextPtr context,
                                                ConstVolumeRendererParametersPtr vrParameters )
    : GLContextTrait( context )
    , _dashTree( dashTree )
    , _shareContext( shareContext )
    , _textureCache( GL_LUMINANCE8 )
    , _currentFrameID( 0 )
    , _threadOp( TO_NONE )
    , _vrParameters( vrParameters )
    , _allDataLoaded( false )
    , _needRedraw( false )
{
    setDashContext( dashTree->createContext());
}

const TextureCache& TextureUploadProcessor::getTextureCache() const
{
    return _textureCache;
}

bool TextureUploadProcessor::initializeThreadRun_()
{
    setName( "TexUp" );
    _textureCache.setMaximumMemory( _vrParameters->maxGPUCacheMemoryMB * LB_1MB );
    LBASSERT( getGLContext( ));
    _shareContext->shareContext( getGLContext( ));
    return DashProcessor::initializeThreadRun_();
}

bool TextureUploadProcessor::onPreCommit_( const uint32_t outputConnection LB_UNUSED )
{
    const bool ret = _allDataLoaded;

    _allDataLoaded = false;
    return ret;
}

void TextureUploadProcessor::onPostCommit_( const uint32_t,
                                            const CommitState state )
{
    if( state != CS_NOCHANGE )
        glFinish();
}

void TextureUploadProcessor::_loadData()
{
    TextureLoaderVisitor loadVisitor( _dashTree, _textureCache,
                                      processorInputPtr_, processorOutputPtr_,
                                      _needRedraw );

    loadVisitor.setSynchronous( _vrParameters->synchronousMode );

    DFSTraversal traverser;
    const RootNode& rootNode = _dashTree->getDataSource()->getVolumeInformation().rootNode;
    traverser.traverse( rootNode, loadVisitor, _currentFrameID );

    if( _vrParameters->synchronousMode )
        _allDataLoaded = loadVisitor.isAllDataLoaded();
    else
        _allDataLoaded = true;
}

void TextureUploadProcessor::runLoop_()
{
    _needRedraw = false;
    if( GLContext::getCurrent() != getGLContext().get( ))
        getGLContext()->makeCurrent();

    processorInputPtr_->applyAll( CONNECTION_ID );
    _checkThreadOperation();

#ifdef _ITT_DEBUG_
    __itt_task_begin ( ittTextureLoadDomain, __itt_null, __itt_null, ittTextureComputationTask );
#endif //_ITT_DEBUG_

    const DashRenderStatus& renderStatus = _dashTree->getRenderStatus();
    if( renderStatus.getFrameID() != _currentFrameID )
    {
        _protectUnloading.clear();
        CollectVisiblesVisitor collectVisibles( _dashTree,
                                                _protectUnloading );
        DFSTraversal traverser;
        const RootNode& rootNode =
                _dashTree->getDataSource()->getVolumeInformation().rootNode;
        traverser.traverse( rootNode, collectVisibles, renderStatus.getFrameID( ));
        _textureCache.setProtectList( _protectUnloading );
        _currentFrameID = renderStatus.getFrameID();
    }
    _loadData();
    processorOutputPtr_->commit( CONNECTION_ID );

#ifdef _ITT_DEBUG_
    __itt_task_end( ittTextureLoadDomain );
#endif //_ITT_DEBUG_
}

void TextureUploadProcessor::_checkThreadOperation()
{
    DashRenderStatus& renderStatus = _dashTree->getRenderStatus();
    ThreadOperation op = renderStatus.getThreadOp();
    if( op != _threadOp )
    {
        _threadOp = op;
        renderStatus.setThreadOp( op );
        processorOutputPtr_->commit( CONNECTION_ID );
    }

    if( _threadOp == TO_EXIT )
        exit();
}

void TextureLoaderVisitor::visit( DashRenderNode& renderNode, VisitState& state )
{
    const LODNode& lodNode = renderNode.getLODNode();
    if( !lodNode.isValid( ))
        return;

    if( !renderNode.isInFrustum( ))
    {
        state.setVisitChild( false );
        return;
    }

    if( !renderNode.isLODVisible( ))
        return;

    state.setVisitChild( false );

    const ConstCacheObjectPtr texPtr = renderNode.getTextureObject();
    if( texPtr->isLoaded( ))
        return;

    TextureObject& texture = _cache.getNodeTexture( lodNode.getNodeId().getId( ));
    if( texture.isLoaded() )
    {
        renderNode.setTextureObject( &texture );
        _output->commit( CONNECTION_ID );
        return;
    }
    else
    {
        const ConstCacheObjectPtr textureData = renderNode.getTextureDataObject();
        if( textureData->isLoaded( ))
        {
#ifdef _ITT_DEBUG_
            __itt_task_begin ( ittTextureLoadDomain, __itt_null, __itt_null,
                               ittTextureLoadTask );
#endif //_ITT_DEBUG_
            TextureObject& lodTexture = _cache.getNodeTexture( lodNode.getNodeId().getId( ));
            lodTexture.setTextureDataObject(
                            static_cast< const TextureDataObject * >( textureData.get() ) );
            lodTexture.cacheLoad();

#ifdef _ITT_DEBUG_
            __itt_task_end( ittTextureLoadDomain );
#endif //_ITT_DEBUG_
            renderNode.setTextureObject( &lodTexture );

            renderNode.setTextureDataObject( TextureDataObject::getEmptyPtr() );
            _output->commit( CONNECTION_ID );
            _needRedraw = true;
        }
        else
        {
            _allLoaded = false;
            LBVERB << "Texture data not loaded:" << lodNode.getNodeId() << std::endl;
        }
    }

    if( !isSynchronous( ))
        // only in asynchronous mode
        state.setBreakTraversal( _input->dataWaitingOnInput( CONNECTION_ID ));
}

}
Пример #7
0
#include "TaskScheduler.h"
#include "spin_mutex.h"

#include <strsafe.h>

#pragma warning ( push )
#pragma warning ( disable : 4995 ) // skip deprecated warning on intrinsics.
#include <intrin.h>
#pragma warning ( pop )

//
//  Global Domain for GPA CPU tracing
//
#ifdef PROFILEGPA

__itt_domain* g_ProfileDomain = __itt_domain_create( TEXT( "TaskMgr.ProfileDomain" ) );

#endif

//
//  Global Simple Scheduler task mananger instance
//
TaskMgrSS                      gTaskMgrSS;


TaskMgrSS::TaskSet::TaskSet() 
: mpFunc( NULL )
, mpvArg( 0 )
, muSize( 0 )
, mhTaskset( TASKSETHANDLE_INVALID )
, mbCompleted( TRUE )
Пример #8
0
Module *module(std::string Name) {
  return __itt_domain_create(Name.c_str());
}