Exemplo n.º 1
0
const bool DB::Open(const std::string &filename)
{
    if(IsOpen()==true)
    {
        Close();
    }
    if(IsOpen()==false)
    {
        m_lastresult=sqlite3_open(filename.c_str(),&m_db);
        if(m_lastresult==SQLITE_OK)
        {
            if(IsProfiling())
            {
                StartProfiling();
            }
            return true;
        }
        else
        {
            std::string errmsg("");
            int err=GetLastExtendedError(errmsg);
            HandleError(err,errmsg,"DB::Open");
            return false;
        }
    }
    else
    {
        return false;
    }
}
Exemplo n.º 2
0
OP_STATUS
OpScopeProfiler::OnAboutToLoadDocument(DocumentManager *docman, const OpScopeDocumentListener::AboutToLoadDocumentArgs &args)
{
	if (!IsEnabled() || !AcceptDocumentManager(docman) || !current_session->GetStartOnLoad())
		return OpStatus::OK;

	current_session->SetStartOnLoad(FALSE);

	return StartProfiling();
}
Exemplo n.º 3
0
int main() {
    if (SystemCheck()) {
        LOG("Adding resources.");

        if (Effect.Load)
            Effect.Load();

        StartEventQueue();
        StartProfiling();
        SetFrameCounter(0);
        TRY {
            BOOL loopExit = false;

            LOG("Setting up the effect.");
            Effect.Init();
            LOG("Running up main loop.");

            do {
                InputEventT event;
                int32_t frameNumber;

                while (EventQueuePop(&event)) {
                    if (event.ie_Class == IECLASS_RAWKEY)
                        if (event.ie_Code & IECODE_UP_PREFIX)
                            if ((event.ie_Code & ~IECODE_UP_PREFIX) == KEY_ESCAPE)
                                loopExit = true;
                    if (Effect.HandleEvent && !loopExit)
                        Effect.HandleEvent(&event);
                }

                frameNumber = ReadFrameCounter();
                Effect.Render(frameNumber);
                RenderFrameNumber(frameNumber);
                RenderFramesPerSecond(frameNumber);

                DisplaySwap();
            } while (!loopExit);

            LOG("Tearing down the effect.");
            Effect.Kill();
        }
        CATCH {
            LOG("Effect crashed!");
        }
        StopProfiling();
        StopEventQueue();

        if (Effect.UnLoad)
            Effect.UnLoad();
    }

    return 0;
}
Exemplo n.º 4
0
/*
 * Set up effect function.
 */
void SetupEffect() {
  UVMapT *uvmap = R_("Map");
  PixBufT *shades = R_("Shades");

  LoadPalette(R_("TexturePal"));

  UVMapGenerate4(uvmap);
  UVMapSetTexture(uvmap, R_("Texture"));
  uvmap->lightMap = shades;
  PixBufSetColorMap(shades, R_("ColorMap"));

  ResAdd("Component", NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u));

  StartProfiling();
}
Exemplo n.º 5
0
/* Toggle profiling.  Can be called as a signal handler. */
ProfileToggle()
{
#if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV)
/* Soon should handle aix profiling */
    static char *onMsg = "Profiling turned on.\n";
    static char *offMsg = "Profiling turned off; mon.out written.\n";

    if (profiling) {
	EndProfiling();
	write(fileno(stdout), offMsg, strlen(offMsg));
    } else {
	StartProfiling();
	write(fileno(stdout), onMsg, strlen(onMsg));
    }
#endif
}
Exemplo n.º 6
0
/*
 * Set up effect function.
 */
void SetupEffect() {
  PaletteT *palette = R_("Palette");
  RGB *colors = palette->colors;
  int i;

  /* create a suitable fire palette, this is crucial for a good effect */
  /* black to blue, blue to red, red to yellow, yellow to white*/
  for (i = 0; i < 32; i++) {
    /* black to blue, 32 values*/
    colors[i].b = i << 1;

    /* blue to red, 32 values*/
    colors[i + 32].r = i << 3;
    colors[i + 32].b =  64 - (i << 1);

    /*red to yellow, 32 values*/
    colors[i + 64].r = 255;
    colors[i + 64].g = i << 3;

    /* yellow to white, 162 */
    colors[i + 96].r = 255;
    colors[i + 96].g = 255;
    colors[i + 96].b = i << 2;
    colors[i + 128].r = 255;
    colors[i + 128].g = 255;
    colors[i + 128].b = 64 + (i << 2);
    colors[i + 160].r = 255;
    colors[i + 160].g = 255;
    colors[i + 160].b = 128 + (i << 2);
    colors[i + 192].r = 255;
    colors[i + 192].g = 255;
    colors[i + 192].b = 192 + i;
    colors[i + 224].r = 255;
    colors[i + 224].g = 255;
    colors[i + 224].b = 224 + i;
  } 

  LoadPalette(palette);
  StartProfiling();
}
Exemplo n.º 7
0
/*
 * Set up effect function.
 */
