void CWapDgrmTestStep::_FlushReserveArrayL(CWapReassemblyStore* aWapStore) /** * Method should be called only once during a test program run ! */ { TInt Count = iReserveArray->Count(); // In reverse oder for (TInt i=Count-1;i>=0;i--) { CWapDatagram* Wap=iReserveArray->At(i); if (!Wap->IsComplete()) { TInt Index = 0; TBool IsComplete = EFalse; IsComplete = aWapStore->AddMessageL(Index,*Wap); if (IsComplete) { aWapStore->GetDatagramL(Index,*Wap); aWapStore->BeginTransactionLC(); aWapStore->DeleteEntryL(Index); aWapStore->CommitTransactionL(); _Print(*Wap); } } else _Print(*Wap); } iReserveArray->ResetAndDestroy(); delete iReserveArray; iReserveArray = NULL; }
void CWapDgrmTestStep::_Parse2L(CArrayPtrFlat<CSmsMessage>& aSmsArray, CWapReassemblyStore* aWapStore) /** * This method tests mainly CWapDatagram::DecodeConcatenatedMessagesL */ { TInt Count = aSmsArray.Count(); // In reverse order // Note ! You can test additional features by changing value of // i or a global variable (insertSms). For example: // incrementing i by 1: a duplicate test // decrementing i by 1: not all datagrams are pushed to the store // ncreasing insertSms causes datagrams to be appended to the reserve array // Remember to set flush the reserve array on a later phase // by setting iIsFlushReserveArray true for (TInt i=Count-1;i>=iInsertSms;i--) { CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i))); if (!Wap->IsComplete()) { TInt Index = 0; TBool IsComplete = EFalse; IsComplete = aWapStore->AddMessageL(Index,*Wap); if (IsComplete) { aWapStore->GetDatagramL(Index,*Wap); aWapStore->BeginTransactionLC(); aWapStore->DeleteEntryL(Index); aWapStore->CommitTransactionL(); _Print(*Wap); } } else _Print(*Wap); delete Wap; } // append rest of the datagrams to the ReserveArray if (iInsertSms>0 && Count>1) { // reserve order here too for (TInt i=iInsertSms-1;i>=0;i--) { CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i))); iReserveArray->AppendL(Wap); } } if (iIsFlushReserveArray) { _FlushReserveArrayL(aWapStore); iInsertSms = 0; iIsFlushReserveArray = EFalse; } }
void CWapDgrmTestStep::DoTestWapProtDatagramL(const TDesC8& aBuffer, TDesC& aToAddress, TInt aToPort, TDesC& aFromAddress, TInt aFromPort, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, TBool aIs16BitPorts) /** * @test a short 7/8-bit datagram with explicit 16-bit port number */ { INFO_PRINTF1(_L("a 7/8-bit datagram with explicit 16-bit port number")); CArrayPtrFlat<CSmsMessage>* SmsArray = 0; CWapDatagram* Wap = NULL; RFs FileServerSession; CWapReassemblyStore* wapStore = NULL; if(iIsRunParsing) { TInt ret = FileServerSession.Connect(); TESTL(ret == KErrNone); wapStore = CWapReassemblyStore::NewL(FileServerSession); CleanupStack::PushL(wapStore); } _Print((aBuffer).Length());_Print(_L8(": <"));_Print(aBuffer);_Print(_L8(">\n")); Wap=CWapDatagram::NewL(aBuffer); CleanupStack::PushL(Wap); SmsArray = new (ELeave) CArrayPtrFlat<CSmsMessage>(8); CleanupStack::PushL(SmsArray); CleanupResetAndDestroyPushL(*SmsArray); ConstructWap(*Wap, aFromAddress, aToAddress, aFromPort, aToPort, aAlphabet, aIs16BitPorts); Wap->EncodeConcatenatedMessagesL(iFs, *SmsArray); if (iIsPrintEncoded) _PrintL(*SmsArray); if (iIsRunParsing) _Parse2L(*SmsArray, wapStore); CleanupStack::PopAndDestroy(3, Wap); // SmsArray elements (Reset and Destroy), SmsArray, Wap if (iIsRunParsing) { CleanupStack::PopAndDestroy(wapStore); FileServerSession.Close(); } }
void CWapDgrmTestStep::_PrintBool(TBool aTruth) /** * print a boolean number to the console */ { _Print((aTruth ? _L8("true") : _L8("false"))); }
void _Print(GeneralListNode* head) { GeneralListNode* cur = head; while (cur) { if (cur->_type == HEAD) { cout << "("; } else if (cur->_type == VALUE) { cout << cur->_value; if (cur->_next) { cout << ","; } } else if (cur->_type == SUB) { _Print(cur->_subLink); if (cur->_next) { cout << ","; } } cur = cur->_next;; } cout << ")"; }
void _Print(GeneralListNode* head) { GeneralListNode* begin = head; while (begin) { // // 1.头节点,则打印( // 2.值节点,则打印值 // 3.子表节点,则递归打印子表 // if (begin->_type == HEAD_TYPE) { cout<<"("; } else if(begin->_type == VALUE_TYPE) { cout<<(char)begin->_value; if (begin->_next) cout<<","; } else { _Print(begin->_subLink); if (begin->_next) cout<<","; } begin = begin->_next; } cout<<")"; }
void CWapThdrTestStep::_PrintSegments(CArrayPtrFlat<HBufC8>& aSegmentArray) /** * print an array of segments to the console */ { TBuf<16> NumStr; TInt Count = aSegmentArray.Count(); for (TInt i=0; i<Count; i++) { NumStr.Num(i); INFO_PRINTF1(NumStr); _Print(_L8(": ")); NumStr.Num((*aSegmentArray[i]).Length()); INFO_PRINTF1(NumStr); _Print(_L8(": ")); _Print(*aSegmentArray[i]); _Print(_L8("\n")); } }
//////////////////////////////////////////////////////////////////////////// // popis experimentu ... // main() { SetOutput("3telesa.dat"); _Print("# Model obØhu dru§ice kolem soustavy dvou tØles v C++/SIMLIB \n"); Init(0, 300); // inicializace experimentu InitGraphics(); SetStep(1e-12,0.01); SetAccuracy(1e-14); // je nutn vysok pýesnost Run(); // simulace DoneGraphics(); return 0; }
void XmlResultParser::_PrintTargetResults(const TargetResults& results) { // TODO: results.readBucketizer; // TODO: results.writeBucketizer; _Print("<Path>%s</Path>\n", results.sPath.c_str()); _Print("<BytesCount>%I64u</BytesCount>\n", results.ullBytesCount); _Print("<FileSize>%I64u</FileSize>\n", results.ullFileSize); _Print("<IOCount>%I64u</IOCount>\n", results.ullIOCount); _Print("<ReadBytes>%I64u</ReadBytes>\n", results.ullReadBytesCount); _Print("<ReadCount>%I64u</ReadCount>\n", results.ullReadIOCount); _Print("<WriteBytes>%I64u</WriteBytes>\n", results.ullWriteBytesCount); _Print("<WriteCount>%I64u</WriteCount>\n", results.ullWriteIOCount); }
void CWapDgrmTestStep::_PrintL(CArrayPtr<CSmsMessage>& aSmsArray) /** * print an array of SMS messages to the console */ { TInt Count = aSmsArray.Count(); TInt j = 1; for (TInt i=0;i<Count;i++,j++) { // Ordinal _Print(i); _Print(_L8(": \n")); CSmsMessage* Sms = aSmsArray.At(i); _Print(*Sms); // Print data CSmsBufferBase& SmsBuffer = Sms->Buffer(); _PrintL(SmsBuffer); } }
void XmlResultParser::_PrintTargetIops(const IoBucketizer& readBucketizer, const IoBucketizer& writeBucketizer, UINT32 bucketTimeInMs) { _Print("<Iops>\n"); IoBucketizer totalIoBucketizer; totalIoBucketizer.Merge(readBucketizer); totalIoBucketizer.Merge(writeBucketizer); if (readBucketizer.GetNumberOfValidBuckets() > 0) { _Print("<ReadIopsStdDev>%.3f</ReadIopsStdDev>\n", readBucketizer.GetStandardDeviationIOPS() / (bucketTimeInMs / 1000.0)); } if (writeBucketizer.GetNumberOfValidBuckets() > 0) { _Print("<WriteIopsStdDev>%.3f</WriteIopsStdDev>\n", writeBucketizer.GetStandardDeviationIOPS() / (bucketTimeInMs / 1000.0)); } if (totalIoBucketizer.GetNumberOfValidBuckets() > 0) { _Print("<IopsStdDev>%.3f</IopsStdDev>\n", totalIoBucketizer.GetStandardDeviationIOPS() / (bucketTimeInMs / 1000.0)); } _PrintIops(readBucketizer, writeBucketizer, bucketTimeInMs); _Print("</Iops>\n"); }
void CWapDgrmTestStep::_PrintL(CSmsBufferBase& aSmsBuffer) /** * print a SMS buffer to the console */ { HBufC16* WideBuffer = NULL; TInt Length = 0; // copy the data to the descriptor from aSmsBuffer Length = aSmsBuffer.Length(); WideBuffer = HBufC16::NewL(Length); TPtr16 WideChars = WideBuffer->Des(); aSmsBuffer.Extract(WideChars,0,Length); // Length _Print(WideChars.Length()); _Print(_L8(": <")); // Data _Print(WideChars); _Print(_L8(">\n")); delete WideBuffer; }
int main(int argc, char *argv[]) { SetOutput("ctest4.dat"); _Print("# Test \n"); if(argc>1) { double d = atof(argv[1]); if(d==0) return 3; ACCURACY = d; } Print("# SetAccuracy(%g) \n", ACCURACY); //DebugON(); // _Print("# implicitn¡ metoda (RKE) \n"); Init(0,ENDTIME); // inicializace experimentu SetAccuracy(ACCURACY); // rel chyba // SetMethod(SIMLIB_ABM4Step); // SetMethod(SIMLIB_RK45Step); // SetMethod(SIMLIB_EulerStep); // SetMethod(SIMLIB_RK23Step); // SetMethod(SIMLIB_FWStep); Run(); // simulace return 0; _Print("\n# Eulerova metoda \n"); Init(0,ENDTIME); // inicializace experimentu SetAccuracy(ACCURACY); SetMethod(SIMLIB_EulerStep); Run(); // simulace return 0; }
// emit the iops time series (this obviates needing perfmon counters, in common cases, and provides file level data) void XmlResultParser::_PrintIops(const IoBucketizer& readBucketizer, const IoBucketizer& writeBucketizer, UINT32 bucketTimeInMs) { bool done = false; for (size_t i = 0; !done; i++) { done = true; double r = 0.0; double r_min = 0.0; double r_max = 0.0; double r_avg = 0.0; double r_stddev = 0.0; double w = 0.0; double w_min = 0.0; double w_max = 0.0; double w_avg = 0.0; double w_stddev = 0.0; if (readBucketizer.GetNumberOfValidBuckets() > i) { r = readBucketizer.GetIoBucketCount(i) / (bucketTimeInMs / 1000.0); r_min = readBucketizer.GetIoBucketMinDurationUsec(i) / 1000.0; r_max = readBucketizer.GetIoBucketMaxDurationUsec(i) / 1000.0; r_avg = readBucketizer.GetIoBucketAvgDurationUsec(i) / 1000.0; r_stddev = readBucketizer.GetIoBucketDurationStdDevUsec(i) / 1000.0; done = false; } if (writeBucketizer.GetNumberOfValidBuckets() > i) { w = writeBucketizer.GetIoBucketCount(i) / (bucketTimeInMs / 1000.0); w_min = writeBucketizer.GetIoBucketMinDurationUsec(i) / 1000.0; w_max = writeBucketizer.GetIoBucketMaxDurationUsec(i) / 1000.0; w_avg = writeBucketizer.GetIoBucketAvgDurationUsec(i) / 1000.0; w_stddev = writeBucketizer.GetIoBucketDurationStdDevUsec(i) / 1000.0; done = false; } if (!done) { _Print("<Bucket SampleMillisecond=\"%lu\" Read=\"%.0f\" Write=\"%.0f\" Total=\"%.0f\" " "ReadMinLatencyMilliseconds=\"%.3f\" ReadMaxLatencyMilliseconds=\"%.3f\" ReadAvgLatencyMilliseconds=\"%.3f\" ReadLatencyStdDev=\"%.3f\" " "WriteMinLatencyMilliseconds=\"%.3f\" WriteMaxLatencyMilliseconds=\"%.3f\" WriteAvgLatencyMilliseconds=\"%.3f\" WriteLatencyStdDev=\"%.3f\"/>\n", bucketTimeInMs*(i + 1), r, w, r + w, r_min, r_max, r_avg, r_stddev, w_min, w_max, w_avg, w_stddev); } } }
BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) { _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n", lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation); _Print("Calling DetourCreateProcessWithDllExW(,%hs)\n", s_szDllPath); BOOL rv = 0; __try { rv = DetourCreateProcessWithDllExW(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation, s_szDllPath, Real_CreateProcessW); } __finally { _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv); }; return rv; }
/* Function for printing frame number only once */ static void beginFrame( _VGContext * Context ) { if (Context->profiler.enable) { if (!Context->profiler.frameBegun) { #if gcdNEW_PROFILER_FILE gcmWRITE_COUNTER(VPG_FRAME, Context->profiler.frameNumber); #else _Print(Context, "<Frame value=\"%d\">\n", Context->profiler.frameNumber); #endif Context->profiler.frameBegun = 1; } } }
void XmlResultParser::_PrintTargetLatency(const TargetResults& results) { if (results.readLatencyHistogram.GetSampleSize() > 0) { _Print("<AverageReadLatencyMilliseconds>%.3f</AverageReadLatencyMilliseconds>\n", results.readLatencyHistogram.GetAvg() / 1000); _Print("<ReadLatencyStdev>%.3f</ReadLatencyStdev>\n", results.readLatencyHistogram.GetStandardDeviation() / 1000); } if (results.writeLatencyHistogram.GetSampleSize() > 0) { _Print("<AverageWriteLatencyMilliseconds>%.3f</AverageWriteLatencyMilliseconds>\n", results.writeLatencyHistogram.GetAvg() / 1000); _Print("<WriteLatencyStdev>%.3f</WriteLatencyStdev>\n", results.writeLatencyHistogram.GetStandardDeviation() / 1000); } Histogram<float> totalLatencyHistogram; totalLatencyHistogram.Merge(results.readLatencyHistogram); totalLatencyHistogram.Merge(results.writeLatencyHistogram); if (totalLatencyHistogram.GetSampleSize() > 0) { _Print("<AverageLatencyMilliseconds>%.3f</AverageLatencyMilliseconds>\n", totalLatencyHistogram.GetAvg() / 1000); _Print("<LatencyStdev>%.3f</LatencyStdev>\n", totalLatencyHistogram.GetStandardDeviation() / 1000); } }
void Print() { _Print(_head); cout<<endl; }
void ShowImageWindow::MessageReceived(BMessage *message) { switch (message->what) { case MSG_MODIFIED: // If image has been modified due to a Cut or Paste fModified = true; break; case MSG_OUTPUT_TYPE: // User clicked Save As then choose an output format if (!fSavePanel) // If user doesn't already have a save panel open _SaveAs(message); break; case MSG_SAVE_PANEL: // User specified where to save the output image _SaveToFile(message); break; case B_CANCEL: delete fSavePanel; fSavePanel = NULL; break; case MSG_UPDATE_STATUS: { int32 pages = fImageView->PageCount(); int32 curPage = fImageView->CurrentPage(); bool benable = (pages > 1) ? true : false; _EnableMenuItem(fBar, MSG_PAGE_FIRST, benable); _EnableMenuItem(fBar, MSG_PAGE_LAST, benable); _EnableMenuItem(fBar, MSG_PAGE_NEXT, benable); _EnableMenuItem(fBar, MSG_PAGE_PREV, benable); _EnableMenuItem(fBar, MSG_FILE_NEXT, fImageView->HasNextFile()); _EnableMenuItem(fBar, MSG_FILE_PREV, fImageView->HasPrevFile()); if (fGoToPageMenu->CountItems() != pages) { // Only rebuild the submenu if the number of // pages is different while (fGoToPageMenu->CountItems() > 0) // Remove all page numbers delete fGoToPageMenu->RemoveItem(0L); for (int32 i = 1; i <= pages; i++) { // Fill Go To page submenu with an entry for each page BMessage *pgomsg = new BMessage(MSG_GOTO_PAGE); pgomsg->AddInt32("page", i); char shortcut = 0; if (i < 10) { shortcut = '0' + i; } else if (i == 10) { shortcut = '0'; } BString strCaption; strCaption << i; BMenuItem *item = new BMenuItem(strCaption.String(), pgomsg, shortcut); if (curPage == i) item->SetMarked(true); fGoToPageMenu->AddItem(item); } } else { // Make sure the correct page is marked BMenuItem *pcurItem; pcurItem = fGoToPageMenu->ItemAt(curPage - 1); if (!pcurItem->IsMarked()) { pcurItem->SetMarked(true); } } // Disable the Invert menu item if the bitmap color space // is B_CMAP8. (B_CMAP8 is currently unsupported by the // invert algorithm) color_space colors = B_NO_COLOR_SPACE; message->FindInt32("colors", reinterpret_cast<int32 *>(&colors)); _EnableMenuItem(fBar, MSG_INVERT, (colors != B_CMAP8)); BString status; bool messageProvidesSize = false; if (message->FindInt32("width", &fWidth) >= B_OK && message->FindInt32("height", &fHeight) >= B_OK) { status << fWidth << "x" << fHeight; messageProvidesSize = true; } BString str; if (message->FindString("status", &str) == B_OK && str.Length() > 0) { if (status.Length() > 0) status << ", "; status << str; } if (messageProvidesSize) { _UpdateResizerWindow(fWidth, fHeight); if (!fImageView->GetZoomToBounds() && !fImageView->GetShrinkToBounds() && !fFullScreen) WindowRedimension(fImageView->GetBitmap()); } fStatusView->SetText(status); UpdateTitle(); } break; case MSG_UPDATE_STATUS_TEXT: { BString status; status << fWidth << "x" << fHeight; BString str; if (message->FindString("status", &str) == B_OK && str.Length() > 0) { status << ", " << str; fStatusView->SetText(status); } } break; case MSG_SELECTION: { // The view sends this message when a selection is // made or the selection is cleared so that the window // can update the state of the appropriate menu items bool benable; if (message->FindBool("has_selection", &benable) == B_OK) { _EnableMenuItem(fBar, B_CUT, benable); _EnableMenuItem(fBar, B_COPY, benable); _EnableMenuItem(fBar, MSG_CLEAR_SELECT, benable); } } break; case MSG_UNDO_STATE: { bool benable; if (message->FindBool("can_undo", &benable) == B_OK) _EnableMenuItem(fBar, B_UNDO, benable); } break; case MSG_CLIPBOARD_CHANGED: { // The app sends this message after it examines the clipboard in // response to a B_CLIPBOARD_CHANGED message bool bdata; if (message->FindBool("data_available", &bdata) == B_OK) _EnableMenuItem(fBar, B_PASTE, bdata); } break; case B_UNDO: fImageView->Undo(); break; case B_CUT: fImageView->Cut(); break; case B_COPY: fImageView->CopySelectionToClipboard(); break; case B_PASTE: fImageView->Paste(); break; case MSG_CLEAR_SELECT: fImageView->ClearSelection(); break; case MSG_SELECT_ALL: fImageView->SelectAll(); break; case MSG_PAGE_FIRST: if (_ClosePrompt()) fImageView->FirstPage(); break; case MSG_PAGE_LAST: if (_ClosePrompt()) fImageView->LastPage(); break; case MSG_PAGE_NEXT: if (_ClosePrompt()) fImageView->NextPage(); break; case MSG_PAGE_PREV: if (_ClosePrompt()) fImageView->PrevPage(); break; case MSG_GOTO_PAGE: { if (!_ClosePrompt()) break; int32 newPage; if (message->FindInt32("page", &newPage) != B_OK) break; int32 curPage = fImageView->CurrentPage(); int32 pages = fImageView->PageCount(); if (newPage > 0 && newPage <= pages) { BMenuItem* pcurItem = fGoToPageMenu->ItemAt(curPage - 1); BMenuItem* pnewItem = fGoToPageMenu->ItemAt(newPage - 1); if (pcurItem && pnewItem) { pcurItem->SetMarked(false); pnewItem->SetMarked(true); fImageView->GoToPage(newPage); } } } break; case MSG_DITHER_IMAGE: fImageView->SetDither(_ToggleMenuItem(message->what)); break; case MSG_SHRINK_TO_WINDOW: _ResizeToWindow(true, message->what); break; case MSG_ZOOM_TO_WINDOW: _ResizeToWindow(false, message->what); break; case MSG_FILE_PREV: if (_ClosePrompt()) fImageView->PrevFile(); break; case MSG_FILE_NEXT: if (_ClosePrompt()) fImageView->NextFile(); break; case MSG_ROTATE_90: fImageView->Rotate(90); break; case MSG_ROTATE_270: fImageView->Rotate(270); break; case MSG_FLIP_LEFT_TO_RIGHT: fImageView->Flip(true); break; case MSG_FLIP_TOP_TO_BOTTOM: fImageView->Flip(false); break; case MSG_INVERT: fImageView->Invert(); break; case MSG_SLIDE_SHOW: { BMenuItem *item = fBar->FindItem(message->what); if (!item) break; if (item->IsMarked()) { item->SetMarked(false); fResizeItem->SetEnabled(true); fImageView->StopSlideShow(); } else if (_ClosePrompt()) { item->SetMarked(true); fResizeItem->SetEnabled(false); fImageView->StartSlideShow(); } } break; case MSG_SLIDE_SHOW_DELAY: { float value; if (message->FindFloat("value", &value) == B_OK) { fImageView->SetSlideShowDelay(value); // in case message is sent from popup menu _MarkSlideShowDelay(value); } } break; case MSG_FULL_SCREEN: _ToggleFullScreen(); break; case MSG_EXIT_FULL_SCREEN: if (fFullScreen) _ToggleFullScreen(); break; case MSG_SHOW_CAPTION: { fShowCaption = _ToggleMenuItem(message->what); ShowImageSettings* settings = my_app->Settings(); if (settings->Lock()) { settings->SetBool("ShowCaption", fShowCaption); settings->Unlock(); } if (fFullScreen) fImageView->SetShowCaption(fShowCaption); } break; case MSG_PAGE_SETUP: _PageSetup(); break; case MSG_PREPARE_PRINT: _PrepareForPrint(); break; case MSG_PRINT: _Print(message); break; case MSG_ZOOM_IN: fImageView->ZoomIn(); break; case MSG_ZOOM_OUT: fImageView->ZoomOut(); break; case MSG_ORIGINAL_SIZE: fImageView->SetZoom(1.0); break; case MSG_SCALE_BILINEAR: fImageView->SetScaleBilinear(_ToggleMenuItem(message->what)); break; case MSG_OPEN_RESIZER_WINDOW: { if (fImageView->GetBitmap() != NULL) { BRect rect = fImageView->GetBitmap()->Bounds(); _OpenResizerWindow(rect.IntegerWidth()+1, rect.IntegerHeight()+1); } } break; case MSG_RESIZE: { int w = message->FindInt32("w"); int h = message->FindInt32("h"); fImageView->ResizeImage(w, h); } break; case MSG_RESIZER_WINDOW_QUIT: delete fResizerWindowMessenger; fResizerWindowMessenger = NULL; break; case MSG_DESKTOP_BACKGROUND: { BMessage message(B_REFS_RECEIVED); message.AddRef("refs", fImageView->Image()); // This is used in the Backgrounds code for scaled placement message.AddInt32("placement", 'scpl'); be_roster->Launch("application/x-vnd.antares-backgrounds", &message); } break; default: BWindow::MessageReceived(message); break; } }
VOID _PrintDump(HANDLE h, PCHAR pszData, INT cbData) { if (pszData && cbData > 0) { CHAR szBuffer[256]; PCHAR pszBuffer = szBuffer; INT cbBuffer = 0; INT nLines = 0; while (cbData > 0) { if (nLines > 20) { *pszBuffer++ = '.'; *pszBuffer++ = '.'; *pszBuffer++ = '.'; cbBuffer += 3; break; } if (*pszData == '\t') { *pszBuffer++ = '\\'; *pszBuffer++ = 't'; cbBuffer += 2; pszData++; cbData--; continue; } if (*pszData == '\r') { *pszBuffer++ = '\\'; *pszBuffer++ = 'r'; cbBuffer += 2; pszData++; cbData--; continue; } else if (*pszData == '\n') { *pszBuffer++ = '\\'; *pszBuffer++ = 'n'; cbBuffer += 2; *pszBuffer++ = '\0'; _Print("%p: %hs\n", h, szBuffer); nLines++; pszBuffer = szBuffer; cbBuffer = 0; pszData++; cbData--; continue; } else if (cbBuffer >= 80) { *pszBuffer++ = '\0'; _Print("%p: %hs\n", h, szBuffer); nLines++; pszBuffer = szBuffer; cbBuffer = 0; } if (*pszData < ' ' || *pszData >= 127) { *pszBuffer++ = '\\'; *pszBuffer++ = 'x'; *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0xf0) >> 4]; *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0x0f)]; cbBuffer += 4; } else {
int functionDAE(int *needToIterate) { state mem_state; initial_rettype tmp1014; modelica_boolean tmp1015; modelica_boolean tmp1016; change_rettype tmp1017; modelica_real tmp1018; *needToIterate = 0; inUpdate=initial()?0:1; mem_state = get_memory_state(); $P$DER$Py = $Px; $P$DER$Px = (-$Py); /*#modelicaLine [TestExt.mo:9:1-11:9]*/ tmp1014 = initial(); localData->helpVars[3] = tmp1014; if (edge(localData->helpVars[3])) { /*#modelicaLine [TestExt.mo:10:2-10:8]*/ #ifdef _OMC_MEASURE_TIME SIM_PROF_TICK_FN(Init_index); #endif _Init(); #ifdef _OMC_MEASURE_TIME SIM_PROF_ACC_FN(Init_index); #endif /* NORETCALL */; /*#endModelicaLine*/ } /*#endModelicaLine*/ /*#modelicaLine [TestExt.mo:12:3-16:11]*/ SAVEZEROCROSS(tmp1016, $Px, 0.0, 1,Greater,>); localData->helpVars[1] = tmp1016; SAVEZEROCROSS(tmp1015, $Px, 0.0, -1,LessEq,<=); localData->helpVars[2] = tmp1015; if (edge(localData->helpVars[1])) { /*#modelicaLine [TestExt.mo:13:5-13:11]*/ $Ps = 1.0; /*#endModelicaLine*/ } else if (edge(localData->helpVars[2])) { /*#modelicaLine [TestExt.mo:15:5-15:11]*/ $Ps = 0.0; /*#endModelicaLine*/ } /*#endModelicaLine*/ /*#modelicaLine [TestExt.mo:18:3-20:11]*/ tmp1017 = change($Ps); localData->helpVars[0] = tmp1017; if (edge(localData->helpVars[0])) { /*#modelicaLine [TestExt.mo:19:4-19:24]*/ tmp1018 = pre($Ps); #ifdef _OMC_MEASURE_TIME SIM_PROF_TICK_FN(Print_index); #endif _Print($Ps, tmp1018, time); #ifdef _OMC_MEASURE_TIME SIM_PROF_ACC_FN(Print_index); #endif /* NORETCALL */; /*#endModelicaLine*/ } /*#endModelicaLine*/ restore_memory_state(mem_state); inUpdate=0; return 0; }
void CWapThdrTestStep::_PrintHeaderL(const TWapTextMessage& aHdr) /** * print a WAP text message header to the console */ { TInt Value=0; TBuf<16> NumStr; TBuf8<160> OtherHeader; TBuf8<160> Data; TBool IsLong = EFalse; _Print(_L8("\n")); OtherHeader.Zero(); Data.Zero(); _Print(_L8("DestPort: SrcPort: RefNumber: TotalSegments: SegmentNumber\n")); Value=aHdr.DestinationPort(&IsLong); NumStr.Num(Value); INFO_PRINTF1(NumStr); _Print(_L8(": ")); Value=aHdr.SourcePort(&IsLong); NumStr.Num(Value); INFO_PRINTF1(NumStr); _Print(_L8(": ")); Value=aHdr.ReferenceNumber(); NumStr.Num(Value); INFO_PRINTF1(NumStr); _Print(_L8(": ")); Value=aHdr.TotalSegments(); NumStr.Num(Value); INFO_PRINTF1(NumStr); _Print(_L8(": ")); Value=aHdr.SegmentNumber(); NumStr.Num(Value); INFO_PRINTF1(NumStr); _Print(_L8("\n")); aHdr.OtherHeader(OtherHeader); _Print(_L8("OtherHeader: ")); _Print(OtherHeader); _Print(_L8("\n")); aHdr.UserData(Data); _Print(_L8("Data: ")); _Print(Data); _Print(_L8("\n")); // assert destination port if (IsLong) TESTL((aHdr.DestinationPort()>=0 && aHdr.DestinationPort()<=65535)); else TESTL((aHdr.DestinationPort()>=0 && aHdr.DestinationPort()<=255)); // assert source port if (IsLong) TESTL((aHdr.SourcePort()>=0 && aHdr.SourcePort()<=65535)); else TESTL((aHdr.SourcePort()>=0 && aHdr.SourcePort()<=255)); // assert reference number if (IsLong) TESTL((aHdr.ReferenceNumber()>=0 && aHdr.ReferenceNumber()<=65535)); else TESTL((aHdr.ReferenceNumber()>=0 && aHdr.ReferenceNumber()<=255)); TESTL((aHdr.TotalSegments()>=1 && aHdr.TotalSegments()<=255)); TESTL((aHdr.SegmentNumber()>=1 && aHdr.SegmentNumber()<=255)); }
string XmlResultParser::ParseResults(Profile& profile, const SystemInformation& system, vector<Results> vResults) { _sResult.clear(); _Print("<Results>\n"); _sResult += system.GetXml(); _sResult += profile.GetXml(); for (size_t iResults = 0; iResults < vResults.size(); iResults++) { const Results& results = vResults[iResults]; const TimeSpan& timeSpan = profile.GetTimeSpans()[iResults]; _Print("<TimeSpan>\n"); double fTime = PerfTimer::PerfTimeToSeconds(results.ullTimeCount); //test duration if (fTime >= 0.0000001) { // There either is a fixed number of threads for all files to share (GetThreadCount() > 0) or a number of threads per file. // In the latter case vThreadResults.size() == number of threads per file * file count size_t ulThreadCnt = (timeSpan.GetThreadCount() > 0) ? timeSpan.GetThreadCount() : results.vThreadResults.size(); unsigned int ulProcCount = system.processorTopology._ulActiveProcCount; _Print("<TestTimeSeconds>%.2f</TestTimeSeconds>\n", fTime); _Print("<ThreadCount>%u</ThreadCount>\n", ulThreadCnt); _Print("<RequestCount>%u</RequestCount>\n", timeSpan.GetRequestCount()); _Print("<ProcCount>%u</ProcCount>\n", ulProcCount); _PrintCpuUtilization(results, system); if (timeSpan.GetMeasureLatency()) { _PrintLatencyPercentiles(results); } if (timeSpan.GetCalculateIopsStdDev()) { _PrintOverallIops(results, timeSpan.GetIoBucketDurationInMilliseconds()); } if (results.fUseETW) { _PrintETW(results.EtwMask, results.EtwEventCounters); _PrintETWSessionInfo(results.EtwSessionInfo); } for (size_t iThread = 0; iThread < results.vThreadResults.size(); iThread++) { const ThreadResults& threadResults = results.vThreadResults[iThread]; _Print("<Thread>\n"); _Print("<Id>%u</Id>\n", iThread); for (const auto& targetResults : threadResults.vTargetResults) { _Print("<Target>\n"); _PrintTargetResults(targetResults); if (timeSpan.GetMeasureLatency()) { _PrintTargetLatency(targetResults); } if (timeSpan.GetCalculateIopsStdDev()) { _PrintTargetIops(targetResults.readBucketizer, targetResults.writeBucketizer, timeSpan.GetIoBucketDurationInMilliseconds()); } _Print("</Target>\n"); } _Print("</Thread>\n"); } } else { _Print("<Error>The test was interrupted before the measurements began. No results are displayed.</Error>\n"); } _Print("</TimeSpan>\n"); } _Print("</Results>"); return _sResult; }
void PrintGeneralList() { _Print(_head); cout << endl; }
void CWapDgrmTestStep::_Print(CSmsMessage& aSms) /** * print a SMS message to the console */ { TSmsUserDataSettings UserDataSettings; TBool IsComplete = EFalse; const TPtrC& Address = aSms.ToFromAddress(); TInt ToPort = 0; TInt FromPort = 0; TInt Is16BitPorts = 0; TBool IsPorts = EFalse; TSmsDataCodingScheme::TSmsAlphabet Alphabet; // Print CSmsMessage settings CSmsPDU& Pdu = aSms.SmsPDU(); IsComplete = aSms.IsComplete(); aSms.UserDataSettings(UserDataSettings); Alphabet = UserDataSettings.Alphabet(); _Print(_L8("CSmsMessage:: IsComplete: ToFromAddress: Alphabet\n")); _PrintBool(IsComplete); _Print(_L8(": ")); _Print(Address); _Print(_L8(": ")); _Print(Alphabet); _Print(_L8("\n")); IsPorts = Pdu.ApplicationPortAddressing(ToPort,FromPort,&Is16BitPorts); _Print(_L8("IsPorts: FromPort: ToPort: Is16BitPorts\n")); _PrintBool(IsPorts); _Print(_L8(": ")); _Print(FromPort); _Print(_L8(": ")); _Print(ToPort); _Print(_L8(": ")); _PrintBool(Is16BitPorts); _Print(_L8("\n")); }
// Purpose: texture decoding of block_num int block(bitstream *bs, mp4_private_t *priv, int block_num, int coded) { int i; int dct_dc_size, dct_dc_diff; vop_header_t *h = &priv->vop_header; VdpDecoderMpeg4VolHeader *vol = &priv->mpeg4VolHdr; int intraFlag = ((h->derived_mb_type == INTRA) || (h->derived_mb_type == INTRA_Q)) ? 1 : 0; event_t event; //clearblock(ld->block); // clearblock if (intraFlag) { setDCscaler(priv, block_num); // calculate DC scaler if (block_num < 4) { dct_dc_size = getDCsizeLum(bs); if (dct_dc_size != 0) dct_dc_diff = getDCdiff(bs, dct_dc_size); else dct_dc_diff = 0; if (dct_dc_size > 8) get_bits(bs, 1); // marker bit } else { dct_dc_size = getDCsizeChr(bs); if (dct_dc_size != 0) dct_dc_diff = getDCdiff(bs, dct_dc_size); else dct_dc_diff = 0; if (dct_dc_size > 8) get_bits(bs, 1); // marker bit } //ld->block[0] = (short) dct_dc_diff; // _Print("DC diff: %d\n", dct_dc_diff); } if (intraFlag) { // dc reconstruction, prediction direction //dc_recon(block_num, &ld->block[0]); } if (coded) { #if 0 unsigned int * zigzag; // zigzag scan dir if ((intraFlag) && (h->ac_pred_flag == 1)) { if (priv->coeff_pred.predict_dir == TOP) zigzag = priv->tables.alternate_horizontal_scan; else zigzag = priv->tables.alternate_vertical_scan; } else { zigzag = priv->tables.zig_zag_scan; } #endif i = intraFlag ? 1 : 0; do // event vld { event = vld_event(bs, priv, intraFlag); /*** if (event.run == -1) { printf("Error: invalid vld code\n"); exit(201); } ***/ i+= event.run; //ld->block[zigzag[i]] = (short) event.level; // _Print("Vld Event: Run Level Last %d %d %d\n", event.run, event.level, event.last); i++; } while (! event.last); } if (intraFlag) { // ac reconstruction // ac_rescaling(...) //ac_recon(block_num, &ld->block[0]); } #ifdef _DEBUG_B_ACDC if (intraFlag) { int i; _Print("After AcDcRecon:\n"); _Print(" x "); for (i = 1; i < 64; i++) { if ((i != 0) && ((i % 8) == 0)) _Print("\n"); _Print("%4d ", ld->block[i]); } _Print("\n"); } #endif // _DEBUG_ACDC if (vol->quant_type == 0) { // inverse quantization //iquant(ld->block, intraFlag); } else { printf("Error: MPEG-2 inverse quantization NOT implemented\n"); exit(110); } #ifdef _DEBUG_B_QUANT { int i; _Print("After IQuant:\n"); _Print(" x "); for (i = 1; i < 64; i++) { if ((i != 0) && ((i % 8) == 0)) _Print("\n"); _Print("%4d ", ld->block[i]); } _Print("\n"); } #endif // _DEBUG_B_QUANT // inverse dct //idct(ld->block); return 1; }
void ShowImageWindow::MessageReceived(BMessage* message) { if (message->WasDropped()) { uint32 type; int32 count; status_t status = message->GetInfo("refs", &type, &count); if (status == B_OK && type == B_REF_TYPE) { message->what = B_REFS_RECEIVED; be_app->PostMessage(message); } } switch (message->what) { case kMsgImageCacheImageLoaded: { fProgressWindow->Stop(); BitmapOwner* bitmapOwner = NULL; message->FindPointer("bitmapOwner", (void**)&bitmapOwner); bool first = fImageView->Bitmap() == NULL; entry_ref ref; message->FindRef("ref", &ref); if (!first && ref != fNavigator.CurrentRef()) { // ignore older images if (bitmapOwner != NULL) bitmapOwner->ReleaseReference(); break; } int32 page = message->FindInt32("page"); int32 pageCount = message->FindInt32("pageCount"); if (!first && page != fNavigator.CurrentPage()) { // ignore older pages if (bitmapOwner != NULL) bitmapOwner->ReleaseReference(); break; } status_t status = fImageView->SetImage(message); if (status != B_OK) { if (bitmapOwner != NULL) bitmapOwner->ReleaseReference(); _LoadError(ref); // quit if file could not be opened if (first) Quit(); break; } fImageType = message->FindString("type"); fNavigator.SetTo(ref, page, pageCount); fImageView->FitToBounds(); if (first) { fImageView->MakeFocus(true); // to receive key messages Show(); } _UpdateRatingMenu(); // Set width and height attributes of the currently showed file. // This should only be a temporary solution. _SaveWidthAndHeight(); break; } case kMsgImageCacheProgressUpdate: { entry_ref ref; if (message->FindRef("ref", &ref) == B_OK && ref == fNavigator.CurrentRef()) { message->what = kMsgProgressUpdate; fProgressWindow->PostMessage(message); } break; } case MSG_MODIFIED: // If image has been modified due to a Cut or Paste fModified = true; break; case MSG_OUTPUT_TYPE: // User clicked Save As then choose an output format if (!fSavePanel) // If user doesn't already have a save panel open _SaveAs(message); break; case MSG_SAVE_PANEL: // User specified where to save the output image _SaveToFile(message); break; case B_CANCEL: delete fSavePanel; fSavePanel = NULL; break; case MSG_UPDATE_STATUS: { int32 pages = fNavigator.PageCount(); int32 currentPage = fNavigator.CurrentPage(); _EnableMenuItem(fBar, MSG_PAGE_FIRST, fNavigator.HasPreviousPage()); _EnableMenuItem(fBar, MSG_PAGE_LAST, fNavigator.HasNextPage()); _EnableMenuItem(fBar, MSG_PAGE_NEXT, fNavigator.HasNextPage()); _EnableMenuItem(fBar, MSG_PAGE_PREV, fNavigator.HasPreviousPage()); fGoToPageMenu->SetEnabled(pages > 1); _EnableMenuItem(fBar, MSG_FILE_NEXT, fNavigator.HasNextFile()); _EnableMenuItem(fBar, MSG_FILE_PREV, fNavigator.HasPreviousFile()); if (fGoToPageMenu->CountItems() != pages) { // Only rebuild the submenu if the number of // pages is different while (fGoToPageMenu->CountItems() > 0) { // Remove all page numbers delete fGoToPageMenu->RemoveItem((int32)0); } for (int32 i = 1; i <= pages; i++) { // Fill Go To page submenu with an entry for each page BMessage* goTo = new BMessage(MSG_GOTO_PAGE); goTo->AddInt32("page", i); char shortcut = 0; if (i < 10) shortcut = '0' + i; BString strCaption; strCaption << i; BMenuItem* item = new BMenuItem(strCaption.String(), goTo, shortcut, B_SHIFT_KEY); if (currentPage == i) item->SetMarked(true); fGoToPageMenu->AddItem(item); } } else { // Make sure the correct page is marked BMenuItem* currentItem = fGoToPageMenu->ItemAt(currentPage - 1); if (currentItem != NULL && !currentItem->IsMarked()) currentItem->SetMarked(true); } _UpdateStatusText(message); BPath path(fImageView->Image()); SetTitle(path.Path()); break; } case MSG_UPDATE_STATUS_TEXT: { _UpdateStatusText(message); break; } case MSG_SELECTION: { // The view sends this message when a selection is // made or the selection is cleared so that the window // can update the state of the appropriate menu items bool enable; if (message->FindBool("has_selection", &enable) == B_OK) { _EnableMenuItem(fBar, B_COPY, enable); _EnableMenuItem(fBar, MSG_CLEAR_SELECT, enable); } break; } case B_COPY: fImageView->CopySelectionToClipboard(); break; case MSG_SELECTION_MODE: { bool selectionMode = _ToggleMenuItem(MSG_SELECTION_MODE); fImageView->SetSelectionMode(selectionMode); if (!selectionMode) fImageView->ClearSelection(); break; } case MSG_CLEAR_SELECT: fImageView->ClearSelection(); break; case MSG_SELECT_ALL: fImageView->SelectAll(); break; case MSG_PAGE_FIRST: if (_ClosePrompt() && fNavigator.FirstPage()) _LoadImage(); break; case MSG_PAGE_LAST: if (_ClosePrompt() && fNavigator.LastPage()) _LoadImage(); break; case MSG_PAGE_NEXT: if (_ClosePrompt() && fNavigator.NextPage()) _LoadImage(); break; case MSG_PAGE_PREV: if (_ClosePrompt() && fNavigator.PreviousPage()) _LoadImage(); break; case MSG_GOTO_PAGE: { if (!_ClosePrompt()) break; int32 newPage; if (message->FindInt32("page", &newPage) != B_OK) break; int32 currentPage = fNavigator.CurrentPage(); int32 pages = fNavigator.PageCount(); // TODO: use radio mode instead! if (newPage > 0 && newPage <= pages) { BMenuItem* currentItem = fGoToPageMenu->ItemAt(currentPage - 1); BMenuItem* newItem = fGoToPageMenu->ItemAt(newPage - 1); if (currentItem != NULL && newItem != NULL) { currentItem->SetMarked(false); newItem->SetMarked(true); if (fNavigator.GoToPage(newPage)) _LoadImage(); } } break; } case kMsgFitToWindow: fImageView->FitToBounds(); break; case kMsgStretchToWindow: fImageView->SetStretchToBounds( _ToggleMenuItem(kMsgStretchToWindow)); break; case MSG_FILE_PREV: if (_ClosePrompt() && fNavigator.PreviousFile()) _LoadImage(false); break; case MSG_FILE_NEXT: case kMsgNextSlide: if (_ClosePrompt() && fNavigator.NextFile()) _LoadImage(); break; case kMsgDeleteCurrentFile: { if (fNavigator.MoveFileToTrash()) _LoadImage(); else PostMessage(B_QUIT_REQUESTED); break; } case MSG_ROTATE_90: fImageView->Rotate(90); break; case MSG_ROTATE_270: fImageView->Rotate(270); break; case MSG_FLIP_LEFT_TO_RIGHT: fImageView->Flip(true); break; case MSG_FLIP_TOP_TO_BOTTOM: fImageView->Flip(false); break; case MSG_SLIDE_SHOW: { bool fullScreen = false; message->FindBool("full screen", &fullScreen); BMenuItem* item = fBar->FindItem(message->what); if (item == NULL) break; if (item->IsMarked()) { item->SetMarked(false); _StopSlideShow(); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, false); } else if (_ClosePrompt()) { item->SetMarked(true); if (!fFullScreen && fullScreen) _ToggleFullScreen(); _StartSlideShow(); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, true); } break; } case kMsgStopSlideShow: { BMenuItem* item = fBar->FindItem(MSG_SLIDE_SHOW); if (item != NULL) item->SetMarked(false); _StopSlideShow(); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, false); break; } case MSG_SLIDE_SHOW_DELAY: { bigtime_t delay; if (message->FindInt64("delay", &delay) == B_OK) { _SetSlideShowDelay(delay); // in case message is sent from popup menu _MarkSlideShowDelay(delay); } break; } case MSG_FULL_SCREEN: _ToggleFullScreen(); break; case MSG_EXIT_FULL_SCREEN: if (fFullScreen) _ToggleFullScreen(); break; case MSG_SHOW_CAPTION: { fShowCaption = _ToggleMenuItem(message->what); ShowImageSettings* settings = my_app->Settings(); if (settings->Lock()) { settings->SetBool("ShowCaption", fShowCaption); settings->Unlock(); } if (fFullScreen) fImageView->SetShowCaption(fShowCaption); } break; case MSG_PAGE_SETUP: _PageSetup(); break; case MSG_PREPARE_PRINT: _PrepareForPrint(); break; case MSG_PRINT: _Print(message); break; case MSG_ZOOM_IN: fImageView->ZoomIn(); break; case MSG_ZOOM_OUT: fImageView->ZoomOut(); break; case MSG_UPDATE_STATUS_ZOOM: fStatusView->SetZoom(fImageView->Zoom()); break; case kMsgOriginalSize: if (message->FindInt32("behavior") == BButton::B_TOGGLE_BEHAVIOR) { bool force = (message->FindInt32("be:value") == B_CONTROL_ON); fImageView->ForceOriginalSize(force); if (!force) break; } fImageView->SetZoom(1.0); break; case MSG_SCALE_BILINEAR: fImageView->SetScaleBilinear(_ToggleMenuItem(message->what)); break; case MSG_DESKTOP_BACKGROUND: { BMessage backgroundsMessage(B_REFS_RECEIVED); backgroundsMessage.AddRef("refs", fImageView->Image()); // This is used in the Backgrounds code for scaled placement backgroundsMessage.AddInt32("placement", 'scpl'); be_roster->Launch("application/x-vnd.haiku-backgrounds", &backgroundsMessage); break; } case MSG_SET_RATING: { int32 rating; if (message->FindInt32("rating", &rating) != B_OK) break; BFile file(&fNavigator.CurrentRef(), B_WRITE_ONLY); if (file.InitCheck() != B_OK) break; file.WriteAttr("Media:Rating", B_INT32_TYPE, 0, &rating, sizeof(rating)); _UpdateRatingMenu(); break; } case kMsgToggleToolBar: { fShowToolBar = _ToggleMenuItem(message->what); _SetToolBarVisible(fShowToolBar, true); ShowImageSettings* settings = my_app->Settings(); if (settings->Lock()) { settings->SetBool("ShowToolBar", fShowToolBar); settings->Unlock(); } break; } case kShowToolBarIfEnabled: { bool show; if (message->FindBool("show", &show) != B_OK) break; _SetToolBarVisible(fShowToolBar && show, true); break; } case kMsgSlideToolBar: { float offset; if (message->FindFloat("offset", &offset) == B_OK) { fToolBar->MoveBy(0, offset); fScrollView->ResizeBy(0, -offset); fScrollView->MoveBy(0, offset); UpdateIfNeeded(); snooze(15000); } break; } case kMsgFinishSlidingToolBar: { float offset; bool show; if (message->FindFloat("offset", &offset) == B_OK && message->FindBool("show", &show) == B_OK) { // Compensate rounding errors with the final placement fToolBar->MoveTo(fToolBar->Frame().left, offset); if (!show) fToolBar->Hide(); BRect frame = fToolBar->Parent()->Bounds(); frame.top = fToolBar->Frame().bottom + 1; fScrollView->MoveTo(fScrollView->Frame().left, frame.top); fScrollView->ResizeTo(fScrollView->Bounds().Width(), frame.Height() + 1); } break; } default: BWindow::MessageReceived(message); break; } }
static void endFrame( _VGContext* Context ) { int i; gctUINT32 totalVGCalls = 0; gctUINT32 totalVGDrawCalls = 0; gctUINT32 totalVGStateChangeCalls = 0; gctUINT32 maxrss, ixrss, idrss, isrss; if (Context->profiler.enable) { beginFrame(Context); if (Context->profiler.timeEnable) { #if gcdNEW_PROFILER_FILE gcmWRITE_CONST(VPG_TIME); gcmWRITE_COUNTER(VPC_ELAPSETIME, Context->profiler.frameEndTimeusec - Context->profiler.frameStartTimeusec); gcmWRITE_COUNTER(VPC_CPUTIME, Context->profiler.frameEndCPUTimeusec - Context->profiler.frameStartCPUTimeusec); gcmWRITE_CONST(VPG_END); #else _Print(Context, "<Time>\n"); _Print(Context, "<ElapseTime value=\"%llu\"/>\n", ( Context->profiler.frameEndTimeusec - Context->profiler.frameStartTimeusec )); _Print(Context, "<CPUTime value=\"%llu\"/>\n", Context->profiler.frameEndCPUTimeusec - Context->profiler.frameStartCPUTimeusec); _Print(Context, "</Time>\n"); #endif } if (Context->profiler.memEnable) { #if gcdNEW_PROFILER_FILE gcoOS_GetMemoryUsage(&maxrss, &ixrss, &idrss, &isrss); gcmWRITE_CONST(VPG_MEM); gcmWRITE_COUNTER(VPC_MEMMAXRES, maxrss); gcmWRITE_COUNTER(VPC_MEMSHARED, ixrss); gcmWRITE_COUNTER(VPC_MEMUNSHAREDDATA, idrss); gcmWRITE_COUNTER(VPC_MEMUNSHAREDSTACK, isrss); gcmWRITE_CONST(VPG_END); #else _Print(Context, "<Memory>\n"); gcoOS_GetMemoryUsage(&maxrss, &ixrss, &idrss, &isrss); _Print(Context, "<MemMaxResidentSize value=\"%lu\"/>\n", maxrss); _Print(Context, "<MemSharedSize value=\"%lu\"/>\n", ixrss); _Print(Context, "<MemUnsharedDataSize value=\"%lu\"/>\n", idrss); _Print(Context, "<MemUnsharedStackSize value=\"%lu\"/>\n", isrss); _Print(Context, "</Memory>\n"); #endif } if (Context->profiler.drvEnable) { #if gcdNEW_PROFILER_FILE gcmWRITE_CONST(VPG_VG11); #else _Print(Context, "<VGCounters>\n"); #endif for (i = 0; i < NUM_API_CALLS; ++i) { if (Context->profiler.apiCalls[i] > 0) { #if gcdNEW_PROFILER_FILE gcmWRITE_COUNTER(VPG_VG11 + 1 + i, Context->profiler.apiCalls[i]); #else _Print(Context, "<%s value=\"%d\"/>\n", apiCallString[i], Context->profiler.apiCalls[i]); #endif totalVGCalls += Context->profiler.apiCalls[i]; /* TODO: Correctly place function calls into bins. */ switch(i + APICALLBASE) { case VGDRAWPATH: case VGDRAWIMAGE: case VGDRAWGLYPH: totalVGDrawCalls += Context->profiler.apiCalls[i]; break; case VGFILLMASKLAYER: case VGLOADIDENTITY: case VGLOADMATRIX: case VGMASK: case VGMULTMATRIX: case VGRENDERTOMASK: case VGROTATE: case VGSCALE: case VGSETCOLOR: case VGSETF: case VGSETFV: case VGSETI: case VGSETIV: case VGSETPAINT: case VGSETPARAMETERF: case VGSETPARAMETERFV: case VGSETPARAMETERI: case VGSETPARAMETERIV: case VGSHEAR: case VGTRANSLATE: totalVGStateChangeCalls += Context->profiler.apiCalls[i]; break; default: break; } } /* Clear variables for next frame. */ Context->profiler.apiCalls[i] = 0; } #if gcdNEW_PROFILER_FILE gcmWRITE_COUNTER(VPC_VG11CALLS, totalVGCalls); gcmWRITE_COUNTER(VPC_VG11DRAWCALLS, totalVGDrawCalls); gcmWRITE_COUNTER(VPC_VG11STATECHANGECALLS, totalVGStateChangeCalls); gcmWRITE_COUNTER(VPC_VG11FILLCOUNT, Context->profiler.drawFillCount); gcmWRITE_COUNTER(VPC_VG11STROKECOUNT, Context->profiler.drawStrokeCount); gcmWRITE_CONST(VPG_END); #else PRINT_XML2(totalVGCalls); PRINT_XML2(totalVGDrawCalls); PRINT_XML2(totalVGStateChangeCalls); PRINT_XML(drawFillCount); PRINT_XML(drawStrokeCount); _Print(Context, "</VGCounters>\n"); #endif } gcoPROFILER_EndFrame(Context->hal); #if gcdNEW_PROFILER_FILE gcmWRITE_CONST(VPG_END); #else _Print(Context, "</Frame>\n\n"); #endif gcoPROFILER_Flush(Context->hal); /* Clear variables for next frame. */ Context->profiler.drawFillCount = 0; Context->profiler.drawStrokeCount = 0; if (Context->profiler.timeEnable) { Context->profiler.frameStartCPUTimeusec = Context->profiler.frameEndCPUTimeusec; gcoOS_GetTime(&Context->profiler.frameStartTimeusec); } /* Next frame. */ Context->profiler.frameNumber++; Context->profiler.frameBegun = 0; } }
void CWapDgrmTestStep::_Print(CWapDatagram& aWap) /** * print a WAP datagram to the console */ { TBool IsComplete = EFalse; const TPtrC& ToAddress = aWap.ToAddress(); const TPtrC& FromAddress = aWap.FromAddress(); TInt ToPort = 0; TInt FromPort = 0; TInt Is16BitPorts = 0; TBool IsPorts = ETrue; TSmsDataCodingScheme::TSmsAlphabet Alphabet; IsComplete = aWap.IsComplete(); Alphabet = aWap.Alphabet(); _Print(_L8("CWapDatagram:: IsComplete: FromAddress: ToAddress: Alphabet\n")); _PrintBool(IsComplete); _Print(_L8(": ")); _Print(FromAddress); _Print(_L8(": ")); _Print(ToAddress); _Print(_L8(": ")); _Print(Alphabet); _Print(_L8("\n")); aWap.Ports(FromPort,ToPort,&Is16BitPorts); _Print(_L8("IsPorts: FromPort: ToPort: Is16BitPorts\n")); _PrintBool(IsPorts); _Print(_L8(": ")); _Print(FromPort); _Print(_L8(": ")); _Print(ToPort); _Print(_L8(": ")); _PrintBool(Is16BitPorts); _Print(_L8("\n")); if (aWap.IsComplete()) { // allocate buffer for data HBufC8* DataBuffer = HBufC8::New(aWap.WapDatagramLength()); TPtr8 DataBufferPtr(DataBuffer->Des()); RMBufChain dgramChain; aWap.WapDatagram(dgramChain, aWap.WapDatagramLength()); dgramChain.CopyOut(DataBufferPtr); // Length _Print(DataBuffer->Length()); _Print(_L8(": <")); // Data _Print(*DataBuffer); _Print(_L8(">\n")); delete DataBuffer; } }
/******************************************************************************* ** InitializeVGProfiler ** ** Initialize the profiler for the context provided. ** ** Arguments: ** ** VGContext Context ** Pointer to a new VGContext object. */ void InitializeVGProfiler( _VGContext * Context ) { gceSTATUS status; gctUINT rev; char *env; status = gcoPROFILER_Initialize(Context->hal); if (gcmIS_ERROR(status)) { Context->profiler.enable = gcvFALSE; return; } /* Clear the profiler. */ gcmVERIFY_OK( gcoOS_ZeroMemory(&Context->profiler, gcmSIZEOF(Context->profiler))); gcoOS_GetEnv(Context->os, "VP_COUNTER_FILTER", &env); if ((env == gcvNULL) || (env[0] ==0)) { Context->profiler.drvEnable = Context->profiler.timeEnable = Context->profiler.memEnable = gcvTRUE; } else { gctSIZE_T bitsLen; gcoOS_StrLen(env, &bitsLen); if (bitsLen > 0) { Context->profiler.timeEnable = (env[0] == '1'); } else { Context->profiler.timeEnable = gcvTRUE; } if (bitsLen > 1) { Context->profiler.memEnable = (env[1] == '1'); } else { Context->profiler.memEnable = gcvTRUE; } if (bitsLen > 4) { Context->profiler.drvEnable = (env[4] == '1'); } else { Context->profiler.drvEnable = gcvTRUE; } } Context->profiler.enable = gcvTRUE; #if gcdNEW_PROFILER_FILE { /* Write Generic Info. */ char* infoCompany = "Vivante Corporation"; char* infoVersion = "1.0"; char infoRevision[255] = {'\0'}; /* read from hw */ char* infoRenderer = Context->chipName; char* infoDriver = "OpenVG 1.1"; gctUINT offset = 0; rev = Context->revision; #define BCD(digit) ((rev >> (digit * 4)) & 0xF) gcoOS_MemFill(infoRevision, 0, gcmSIZEOF(infoRevision)); gcoOS_MemFill(infoRevision, 0, gcmSIZEOF(infoRevision)); if (BCD(3) == 0) { /* Old format. */ gcoOS_PrintStrSafe(infoRevision, gcmSIZEOF(infoRevision), &offset, "revision=\"%d.%d\" ", BCD(1), BCD(0)); } else { /* New format. */ gcoOS_PrintStrSafe(infoRevision, gcmSIZEOF(infoRevision), &offset, "revision=\"%d.%d.%d_rc%d\" ", BCD(3), BCD(2), BCD(1), BCD(0)); } gcmWRITE_CONST(VPG_INFO); gcmWRITE_CONST(VPC_INFOCOMPANY); gcmWRITE_STRING(infoCompany); gcmWRITE_CONST(VPC_INFOVERSION); gcmWRITE_STRING(infoVersion); gcmWRITE_CONST(VPC_INFORENDERER); gcmWRITE_STRING(infoRenderer); gcmWRITE_CONST(VPC_INFOREVISION); gcmWRITE_STRING(infoRevision); gcmWRITE_CONST(VPC_INFODRIVER); gcmWRITE_STRING(infoDriver); gcmWRITE_CONST(VPG_END); } #else /* Print generic info */ _Print(Context, "<GenericInfo company=\"Vivante Corporation\" " "version=\"%d.%d\" renderer=\"%s\" ", 1, 0, Context->chipName); rev = Context->revision; #define BCD(digit) ((rev >> (digit * 4)) & 0xF) if (BCD(3) == 0) { /* Old format. */ _Print(Context, "revision=\"%d.%d\" ", BCD(1), BCD(0)); } else { /* New format. */ _Print(Context, "revision=\"%d.%d.%d_rc%d\" ", BCD(3), BCD(2), BCD(1), BCD(0)); } _Print(Context, "driver=\"%s\" />\n", "OpenVG 1.1"); #endif gcoOS_GetTime(&Context->profiler.frameStart); Context->profiler.frameStartTimeusec = Context->profiler.frameStart; Context->profiler.primitiveStartTimeusec = Context->profiler.frameStart; gcoOS_GetCPUTime(&Context->profiler.frameStartCPUTimeusec); }