/** This function is called when the user presses a key. */ void RayWindow::KeyboardFunction( unsigned char c, int x, int y ){ char temp[500]; Image32 img; int z; switch( c ){ case KEY_ESCAPE: exit( 0 ); break; case 'I': printf("Image Name: "); fgets(temp,500,stdin); // gets(temp); TakeSnapshot(img); z = img.WriteImage(temp); printf("Wrote to file: %s\n, %i",temp, z); break; case 'p': fprintf(stderr,"\nPos: (%g,%g,%g)\n Dir: (%g,%g,%g)\n Up: (%g,%g,%g)\n", scene->camera->position[0],scene->camera->position[1],scene->camera->position[2], scene->camera->direction[0],scene->camera->direction[1],scene->camera->direction[2], scene->camera->up[0],scene->camera->up[1],scene->camera->up[2]); break; } }
void DownloadDriverStatistic::OnShareMemoryTimer(boost::uint32_t times) { LOG4CPLUS_DEBUG_LOG(logger_statistic, "DownloadDriverStatistic::OnShareMemoryTimer [IN], times: " << times); if (is_running_ == false) { LOG4CPLUS_WARN_LOG(logger_statistic, "DownloadDriverStatistic is not running, return."); return; } // Update TakeSnapshot(); // write to memory if (NULL != shared_memory_.GetView()) { util::archive::ArchiveBuffer<> buf((char*)shared_memory_.GetView(), GetSharedMemorySize()); util::archive::LittleEndianBinaryOArchive<> oa(buf); oa << this->download_driver_statistic_info_; assert(oa); // memcpy(shared_memory_.GetView(), &info, GetSharedMemorySize()); LOG4CPLUS_DEBUG_LOG(logger_statistic, "Write DOWNLOADDRIVER_STATISTIC_INFO into SharedMemory"); } LOG4CPLUS_DEBUG_LOG(logger_statistic, "DownloadDriverStatistic::OnShareMemoryTimer [OUT]"); }
void CReplayManager::CheckReplay() { if (m_bReplayIsPending && gpGlobals->curtime >= m_flReplayActivationTime || m_bIsReplaying) RestoreSnapshot(); else if (!m_bIsReplaying && !SDKGameRules()->IsIntermissionState() && (!m_bReplayIsPending || m_MatchEvents.Count() > 0 && m_MatchEvents.Tail()->snapshotEndTime >= gpGlobals->curtime)) TakeSnapshot(); }
void InstructionTrace(INS ins, void* v) { // check if we just received a snapshot request bool snapshotStatus = CheckSnapshotEvent(); if (snapshotStatus) { // We just detected a monitoring change! Take a memory snapshot now TakeSnapshot(); // reset the event DisableSnapshotEvent(); } // check the monitoring event if we should still be monitoring or not bool monitoringStatus = CheckMonitoringEvent(); if (!monitoringStatus) { return; } instruction_trace trace; trace.tid = PIN_GetTid(); trace.address = INS_Address(ins); memset(trace.library_name, 0, 260); std::string libraryName; if (CHECK_LIBRARY_NAMES && GetLibraryName(trace.address, libraryName)) { snprintf(trace.library_name, sizeof(trace.library_name), "%s", libraryName.c_str()); } if (INS_IsCall(ins) == true) { trace.execution_depth = executionDepth++; } else if (INS_IsRet(ins) == true) { trace.execution_depth = executionDepth--; } else trace.execution_depth = executionDepth; trace.instruction_count = instructionCount++; #ifdef TARGET_WINDOWS trace.execution_time = WINDOWS::GetTickCount(); #else timeval time; gettimeofday(&time, NULL); unsigned long millis = (time.tv_sec * 1000) + (time.tv_usec / 1000); trace.execution_time = millis; #endif LogStruct(trace); }
/** * start the CameraTask **/ void StartCamera() { /* read a configuration file and send it to the camera */ char *imageName = "166StartPic.png"; //camera166 = AxisCamera::getInstance(); camera166 = &AxisCamera::GetInstance(); if ( 0 == camera166) { DPRINTF( LOG_DEBUG,"Failed to spawn camera task; exiting. Error code %s", GetVisionErrorText(GetLastVisionError()) ); } else { SetupCamera(resolution, rotation); TakeSnapshot(imageName); } }
void EXWaitingTreeCtrl::ExpandItem(HTREEITEM hItem) { if (m_hItemToPopulate == NULL) return; // just expand, doesn't want new items ASSERT(hItem == m_hItemToPopulate); // should never fail!!! if (m_bShowWaitMsg) { // display wait msg now, make sure it's visible SetRedraw(); EnsureVisible(m_hItemMsg); UpdateWindow(); } // setup animation thread, call PreAnimation StartAnimation(); // draw icon if (m_bShowWaitMsg) DrawUserIcon(); // delay redraw after populating SetRedraw(FALSE); // take a snapshot of the background TakeSnapshot(); // del temporary item (wait msg still shown) DeleteItem(m_hItemMsg); // fill in with sub items BOOL bCheckChildren = PopulateItem(hItem); // clean up animation thread, call PostAnimation StopAnimation(); // change parent to reflect current children number if (hItem != TVI_ROOT) { TVITEM item; item.hItem = hItem; item.mask = TVIF_HANDLE | TVIF_CHILDREN; item.cChildren = NeedsChildren(hItem) ? 0 : 1; if (bCheckChildren) SetItem(&item); else if (item.cChildren == 0) // restore item's plus button if no children inserted SetItemState(hItem, 0, TVIS_EXPANDED); } // clean up snapshot DestroySnapshot(); // redraw now SetRedraw(TRUE); }