void SetupEffect() {
  PixBufClear(R_("Canvas"));
  LoadPalette(R_("Palette"));
  StartProfiling();
}
Exemplo n.º 8
0
VSPTree::VSPTree( QString appPath,  QString argument) :
	m_applicationPath( appPath ),
	m_settings( appPath + "/VSPTree.ini", QSettings::IniFormat )
{ 
	QDir dir(PATH32);
	QDir dir2(PATH64);
	if ( dir.exists() )
	{
		m_profilerpath = PATH32;
	}
	else if ( dir2.exists() )
	{
		m_profilerpath = PATH64;
	}
	else
	{
		QMessageBox::critical(NULL,"Standalone Debugger not installed", "C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Team Tools\\Performance Tools\\ does not exist");
	}

	QStringList env = QProcess::systemEnvironment();
	env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), QString("PATH=\\1;") + m_profilerpath);
	m_process.setEnvironment(env);

	if ( m_settings.contains("m_lastExe") ) 
	{
		m_lastExe = m_settings.value("m_lastExe").toString();
	}

	if ( m_settings.contains("m_lastVSP") ) 
	{
		m_lastVSP = m_settings.value("m_lastVSP").toString();
	}

	if ( m_settings.contains("m_lastArguments") ) 
	{
		m_lastArguments = m_settings.value("m_lastArguments").toString();
	}

	m_editorPath = "";
	if ( m_settings.contains("m_editorPath") ) 
	{
		m_editorPath = m_settings.value("m_editorPath").toString();
	}

	m_editorArguments = "<filename> -n<linenum>";
	if ( m_settings.contains("m_editorArguments") ) 
	{
		m_editorArguments = m_settings.value("m_editorArguments").toString();
	}

	m_log = new QTextEdit();
	m_log->setReadOnly(true);
	connect (&m_process, SIGNAL(readyReadStandardOutput()),this,  SLOT(StdOutLog()));
	connect (&m_process, SIGNAL(readyReadStandardError()),this,  SLOT(StdErrorLog()));

	menubar = this->menuBar();
	QMenu* fileMenu = menubar->addMenu("File");
	QAction* openAct = fileMenu->addAction("Open VSP");
	connect(openAct, SIGNAL(triggered()), this, SLOT(LoadVSPClicked()));
	QAction* exitAct = fileMenu->addAction("Exit");
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
	
	QMenu* profilerMenu = menubar->addMenu("Profiler");

	QAction* startProfilingAct = profilerMenu->addAction("Start Profiler Service");
	connect(startProfilingAct, SIGNAL(triggered()), this, SLOT(StartProfiling()));

	QAction* ProfileAct = profilerMenu->addAction("Profile Application");
	connect(ProfileAct, SIGNAL(triggered()), this, SLOT(Profile()));

	QAction* stopProfilingAct = profilerMenu->addAction("Stop Profiler Service");
	connect(stopProfilingAct, SIGNAL(triggered()), this, SLOT(StopProfiling()));

	QMenu* OptionsMenu = menubar->addMenu("Options");
	QAction* setTextEditor = OptionsMenu->addAction("Set Text Editor");
	connect(setTextEditor, SIGNAL(triggered()), this, SLOT(setTextEditor()));

	m_tabWidget = new QTabWidget();

	m_callTreeWidget = new QTreeWidget();

	m_flatCallTreeWidget = new QTreeWidget();

	m_functionSummaryTreeWidget = new QTreeWidget();

	m_tabWidget->addTab(m_callTreeWidget,"CallTree");
	m_tabWidget->addTab(m_flatCallTreeWidget,"CallTreeFlat");
	m_tabWidget->addTab(m_functionSummaryTreeWidget,"FunctionSummary");
	m_tabWidget->addTab(m_log,"Log");

	m_callTreeMenu = new QMenu();
	QAction* openFileAct = m_callTreeMenu->addAction("Open File");
	connect(openFileAct, SIGNAL(triggered()), this, SLOT(openFile()));

	QAction* expandAllAct = m_callTreeMenu->addAction("Expand All");
	connect(expandAllAct, SIGNAL(triggered()), m_callTreeWidget, SLOT(expandAll()));

	QAction* collapseAllAct = m_callTreeMenu->addAction("Collapse All");
	connect(collapseAllAct, SIGNAL(triggered()), m_callTreeWidget, SLOT(collapseAll()));

	m_flatCallTreeMenu = new QMenu();
	
	m_flatCallTreeMenu->addAction(openFileAct);
	QAction* FindInTreeAct = m_flatCallTreeMenu->addAction("Find In Tree");
	connect(FindInTreeAct, SIGNAL(triggered()), this, SLOT(FindInTree()));

	//threads
	connect( &m_thread, SIGNAL( output( QString ) ), this, SLOT( Log( QString ) ) );
	connect( &m_thread, SIGNAL( finished() ), this, SLOT( workDone() ) );

	this->setCentralWidget(m_tabWidget);
	this->setWindowTitle(VERSION);
	this->resize(640,480);
	this->show();

	if ( !argument.isEmpty() )
	{
		LoadVSP(argument);
	}
}
Exemplo n.º 9
0
void VRSDClient::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  // check event source
  if(pData->m_pSender == &m_pClientLanguageImplementation->ScriptEvent)
  {
    VRSDScriptEvent* pEvent = static_cast<VRSDScriptEventCallbackItem*>(pData)->pScriptEvent;

    if(!pEvent)
      return;

    // If profiling is enabled the profiler will handle the script event,
    // Afterwards the return ensures that the standard debugging procedure is not followed
    if(m_bProfilingEnabled)
    {
      HandleScriptEventForProfiling(pEvent);
      return;
    }

    // Check if there is a connection from the remote debugger available
    if(!m_pConnection)
      return;

    // send event to debugger
    if(!SendScriptEvent(pEvent))
      return;

    // wait for debugger on what to do
    VMessage Msg;

    {
      VMutexLocker lock(m_ConnectionMutex);
      if(!m_pConnection)
        return;
      m_pConnection->Recv(&Msg);
    }

    while(Msg.IsValid() && Msg.GetMessageType() != 'CONT')
    {
      // check here for profiling messages as well since the async send may lead to them being received here
      if(Msg.GetMessageType() == 'BRSP')
      {
        StartProfiling();
        break;
      }
      else if(Msg.GetMessageType() == 'ERSP')
      {
        StopProfiling();
        break;
      }

      // process message (get callstack, get local variables, get global variables etc.)
      HandleDebuggingMessage(&Msg);

      // get the next message
      VMutexLocker lock(m_ConnectionMutex);
      if(!m_pConnection || !m_pConnection->Recv(&Msg))
        break;
    }
  }

  else if(pData->m_pSender == &VTarget::OnConnection)
  {
    VTargetConnectionCallbackItem* pTCCI = (VTargetConnectionCallbackItem*)pData;
    if(pTCCI->pConnection)
    {
      if(pTCCI->pConnection->IsFor("VRSD"))
      {
        m_pConnection = pTCCI->pConnection;

        // register message callback
        Vision::Error.AddCallback(EngineMessageCallback, this);

        Vision::Callbacks.OnUpdateSceneBegin += this;

        // Send connected callback
        OnConnected.TriggerCallbacks();
      }
    }
  }

  else if(pData->m_pSender == &VTarget::OnDisconnection)
  {
    VTargetConnectionCallbackItem* pTCCI = (VTargetConnectionCallbackItem*)pData;
    if(pTCCI->pConnection)
    {
      if(pTCCI->pConnection->IsFor("VRSD"))
      {
        {
          VMutexLocker lock(m_ConnectionMutex);
          m_pConnection = NULL;
        }

        // register message callback
        Vision::Error.RemoveCallback(EngineMessageCallback, this);

        Vision::Callbacks.OnUpdateSceneBegin -= this;

        // Send disconnected callback
        OnDisconnected.TriggerCallbacks();
      }
    }
  }

  else if(pData->m_pSender == &Vision::Callbacks.OnUpdateSceneBegin)
  {
    VMessage* pMsg = NULL;

    {
      VMutexLocker lock(m_ConnectionMutex);

      if(!m_pConnection)
        return;

      pMsg = m_pConnection->GetNextASyncReceivedMessage();
    }

    if(!pMsg)
      return;

    // command messages
    switch(pMsg->GetMessageType())
    {
      // begin remote script profiling
      case 'BRSP':
        StartProfiling();
        break;

      // end remote script profiling
      case 'ERSP':
        StopProfiling();
        break;

      // script reload
      case 'RSRN':
        HandleScriptReloadMessage(pMsg);
        break;
    }

    V_SAFE_DELETE(pMsg);
  }

  else if(pData->m_pSender == &Vision::Callbacks.OnEditorModeChanged)
  {
    if(Vision::Editor.IsInEditor() && !Vision::Editor.IsPlaying() && m_bProfilingEnabled)
      StopProfiling();
  }


}