// ----------------------------------------------------------------------------- // Calculates the decode size and prepares members for scaling. // ----------------------------------------------------------------------------- // TSize CMPXImageUtil::CalculateDecodeSize(const TSize& aSize) { const TFrameInfo& frameInfo = iImageDecoder->FrameInfo(); TSize bitmapSize = frameInfo.iOverallSizeInPixels; TReal sourceAspectRatio( TReal( bitmapSize.iWidth) / bitmapSize.iHeight ); TReal destinationAspectRatio( TReal( aSize.iWidth ) / aSize.iHeight ); TReal xScale = TReal( bitmapSize.iWidth ) / aSize.iWidth; TReal yScale = TReal( bitmapSize.iHeight ) / aSize.iHeight; TReal scale(0.0f); if ( sourceAspectRatio > destinationAspectRatio ) { scale = xScale; iSize.iWidth = aSize.iWidth; iSize.iHeight = Stretch( TReal( bitmapSize.iHeight ) / scale , aSize.iHeight ); } else { scale = yScale; iSize.iWidth = Stretch( TReal( bitmapSize.iWidth ) / scale , aSize.iWidth); iSize.iHeight = aSize.iHeight; } if ((frameInfo.iFlags & TFrameInfo::EFullyScaleable)) { iScaleRquired = EFalse; bitmapSize = iSize; } else //Decoder only supports 2, 4 and 8 scallyng, the image will need //to be reescaled after decoding. //Decoding to a scale that is just a bit bigger thant the target, //this will save memory and resources and we will get a sharp image //after scaling. { TInt intscale = ( scale >= 8 ) ? 8 : ( scale >= 4 ) ? 4 : ( scale >= 2 ) ? 2 : 1; TUint xCorrection = ( bitmapSize.iWidth % intscale ) ? 1 : 0; TUint yCorrection = ( bitmapSize.iHeight % intscale ) ? 1 : 0; bitmapSize.iWidth /= intscale; bitmapSize.iHeight /= intscale; bitmapSize += TSize( xCorrection, yCorrection ); iScaleRquired = ETrue; } return bitmapSize; }
/** @SYMTestCaseID SYSLIB-DBMS-CT-0637 @SYMTestCaseDesc Streaming conversions test @SYMTestPriority Medium @SYMTestActions Test the database definition and enquiry functions @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void Test() { test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0637 Build without transactions ")); CreateDatabaseL(); TUint time1,size1; BuildTable(KRecords,EFalse,time1,size1); CloseDatabaseL(); test.Next(_L("Build with transactions")); CreateDatabaseL(); TUint time2,size2; BuildTable(KRecords,ETrue,time2,size2); test.Printf(_L("Transaction performance: time %4.2f, size %4.2f\n"),TReal(time1)/TReal(time2),TReal(size1)/TReal(size2)); test.Next(_L("Build Int index")); Execute(_L("create unique index int on table (int)")); test.Next(_L("Break index")); BreakIndex(); test.Next(_L("Build Text index")); Execute(_L("create unique index text on table (text)")); test.Next(_L("Recover")); test (TheDatabase.IsDamaged()); CloseDatabaseL(); OpenDatabase(); test (TheDatabase.IsDamaged()); Recover(); test.Next(_L("Drop table")); Execute(_L("drop table table")); CloseDatabaseL(); }
TReal CBenchMarker::EndAverageProfile() { CCntTest::ProfileEnd(1); if (iNumAverageProfiles>0) { return TReal((iAverageProfileCounter/iNumAverageProfiles)/1000000.0); } return TReal(0.0); }
void CBuddycloudListComponent::HandlePointerEventL(const TPointerEvent &aPointerEvent) { CCoeControl::HandlePointerEventL(aPointerEvent); if(aPointerEvent.iType == TPointerEvent::EButton1Up) { if(iDraggingAllowed) { if(Abs(iDragVelocity) > 5.0) { TimerExpired(KDragTimerId); } } else { for(TInt i = 0; i < iListItems.Count(); i++) { if(iListItems[i].iRect.Contains(aPointerEvent.iPosition)) { // Provide feedback iTouchFeedback->InstantFeedback(ETouchFeedbackBasic); HandleItemSelection(iListItems[i].iId); break; } } } } else if(aPointerEvent.iType == TPointerEvent::EButton1Down) { iDragTimer->Stop(); iDragVelocity = 0.0; iDraggingAllowed = false; iStartDragPosition = aPointerEvent.iPosition.iY; iStartDragHandlePosition = iScrollbarHandlePosition; iLastDragTime.UniversalTime(); iLastDragPosition = iStartDragPosition; } else if(aPointerEvent.iType == TPointerEvent::EDrag) { if(!iDraggingAllowed && (aPointerEvent.iPosition.iY + 32 < iStartDragPosition || aPointerEvent.iPosition.iY - 32 > iStartDragPosition)) { iDraggingAllowed = true; iSnapToItem = false; } if(iDraggingAllowed) { TTime aNow; aNow.UniversalTime(); iDragVelocity = TReal(TReal(iLastDragPosition - aPointerEvent.iPosition.iY) * (1000000.0 / TReal(aNow.MicroSecondsFrom(iLastDragTime).Int64()))) / 20.0; iLastDragTime.UniversalTime(); iLastDragPosition = aPointerEvent.iPosition.iY; iScrollbarHandlePosition = iStartDragHandlePosition + (iStartDragPosition - aPointerEvent.iPosition.iY); CBuddycloudListComponent::RepositionItems(false); RenderScreen(); } } }
EXPORT_C TReal Math::Poly(TReal aX,const SPoly *aPoly) /** Evaluates the polynomial: {a[n]X^n + a[n-1]X^(n-1) + ... + a[2]X^2 + a[1]X^1 + a[0]}. @param aX The value of the x-variable @param aPoly A pointer to the structure containing the set of coefficients in the order: a[0], a[1], ..., a[n-1], a[n]. @return The result of the evaluation. */ // // Evaluate a power series in x for a P_POLY coefficient table. // Changed to use TRealX throughout the calculation // { const TReal *pR=(&aPoly->c[aPoly->num-1]); TRealX r(*pR); TRealX x(aX); while (pR>&aPoly->c[0]) { r*=x; r+=*--pR; } return(TReal(r)); }
TReal CBenchMarker::EndProfile() { CCntTest::ProfileEnd(0); TCntProfile profile[1]; CCntTest::ProfileResult(profile,0,1); return TReal(profile[0].iTime/1000000.0); }
virtual void reset() override { IAxisController::reset(); pid_->reset(); output_ = TReal(); }
EXPORT_C void CHuiCanvasGc::DoDrawPoints(RArray<THuiRealPoint>& aPoints) { for(TInt i=0; i< aPoints.Count(); i++) { TInt TlOffset = TInt(iPenWidth/2); TInt BrOffset = TInt(TReal(iPenWidth)/2.f + 0.5f); TPoint Tl = TPoint(aPoints[i].iX - TlOffset, aPoints[i].iY - TlOffset); TPoint Br = TPoint(aPoints[i].iX + BrOffset, aPoints[i].iY + BrOffset); iGc->DrawRect(TRect(Tl, Br)); } }
void CSecMgrStore::StorePolicyL(const CPolicy& aPolicy) { __UHEAP_MARK; HBufC *policyFile = HBufC::NewLC(KMaxName); TPtr ptr(policyFile->Des()); GetPolicyFile (ptr, aPolicy.PolicyID ()); CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession, ptr, EFileWrite); store->SetTypeL (KPermanentFileStoreLayoutUid); // Construct the output stream. RStoreWriteStream outstream; TStreamId id = outstream.CreateLC (*store); //Write version of the policy outstream.WriteReal32L (TReal(DEFAULT_VERSION)); TInt aliasCnt(aPolicy.AliasGroup().Count()); outstream.WriteInt32L (aliasCnt); RAliasGroup aliasGroups = aPolicy.AliasGroup(); for (TInt i(0); i!=aliasCnt;++i) { CPermission* alias = aliasGroups[i]; alias->ExternalizeL (outstream); } TInt domainCnt(aPolicy.ProtectionDomain().Count ()); outstream.WriteInt32L (domainCnt); RProtectionDomains domains = aPolicy.ProtectionDomain (); for (TInt i(0); i!=domainCnt;++i) { CProtectionDomain* domain = domains[i]; domain->ExternalizeL (outstream); } // Commit changes to the stream outstream.CommitL (); CleanupStack::PopAndDestroy (&outstream); // Set this stream id as the root store->SetRootL (id); // Commit changes to the store store->CommitL (); CleanupStack::PopAndDestroy (store); CleanupStack::PopAndDestroy (policyFile); __UHEAP_MARKEND; }
// Sets the new values and checks the boundaries TInt CDirectPrintFloatCapability::SetValues( TInt aDenom, TInt aNumerator, TInt aMaxNumerator ) { TInt err( KErrNone ); if ( aNumerator > aMaxNumerator ) { err = KErrArgument; } else { iDenominator = aDenom; iValue = aNumerator; iMaxNumerator = aMaxNumerator; if( iDenominator != 0 ) { iRealValue = TReal( iValue )/TReal( iDenominator ); } } return err; }
void DegAndMinutesToGeo(const TDesC& aMin, TDes& aInto, TInt aSign) { aInto.Zero(); if (aMin.Compare(_L("0000.0000"))==0 || aMin.Compare(_L("00000.0000"))==0 || aMin.Length()<3) { return; } TInt decpos=aMin.Locate('.'); if (decpos==KErrNotFound || decpos<3) return; TReal deg, min; { TLex lex(aMin.Left(decpos-2)); if (lex.Val(deg)!=KErrNone) { return; } } { TLex lex(aMin.Mid(decpos-2)); if (lex.Val(min)!=KErrNone) { return; } if (deg==TReal(0) && min==TReal(0)) return; min/=TReal(60); } deg+=min; if (deg > TReal(180)) return; deg*=aSign; TRealFormat fmt; fmt.iTriLen=0; fmt.iPoint='.'; fmt.iPlaces=8; fmt.iType=KRealFormatCalculator; aInto.Num(deg, fmt); }
CFont* CMainMenuListContainer::FindLargestPossibleFontL(const TDesC& aTextToFit, TInt aMaxWidthInPixels, enum TAknLogicalFontId aPreferredLogicalFontId) const { TInt fontMinimizerFactorInPixels = 2; // Get the screen device so that we can calc the twips // per pixel TPixelsTwipsAndRotation twips; CWsScreenDevice* screenDev = CEikonEnv::Static()->ScreenDevice(); screenDev->GetScreenModeSizeAndRotation(screenDev->CurrentScreenMode(), twips); // Calc the twips per pixel TReal twipsPerPixel = twips.iTwipsSize.iHeight / TReal(twips.iPixelSize.iHeight); // Get the preferred logical font from the font store const CFont* preferredFont = AknLayoutUtils:: FontFromId(aPreferredLogicalFontId); TFontSpec fontSpec = preferredFont->FontSpecInTwips(); // Get the font that matches the fontspec the best CFont* fontToUse; screenDev-> GetNearestFontToDesignHeightInTwips(fontToUse, fontSpec); TInt fontMinimizerFactorInTwips = TInt(fontMinimizerFactorInPixels * twipsPerPixel); while (aMaxWidthInPixels < fontToUse->TextWidthInPixels(aTextToFit)) { // The text didnt fit within the given space, make the font // a bit smaller and try again screenDev->ReleaseFont(fontToUse); fontSpec.iHeight -= fontMinimizerFactorInTwips; screenDev-> GetNearestFontToDesignHeightInTwips(fontToUse, fontSpec); } // Return the font, the caller has to release the font // from the CWsScreenDevice return fontToUse; }
void CEmTubePlaylistEntry::ExportL( RFileWriteStream& aStream ) { TInt l = iLocation->Length(); aStream.WriteInt32L( l ); if( l ) { aStream.WriteL( *iLocation ); } l = iName->Length(); aStream.WriteInt32L( l ); if( l ) { aStream.WriteL( *iName ); } aStream.WriteInt32L( iPlayCount ); aStream.WriteInt32L( (TInt)iType ); aStream.WriteReal64L( TReal(iTime.Int64()) ); }
// ----------------------------------------------------------------------------- // CCMRAACCodecData::GetFrameDurationUs // Return frame duration in microseconds // (other items were commented in a header). // ----------------------------------------------------------------------------- // TReal CCMRAACCodecData::GetFrameDurationUs() const { return (TReal(1000)*1024/iSampleRate)*1000; }
static void DoTestFileReadCPU(TInt aBlockSize) // // Benchmark CPU utilisation for Read method // // Read operations are performed for 10 seconds whilst a second thread executes floating point calculations // The higher the number of calculations the less amount of CPU time has been used by the Read method. // { enum {EFileReadBuffered = 0x00002000, EFileReadDirectIO = 0x00004000}; TInt r = File.Open(TheFs, _L("READCPUTEST"), EFileStream | (gReadCachingOn ? EFileReadBuffered : EFileReadDirectIO)); test_KErrNone(r); TInt pos = 0; TUint functionCalls = 0; TUint fltPntCalls = 0; RThread fltPntThrd; TBuf<6> buf = _L("Floaty"); fltPntThrd.Create(buf, FloatingPointLoop, KDefaultStackSize, KHeapSize, KHeapSize, (TAny*) &fltPntCalls); RTimer timer; timer.CreateLocal(); TRequestStatus reqStat; TUint initTicks = 0; TUint finalTicks = 0; timer.After(reqStat, KFloatingPointTestTime); // After 10 secs initTicks = User::FastCounter(); // up the priority of this thread so that we only run the floating point thread when this thread is idle RThread thisThread; thisThread.SetPriority(EPriorityMuchMore); TRequestStatus req; fltPntThrd.Logon(req); fltPntThrd.Resume(); for (TInt i = 0; reqStat==KRequestPending; i++) { TInt r = File.Read(pos, DataBuf, aBlockSize); test_KErrNone(r); pos += aBlockSize; if (pos > KMaxFileSize-aBlockSize) pos = 0; functionCalls++; } TUint fltPntCallsFinal = fltPntCalls; fltPntThrd.Kill(KErrNone); finalTicks = User::FastCounter(); fltPntThrd.Close(); User::WaitForRequest(req); TInt dataTransferred = functionCalls * aBlockSize; TTimeIntervalMicroSeconds duration = TInt64(finalTicks - initTicks) * TInt64(1000000) / TInt64(gFastCounterFreq) ; TReal transferRate = TReal32(dataTransferred) / TReal(duration.Int64()) * TReal(1000000) / TReal(K1K); // KB/s test.Printf(_L("Read %7d bytes in %7d byte blocks:\t%11.3f KBytes/s; %d Flt Calcs\n"), dataTransferred, aBlockSize, transferRate, fltPntCallsFinal); timer.Close(); File.Close(); return; }
void CTDirectScreenBitmap::ExhaustiveTestMergePerDispModeL(TDisplayMode aDrawDeviceDispMode, TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul, TInt aStepSize,TInt aChannelControl,TInt aOtherChannels, TDisplayMode aTestMode) { CFbsDrawDevice *pDev = NULL; iDispMode = aDrawDeviceDispMode; TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0,aDrawDeviceDispMode)); if (err !=KErrNone) { INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode); } else { INFO_PRINTF2(_L("Test Exhaustive Merge for display mode %i "),iDispMode); User::LeaveIfError(pDev->InitScreen()); pDev->SetAutoUpdate(ETrue); TSize screenSize = pDev->SizeInPixels(); //Full screen non-incremental run TRect directRect(TPoint(0, 0), screenSize); INFO_PRINTF1(_L("PDEF099416: Test of pixel merge over full colour and alpha range")); TRAPD(err, ConstructL(directRect, CDirectScreenBitmap::ENone)); if (err) { delete pDev; INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created")); } else { if (!iInterface->ScreenClear()) { INFO_PRINTF1(_L("The display mode of the iBitmapInfo is not expected")); delete pDev; return; } else { TSize bitmapSize(256,1); TUint32 bitmapMem[256]; TUint32 srcLine[256]; CFbsDrawDevice* bmd = CFbsDrawDevice::NewBitmapDeviceL(bitmapSize, aTestMode, CFbsBitmap::ScanLineLength(256, aTestMode)); CleanupStack::PushL(bmd); //initialize bmd->SetAutoUpdate(EFalse); bmd->SetBits(bitmapMem); //Eveything printed to the screen is just to show the error levels graphically. //Patterns are very interesting sometimes if (screenSize.iHeight>200 && screenSize.iWidth>600) { iInterface->BeginDraw(); iInterface->DrawColor(TRect(260,0,290,30),TRgb(255,0,0)); iInterface->DrawColor(TRect(260,30,290,60),TRgb(100,0,0)); iInterface->DrawColor(TRect(260,60,290,90),TRgb(100,0,0)); iInterface->DrawColor(TRect(260,100,290,130),TRgb(0,255,0)); iInterface->DrawColor(TRect(260,130,290,160),TRgb(0,200,0)); iInterface->DrawColor(TRect(260,160,290,190),TRgb(0,100,0)); iInterface->DrawColor(TRect(560,100,590,130),TRgb(0,0,255)); iInterface->DrawColor(TRect(560,130,590,160),TRgb(0,0,200)); iInterface->DrawColor(TRect(560,160,590,190),TRgb(0,0,100)); iInterface->EndDraw(iRequestStatus); } //const TInt channelMask; if (aChannelControl<1) { channelMask=0x0000FF; } else { if(aChannelControl==1) { channelMask=0x00FF00; } else { channelMask=0xFF0000; } } const TInt otherMask=0xFFFFFF^channelMask; const TInt channelMul=channelMask&0x01010101; const TInt addFactor=aOtherChannels & otherMask; //Use to set the other colour channels with a fixed test value TInt passFlag=0; INFO_PRINTF3(_L("AddFactor pass: channel %i others %x "),aChannelControl,addFactor); passFlag=passFlag^0x8000; const TReal KIgnore=0.00000001;//0.3; const TReal KGross=1.51; const TReal KMultiplyErrorBrightness=200.0; TReal errMax=20; TReal errAMax256=0; TReal totErrCol=0; TReal totErrAlpha=0; TReal zeroErrCol=0; TReal zeroErrAlpha=0; TInt countAlphas=0; TInt countColours=0; const TInt stepFactor=aStepSize; //1, 3, 5, 15, 17; //This has a ^3 effect on speed TIgnoreSpecialCases ignoreSpecialCases(aInSrcPreMul,aInDestPreMul,aOutDestPreMul); //bkgrdMask is background mask/alpha input value for (TInt bkgrdMask=0;bkgrdMask<256;bkgrdMask+=stepFactor) { TInt logLine=-1; iInterface->BeginDraw(); iInterface->DrawColour64KPixel(270+bkgrdMask/screenSize.iHeight,bkgrdMask%screenSize.iHeight, TRgb(addFactor|passFlag)); TInt maxChannels=256; if (aInDestPreMul) { maxChannels=bkgrdMask+1; } TInt clippedother=((addFactor-((bkgrdMask*0x010101)&otherMask))>>8)&otherMask; //clippedother is now 0x00FF00FF or 0x00000000 (or 0x00FF0000 or 0x000000FF) clippedother=(addFactor&(clippedother^otherMask))|(((bkgrdMask*0x010101)&clippedother)); //bkgrdChannel is background channel input value. In PM it is 0...bkgrdMask. In NP it is 0...255 for (TInt bkgrdChannel=0,colour=(bkgrdMask<<24)|clippedother,stepChannel=stepFactor*channelMul;bkgrdChannel<maxChannels;bkgrdChannel+=stepFactor,colour+=stepChannel) { TInt failsPerPass=10; logLine++; if (logLine>=screenSize.iHeight) { logLine=0; } //srcMask is the source mask/alpha for (TInt srcMask=0;srcMask<256;srcMask+=stepFactor) //0 and 255 are special cases, but need testing anyway! { TInt maxChannels=256; //nested if (aInSrcPreMul) { maxChannels=srcMask+1; //In PM-PM source colour passes through unchanged, so skip the tests } bmd->WriteRgbMulti(0,0,maxChannels,1,TRgb(colour,bkgrdMask),CGraphicsContext::EDrawModeWriteAlpha); TInt clippedother=((addFactor-((srcMask*0x010101)&otherMask))>>8)&otherMask; //clippedother is now 0x00FF00FF or 0x00000000 (or 0x00FF0000 or 0x000000FF) clippedother=(addFactor&(clippedother^otherMask))|(((srcMask*0x010101)&clippedother)); //srcChannel1 is the source channel input value. In PM it is 0...srcMask. In NP it is 0...255 for (TInt srcChannel1=0,C=(srcMask<<24)+clippedother;srcChannel1<maxChannels;srcChannel1++,C+=channelMul) { srcLine[srcChannel1]=C; } bmd->WriteLine(0,0,maxChannels,srcLine,CGraphicsContext::EDrawModePEN); TReal errPos=0; TReal errNeg=0; TReal errGross=0; TReal errAPos=0; TReal errANeg=0; TReal errAGross=0; //source multiplier factor for alpha that can then be used to optimise non-multiplied input calculations. TReal srcMultiplier=srcMask/255.0; //destination/background multiplier factor for alpha that can then be used to optimise non-multiplied input calculations. TReal destMultiplier=(bkgrdMask/255.0)*(1.0-srcMultiplier); //alphaPixelValue is the alpha pixel value as generated from the library code under test TUint alphaPixelValue=bmd->ReadPixel(0,0).Alpha(); //alphaDiff is the difference in alpha between pixel and float calcuation, i.e. the error. This can be less than 1 level of brightness, i.e. insignificant. TReal alphaDiff=0.0; //pre-mul mode does not effect the alpha calculation //alphaOutputValue is a floating-point calculation of the alpha output value using 255.0 as the scaling factor. TReal alphaOutputValue=(srcMultiplier+destMultiplier)*255.0; alphaDiff=alphaOutputValue-alphaPixelValue; zeroErrAlpha+=alphaDiff; if (alphaDiff>KIgnore || alphaDiff<-KIgnore) { if (alphaDiff>0) { if (alphaDiff>KGross) { if (--failsPerPass>0) LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,alphaOutputValue,alphaPixelValue,alphaDiff,_L("Big Alpha error: expected %f, got %f"),ETrue); errAGross+=(alphaDiff-KIgnore)*KMultiplyErrorBrightness; } else { errAPos+=(alphaDiff-KIgnore)*KMultiplyErrorBrightness; } totErrAlpha+=alphaDiff; } else { if(alphaDiff<-KGross) { if (--failsPerPass>0) LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,alphaOutputValue,alphaPixelValue,alphaDiff,_L("Big Alpha error: expected %f, got %f"),ETrue); errAGross-=(alphaDiff+KIgnore)*KMultiplyErrorBrightness; } else { errANeg-=(alphaDiff+KIgnore)*KMultiplyErrorBrightness; } totErrAlpha-=alphaDiff; } } TInt errA= STATIC_CAST(TInt,(errAPos-errANeg)); countAlphas++; countColours+=maxChannels; //The other channel values should not change while the tested channel is modulated... //So I grab it's value for the zero case to compare. TUint otherChannels0=bmd->ReadPixel(0,0).Color16MA()&(otherMask|0xff000000); //srcChannel is the source channel input value. In PM it is 0...srcMask. In NP it is 0...255 for (TInt srcChannel=0;srcChannel<maxChannels;srcChannel++) { //channelOutputValue is a floating-point calculation of the channel output value using 255.0 as the scaling factor. TReal channelOutputValue; if (aInSrcPreMul) { channelOutputValue=srcChannel; } else { channelOutputValue=srcChannel*srcMultiplier; } if (aInDestPreMul) { channelOutputValue+=bkgrdChannel*(1.0-srcMultiplier); } else { channelOutputValue+=bkgrdChannel*destMultiplier; } if (!aOutDestPreMul) { if ((srcMultiplier+destMultiplier)!=0) { channelOutputValue=channelOutputValue/(srcMultiplier+destMultiplier); } } TUint readPixel=bmd->ReadPixel(srcChannel,0).Color16MA(); //channelPixelValue is the channel pixel value as generated from the library code under test TUint channelPixelValue=(readPixel&channelMask)/channelMul; if (aOutDestPreMul) { if (channelPixelValue>alphaPixelValue) { if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)) { if (--failsPerPass>0) { LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,alphaPixelValue,channelOutputValue,channelPixelValue,_L("Output multiplied colour exceeds alpha %f: expected %f got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)); } } errGross+=10; //output value out of range - bright red spot! } } TUint otherChannels=readPixel&(otherMask|0xff000000); if (otherChannels!=otherChannels0) { //Other channels should all be constant here! LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,otherChannels0,otherChannels,0,_L("Output for other channels changed when modulating test channel only - Inter-channel leakage? srcChannel=0 value = %f, this value = %f"),ETrue); } //channelDiff is the difference in channel between pixel and float calcuation, i.e. the error. This can be less than 1 level of brightness, i.e. insignificant. TReal channelDiff=channelOutputValue-channelPixelValue; zeroErrCol+=channelDiff; if (channelDiff>KIgnore || channelDiff<-KIgnore) if (channelDiff>0) { if (channelDiff>KGross) { if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)) { if (--failsPerPass>0) { LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,channelOutputValue,channelPixelValue,channelDiff,_L("Big Colour error: expected %f, got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)); } } errGross+=channelDiff-KIgnore; } else { errPos+=channelDiff-KIgnore; } totErrCol+=channelDiff; } else { if (channelDiff<-KGross) { if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)) { if (--failsPerPass>0) { LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,channelOutputValue,channelPixelValue,channelDiff,_L("Big Colour error: expected %f, got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel)); } } errGross-=channelDiff+KIgnore; } else { errNeg-=channelDiff+KIgnore; } totErrCol-=channelDiff; } } TReal err=errPos-errNeg; errGross+=errAGross; if (errA>errAMax256) { //LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,errA,0,0,_L("Row alpha error level increase, now: %f"),EFalse); errAMax256=errA; } errPos=Min(TReal(255),(errPos*KMultiplyErrorBrightness/TReal(maxChannels))); errNeg=Min(TReal(255),(errNeg*KMultiplyErrorBrightness/TReal(maxChannels))); TReal err256=Min(TReal(255),err*KMultiplyErrorBrightness/TReal(maxChannels)); if (err256>errMax) { //LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,err256,err,0,_L("Row colour error level increase, per call now: %f value for row: %f"),EFalse); errMax=err256; } errAPos=Min(TReal(255),(errAPos)); errANeg=Min(TReal(255),(errANeg)); errA=Min(255,errA); if (errGross>10) { errGross=TReal(255); } else { errGross*=TReal(20); } TRect pix(TPoint(),TSize(1,1)); if (screenSize.iWidth>260) { iInterface->DrawColour64KPixel(srcMask,logLine, TRgb(STATIC_CAST(TInt,errGross),STATIC_CAST(TInt,errNeg),STATIC_CAST(TInt,errPos))); } if (screenSize.iWidth>360) { iInterface->DrawColour64KPixel(srcMask+300,logLine, TRgb(STATIC_CAST(TInt,errGross),STATIC_CAST(TInt,errNeg),STATIC_CAST(TInt,errPos))); } } if (failsPerPass<0) { //note that this count may be out by 1... INFO_PRINTF2(_L("Additional %i errors not reported in this pass."),-failsPerPass); } } iInterface->EndDraw(iRequestStatus); } if (ignoreSpecialCases.IgnoreCount() && ignoreSpecialCases.IgnoreCount()<ignoreSpecialCases.ExpectedIgnoreCount(aStepSize)) { TEST(ignoreSpecialCases.IgnoreCount()<ignoreSpecialCases.ExpectedIgnoreCount(aStepSize)); INFO_PRINTF3(_L("There were less ignored special-case errors than exepected (but more than zero): Expected: 0 or %i, got %i"), ignoreSpecialCases.ExpectedIgnoreCount(aStepSize),ignoreSpecialCases.IgnoreCount() ); } INFO_PRINTF4(_L("Highest error rows (normalised @%f per row): Alpha: %f, Colour: %f "),KMultiplyErrorBrightness,errMax,errAMax256); INFO_PRINTF4(_L("Alpha: Samples: %i, total abs= %f, total signed=%f (should be 0)"),countAlphas,totErrAlpha,zeroErrAlpha); INFO_PRINTF4(_L("Colour: Samples: %i, total abs= %f, total signed=%f (should be 0)"),countColours,totErrCol,zeroErrCol); CleanupStack::PopAndDestroy(bmd); delete pDev; } } } }
static bool isInTolerance(TReal val, TReal tolerance, TReal center = TReal()) { return val <= center + tolerance && val >= center - tolerance; }
static void DoTestFileRead(TInt aBlockSize, TInt aFileSize = KMaxFileSize, TBool aReRead = EFalse) // // Do Read Test // { // Create test data // test.Printf(_L("Creating test file...")); TInt writeBlockLen = aFileSize > DataBuf.MaxSize() ? DataBuf.MaxSize() : aFileSize; DataBuf.SetLength(writeBlockLen); #if defined(_DEBUG) for (TInt m = 0; m < DataBuf.Length(); m++) DataBuf[m] = TText8(m % 256); #endif // To allow this test to run on a non-preq914 branch : enum {EFileWriteDirectIO = 0x00001000}; TInt r = File.Create(TheFs, _L("READTEST"), EFileStream | EFileWriteDirectIO); test_KErrNone(r); TInt count = aFileSize / DataBuf.Length(); while (count--) File.Write(DataBuf); // test.Printf(_L("done\n")); File.Close(); enum {EFileReadBuffered = 0x00002000, EFileReadDirectIO = 0x00004000}; r = File.Open(TheFs, _L("READTEST"), EFileStream | (gReadCachingOn ? EFileReadBuffered : EFileReadDirectIO)); test_KErrNone(r); // const TInt maxReadCount = aFileSize / aBlockSize; TUint functionCalls = 0; #if defined SYMBIAN_TEST_COPY // To allow this test to run on a non-preq914 branch : enum {EFileWriteDirectIO = 0x00001000}; TInt r = File2.Replace(TheFs, _L("WRITETEST"), EFileStream | EFileWriteDirectIO); test_KErrNone(r); #endif TTime startTime(0); TTime endTime(0); // we stop after the entire file has been read or after 10 seconds, whichever happens sooner RTimer timer; timer.CreateLocal(); TRequestStatus reqStat; TUint initTicks = 0; TUint finalTicks = 0; // if aReRead file is set, then read file twice for (TInt n=0; n<(aReRead?2:1); n++) { functionCalls = 0; const TInt readLen = (aReRead && n == 0) ? writeBlockLen : aBlockSize; const TInt maxReadCount = aFileSize / readLen; TInt pos = 0; File.Seek(ESeekStart, pos); timer.After(reqStat, 10000000); // After 10 secs startTime.HomeTime(); initTicks = User::FastCounter(); for (TInt i = 0; i<maxReadCount && reqStat==KRequestPending; i++) { // test.Printf(_L("Read %d\n"),i); // for (TInt a = 0; a < 512; a++) // test.Printf(_L("%d"),DataBuf[a]); TInt r = File.Read(DataBuf, readLen); test_KErrNone(r); if (DataBuf.Length() == 0) break; #if defined SYMBIAN_TEST_COPY r = File2.Write(DataBuf, readLen); test_KErrNone(r); #endif functionCalls++; #if defined(_DEBUG) // for (TInt a = 0; a < 512; a++) // test.Printf(_L("%d"),DataBuf[a]); for (TInt j = 0; j < DataBuf.Size(); j++) test(DataBuf[j] == (j + i * readLen) % 256); #endif } finalTicks = User::FastCounter(); endTime.HomeTime(); timer.Cancel(); } TInt dataTransferred = functionCalls * aBlockSize; // TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); TTimeIntervalMicroSeconds duration = TInt64(finalTicks - initTicks) * TInt64(1000000) / TInt64(gFastCounterFreq) ; TReal transferRate = TReal32(dataTransferred) / TReal(duration.Int64()) * TReal(1000000) / TReal(K1K); // KB/s test.Printf(_L("Read %7d bytes in %7d byte blocks:\t%11.3f KBytes/s (%d microsecs)\n"), dataTransferred, aBlockSize, transferRate, endTime.MicroSecondsFrom(startTime).Int64()); timer.Close(); #if defined SYMBIAN_TEST_COPY File2.Close(); #endif File.Close(); r = TheFs.Delete(_L("READTEST")); test_KErrNone(r); return; }
void CBtmcSignal::ConvertToHFPScale(TInt8 &aSignal) { TReal result; Math::Round( result, TReal(TReal(KMaxHFPSignal)/TReal(KMaxPhoneSignal) *TReal(aSignal)),0); aSignal = TInt8(result); }
static void DoTestFileWriteCPU(TInt aBlockSize) // // Benchmark CPU utilisation for Write method // // Write operations are performed for 10 seconds whilst a second thread executes floating point calculations // The higher the number of calculations the less amount of CPU time has been used by the Write method. // { DataBuf.SetLength(aBlockSize); TFileName testDir(_L("?:\\F32-TST\\")); testDir[0] = (TText) gDriveToTest; TInt r = TheFs.MkDir(testDir); test_Value(r, r == KErrNone || r == KErrAlreadyExists); TFileName fileName; r = File.Temp(TheFs, testDir, fileName, EFileWrite | (gFileSequentialModeOn ? EFileSequential : 0) | (gWriteCachingOn ? EFileWriteBuffered : EFileWriteDirectIO)); test_KErrNone(r); TUint functionCalls = 0; TUint fltPntCalls = 0; RThread fltPntThrd; TBuf<6> buf = _L("Floaty"); fltPntThrd.Create(buf, FloatingPointLoop, KDefaultStackSize, KHeapSize, KHeapSize, (TAny*) &fltPntCalls); TUint initTicks = 0; TUint finalTicks = 0; // up the priority of this thread so that we only run the floating point thread when this thread is idle RThread thisThread; thisThread.SetPriority(EPriorityMuchMore); TRequestStatus req; fltPntThrd.Logon(req); RTimer timer; timer.CreateLocal(); TRequestStatus reqStat; TInt pos = 0; File.Seek(ESeekStart, pos); timer.After(reqStat, KFloatingPointTestTime); initTicks = User::FastCounter(); fltPntThrd.Resume(); for (TInt i = 0 ; reqStat==KRequestPending; i++) { File.Write(DataBuf, aBlockSize); functionCalls++; } TUint fltPntCallsFinal = fltPntCalls; fltPntThrd.Kill(KErrNone); finalTicks = User::FastCounter(); fltPntThrd.Close(); User::WaitForRequest(req); TTimeIntervalMicroSeconds duration = TInt64(finalTicks - initTicks) * TInt64(1000000) / TInt64(gFastCounterFreq) ; TInt dataTransferred = functionCalls * aBlockSize; TReal transferRate = TReal32(dataTransferred) / TReal(duration.Int64()) * TReal(1000000) / TReal(K1K); // KB/s test.Printf(_L("Write %7d bytes in %7d byte blocks:\t%11.3f KBytes/s; %d Flt Calcs\n"), dataTransferred, aBlockSize, transferRate, fltPntCallsFinal); timer.Close(); File.Close(); r = TheFs.Delete(fileName); test_KErrNone(r) return; }
// --------------------------------------------------------------------------- // Computation of the viewport to viewbox transformation matrix // --------------------------------------------------------------------------- void CNvgFitToViewBoxImpl::SetWindowViewportTrans(TRect aViewPort, TSize aSize) { //VIEWPORT NUMBERS TReal lViewPortX = aViewPort.iTl.iX; TReal lViewPortY = aViewPort.iTl.iY; TReal lViewPortWidth = aViewPort.Width(); TReal lViewPortHeight = aViewPort.Height(); vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); vgTranslate(lViewPortX, lViewPortY ); /* 2. Scale */ TReal lViewBoxXmin; TReal lViewBoxYmin; TReal lViewBoxWidth; TReal lViewBoxHeight; if ( iViewBoxDefined ) { lViewBoxXmin = ivbX; lViewBoxYmin = ivbY; lViewBoxWidth = ivbW; lViewBoxHeight = ivbH; } else { //this will default viewBox to <svg> element width and height lViewBoxXmin = 0; lViewBoxYmin = 0; lViewBoxWidth = aSize.iWidth; lViewBoxHeight = aSize.iHeight; } if ( lViewBoxWidth == 0.0f || lViewBoxHeight == 0.0f ) { return; } TReal sx = lViewPortWidth / lViewBoxWidth; TReal sy = lViewPortHeight / lViewBoxHeight; if ( sx == 0.0f || sy == 0.0f ) { return; } TReal xtrans = TReal( -1.0f ) * lViewBoxXmin; TReal ytrans = TReal( -1.0f ) * lViewBoxYmin; switch ( iAlign ) { case ENvgPreserveAspectRatio_None: /* Non uniform scaling */ //none - Do not force uniform scaling. //Scale the graphic content of the given element //non-uniformly if necessary such that the element's //bounding box exactly matches the viewport rectangle. //(Note: if <align> is none, then the optional <meetOrSlice> value is ignored.) break; case ENvgPreserveAspectRatio_XminYmin: //Align the <min-x> of the element's viewBox with the smallest X value of the viewport. //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; //no change for xtrans...default above } else // ( sx < sy ) { sy = sx; //no change for ytrans...default above } } else if (iMeetSlice == ENvgSlice) { if (sx > sy) { sy = sx; } else // ( sx < sy ) { sx = sy; } } break; case ENvgPreserveAspectRatio_XmidYmin: //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport. //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport. //Align the <min-x> of the element's viewBox with the smallest X value of the viewport. //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = ( ( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) )\ * 0.5 ) / sx - lViewBoxXmin; } else // ( sx < sy ) { sy = sx; //no change for ytrans...default above } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; } else //( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx; xtrans = xtrans/2.0 - lViewBoxXmin; } } break; case ENvgPreserveAspectRatio_XmaxYmin: //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport. //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = (( lViewPortWidth - ( ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx\ - lViewBoxXmin; } else // ( sx < sy ) { sy = sx; //no change for ytrans...default above } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; //no change for ytrans...default above } else // ( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx - lViewBoxXmin; } } break; case ENvgPreserveAspectRatio_XminYmid: //Align the <min-x> of the element's viewBox with the smallest X value of the viewport. //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; //no change for xtrans...default above } else // ( sx < sy ) { sy = sx; ytrans = ( ( TReal ) ( lViewPortHeight - ( ( TReal ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) )\ * TReal(.5) ) /sy - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx; ytrans = ytrans/2.0 - lViewBoxYmin; } else { sx = sy; } } break; case ENvgPreserveAspectRatio_XmidYmid: //(default) case //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport. //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) * \ 0.5 ) / sx - lViewBoxXmin; } else if ( sx < sy ) { sy = sx; ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) * \ 0.5 ) /sy - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx; ytrans = ytrans/2.0 - lViewBoxYmin; } else // ( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx; xtrans = xtrans/2.0 - lViewBoxXmin; } } break; case ENvgPreserveAspectRatio_XmaxYmid: //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport. //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx \ - lViewBoxXmin; } else //( sx < sy ) { sy = sx; ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) \ * 0.5 ) /sy - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx; ytrans = ytrans/2.0 - lViewBoxYmin; } else //( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx - lViewBoxXmin; } } break; case ENvgPreserveAspectRatio_XminYmax: //Align the <min-x> of the element's viewBox with the smallest X value of the viewport. //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; //no change for xtrans...default above } else //( sx < sy ) { sy = sx; ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \ - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx - lViewBoxYmin; } else //( sx < sy ) { sx = sy; } } break; case ENvgPreserveAspectRatio_XmidYmax: //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport. //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) \ * 0.5 ) / sx - lViewBoxXmin; } else //( sx < sy ) { sy = sx; ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \ - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx - lViewBoxYmin; } else //( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx; xtrans = xtrans/2.0 - lViewBoxXmin; } } break; case ENvgPreserveAspectRatio_XmaxYmax: //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport. //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport. if (iMeetSlice == ENvgMeet) { if ( sx > sy ) { sx = sy; xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx\ - lViewBoxXmin; } else //( sx < sy ) { sy = sx; ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \ - lViewBoxYmin; } } else if (iMeetSlice == ENvgSlice) { if ( sx > sy ) { sy = sx; ytrans = lViewPortHeight - sx*lViewBoxHeight; ytrans = ytrans/sx - lViewBoxYmin; } else //( sx < sy ) { sx = sy; xtrans = lViewPortWidth - sx*lViewBoxWidth; xtrans = xtrans/sx - lViewBoxXmin; } } break; default: break; } vgScale( sx, sy); vgTranslate( xtrans, ytrans ); }
static void DoTestFileWrite(TInt aBlockSize, TInt aFileSize = KMaxFileSize, TBool aUpdate = EFalse) // // Do Write benchmark // { DataBuf.SetLength(aBlockSize); const TInt maxWriteCount = aFileSize / aBlockSize; TFileName testDir(_L("?:\\F32-TST\\")); testDir[0] = (TText) gDriveToTest; TInt r = TheFs.MkDir(testDir); test_Value(r, r == KErrNone || r == KErrAlreadyExists); TFileName fileName; r = File.Temp(TheFs, testDir, fileName, EFileWrite | (gFileSequentialModeOn ? EFileSequential : 0) | (gWriteCachingOn ? EFileWriteBuffered : EFileWriteDirectIO)); test_KErrNone(r); if (aUpdate) { TInt r = File.SetSize(aFileSize); test_KErrNone(r); } TUint functionCalls = 0; TTime startTime; TTime endTime; TUint initTicks = 0; TUint finalTicks = 0; // we stop after the entire file has been written or after 10 seconds, whichever happens sooner RTimer timer; timer.CreateLocal(); TRequestStatus reqStat; TInt pos = 0; File.Seek(ESeekStart, pos); timer.After(reqStat, 10000000); // After 10 secs startTime.HomeTime(); initTicks = User::FastCounter(); for (TInt i = 0 ; i<maxWriteCount && reqStat==KRequestPending; i++) { File.Write(pos, DataBuf, aBlockSize); pos += aBlockSize; if (pos > KMaxFileSize-aBlockSize) pos = 0; functionCalls++; } if (gFlushAfterWrite) { r = File.Flush(); test_KErrNone(r) } // write file once only finalTicks = User::FastCounter(); endTime.HomeTime(); // TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); TTimeIntervalMicroSeconds duration = TInt64(finalTicks - initTicks) * TInt64(1000000) / TInt64(gFastCounterFreq) ; TInt dataTransferred = functionCalls * aBlockSize; TReal transferRate = TReal32(dataTransferred) / TReal(duration.Int64()) * TReal(1000000) / TReal(K1K); // KB/s test.Printf(_L("Write %7d bytes in %7d byte blocks:\t%11.3f KBytes/s (%d microsecs)\n"), dataTransferred, aBlockSize, transferRate, endTime.MicroSecondsFrom(startTime).Int64()); timer.Close(); File.Close(); r = TheFs.Delete(fileName); test_KErrNone(r) return; }