textrendering/textformatting/test/src/TFormBenchmark.cpp
changeset 51 a7c938434754
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
44:601ab138ba0b 51:a7c938434754
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    32 
    32 
    33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    34 #include "TAGMA_INTERNAL.H"
    34 #include "TAGMA_INTERNAL.H"
    35 #endif
    35 #endif
    36 
    36 
       
    37 #include "tformbenchmark.h"
       
    38 
       
    39 namespace LocalToTFormBenchmark
       
    40 {
       
    41 CTFormBenchmarkStep* TestStep = NULL;
       
    42 #define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
       
    43 #define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
       
    44 }
       
    45 using namespace LocalToTFormBenchmark;
       
    46 
    37 RFs fs;
    47 RFs fs;
    38 RFile fileTimeStamps;
    48 RFile fileTimeStamps;
       
    49 
       
    50 _LIT(KFormBenchmark, "TFormBenchmark");
    39 
    51 
    40 #if ((defined (__WINS__)) || (defined (__X86GCC__)))
    52 #if ((defined (__WINS__)) || (defined (__X86GCC__)))
    41 	_LIT(KLogTimeStampsName, "c:\\formtimestamps.csv");
    53 	_LIT(KLogTimeStampsName, "c:\\formtimestamps.csv");
    42 #else
    54 #else
    43 	_LIT(KLogTimeStampsName, "e:\\formtimestamps.csv");
    55 	_LIT(KLogTimeStampsName, "e:\\formtimestamps.csv");
    65 \x57FA\x790E\x3067\x3042\x308B\x306E\x3067\x3001 ");
    77 \x57FA\x790E\x3067\x3042\x308B\x306E\x3067\x3001 ");
    66 const TInt KJapaneseRepeats = 357;
    78 const TInt KJapaneseRepeats = 357;
    67 const TInt KDisplayWidth = 100;
    79 const TInt KDisplayWidth = 100;
    68 const TInt KDisplayHeight = 120;
    80 const TInt KDisplayHeight = 120;
    69 
    81 
    70 
       
    71 _LIT(KFormBenchmark, "TFormBenchmark");
       
    72 RTest test(KFormBenchmark);
       
    73 
       
    74 const TInt KInsertDisplayWidth = 200;
    82 const TInt KInsertDisplayWidth = 200;
    75 const TInt KChangedDisplayWidth = 150;
    83 const TInt KChangedDisplayWidth = 150;
    76 
    84 
    77 _LIT(KEnglishToInsert1, "Whereas recognition of the inherent dignity");
    85 _LIT(KEnglishToInsert1, "Whereas recognition of the inherent dignity");
    78 _LIT(KEnglishToInsert2, " and of the equal and inalienable rights of all... and so on");
    86 _LIT(KEnglishToInsert2, " and of the equal and inalienable rights of all... and so on");
   419 */
   427 */
   420 void RunScrollingTestL(TInt aRepeats, TInt aRepeatsPerParagraph,
   428 void RunScrollingTestL(TInt aRepeats, TInt aRepeatsPerParagraph,
   421 	RArray<TTFTimeStamp>& aTimeStampsDown, RArray<TTFTimeStamp>& aTimeStampsUp,
   429 	RArray<TTFTimeStamp>& aTimeStampsDown, RArray<TTFTimeStamp>& aTimeStampsUp,
   422 	TDocInfo& aDocInfo)
   430 	TDocInfo& aDocInfo)
   423 	{
   431 	{
   424 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1897 "));
   432     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1897 "));
   425 	TInt docLength = KEnglish().Length() * aRepeats;
   433 	TInt docLength = KEnglish().Length() * aRepeats;
   426 	TInt paragraphs = aRepeats/aRepeatsPerParagraph;
   434 	TInt paragraphs = aRepeats/aRepeatsPerParagraph;
   427 
   435 
   428 	TFormattingObjects o;
   436 	TFormattingObjects o;
   429 	CreateFormattingObjectsLC(o);
   437 	CreateFormattingObjectsLC(o);
   434 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*(o.iView));
   442 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*(o.iView));
   435 	TInt64 slowest = 0;
   443 	TInt64 slowest = 0;
   436 	MeasureCursorL(aTimeStampsDown, TCursorPosition::EFLineDown, o, slowest);
   444 	MeasureCursorL(aTimeStampsDown, TCursorPosition::EFLineDown, o, slowest);
   437 	MeasureCursorL(aTimeStampsUp, TCursorPosition::EFLineUp, o, slowest);
   445 	MeasureCursorL(aTimeStampsUp, TCursorPosition::EFLineUp, o, slowest);
   438 
   446 
   439 	RDebug::Printf("PERFORMANCE: Syslibs;Form_Scrolling_Slowest_Doc_with_%d_characters_%d_paragraphs;microseconds: %Ld", docLength, paragraphs, slowest);
   447 	TBuf<256> buf;
   440 
   448 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_Scrolling_Slowest_Doc_with_%d_characters_%d_paragraphs;microseconds: %Ld"), docLength, paragraphs, slowest);
       
   449 	TESTPRINT(buf);
       
   450 	
   441 	aDocInfo = GetSampleDocInfoL(o);
   451 	aDocInfo = GetSampleDocInfoL(o);
   442 	DestroyFormattingObjects(o);
   452 	DestroyFormattingObjects(o);
   443 	}
   453 	}
   444 
   454 
   445 /**
   455 /**
   450 @SYMTestExpectedResults The test must not fail or panic .
   460 @SYMTestExpectedResults The test must not fail or panic .
   451 @SYMDEF DEF092140, DEF092139
   461 @SYMDEF DEF092140, DEF092139
   452 */
   462 */
   453 void RunEnglishArabicJapaneseBenchmarksL(TFormattingObjects& aFormattingObjects)
   463 void RunEnglishArabicJapaneseBenchmarksL(TFormattingObjects& aFormattingObjects)
   454 	{
   464 	{
   455 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1898 "));
   465     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1898 "));
   456 	SetTextL(*aFormattingObjects.iRichText, KEnglish, KEnglishRepeats, KEnglishRepeats);
   466 	SetTextL(*aFormattingObjects.iRichText, KEnglish, KEnglishRepeats, KEnglishRepeats);
   457 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*aFormattingObjects.iView);
   467 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*aFormattingObjects.iView);
   458 	TTimeIntervalMicroSeconds rmsCursorDown = MeasureRmsCursorDownL(*aFormattingObjects.iView);
   468 	TTimeIntervalMicroSeconds rmsCursorDown = MeasureRmsCursorDownL(*aFormattingObjects.iView);
   459 	TTimeIntervalMicroSeconds englishFormatting = MeasureFormattingL(*aFormattingObjects.iView);
   469 	TTimeIntervalMicroSeconds englishFormatting = MeasureFormattingL(*aFormattingObjects.iView);
   460 	TInt englishLines = NumberOfLines(*aFormattingObjects.iLayout);
   470 	TInt englishLines = NumberOfLines(*aFormattingObjects.iLayout);
   482 		minLines = japaneseLines;
   492 		minLines = japaneseLines;
   483 	else if (maxLines < japaneseLines)
   493 	else if (maxLines < japaneseLines)
   484 		maxLines = japaneseLines;
   494 		maxLines = japaneseLines;
   485 
   495 
   486 	//Tests that the number of lines in each test is more or less balanced
   496 	//Tests that the number of lines in each test is more or less balanced
   487 	test(maxLines * 100 <= minLines * 105);
   497 	TESTPOINT(maxLines * 100 <= minLines * 105);
   488 
   498 
   489 	RDebug::Printf("PERFORMANCE: Syslibs;Form_OpeningLargeParagraph;microseconds: %d",
   499 	TBuf<256> buf;
       
   500 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_OpeningLargeParagraph;microseconds: %d"),
   490 		static_cast<TInt>(opening.Int64()));
   501 		static_cast<TInt>(opening.Int64()));
   491 	RDebug::Printf("PERFORMANCE: Syslibs;Form_RmsCursorDown;microseconds: %d",
   502 	TESTPRINT(buf);
       
   503 	buf.Zero();
       
   504 	
       
   505 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_RmsCursorDown;microseconds: %d"),
   492 		static_cast<TInt>(rmsCursorDown.Int64()));
   506 		static_cast<TInt>(rmsCursorDown.Int64()));
   493 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingEnglish;microseconds: %d",
   507 	TESTPRINT(buf);
       
   508 	buf.Zero();
       
   509 	
       
   510 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingEnglish;microseconds: %d"),
   494 		static_cast<TInt>(englishFormatting.Int64()));
   511 		static_cast<TInt>(englishFormatting.Int64()));
   495 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingArabic;microseconds: %d",
   512 	TESTPRINT(buf);
       
   513 	buf.Zero();
       
   514 	
       
   515 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingArabic;microseconds: %d"),
   496 		static_cast<TInt>(arabicFormatting.Int64()));
   516 		static_cast<TInt>(arabicFormatting.Int64()));
   497 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingJapanese;microseconds: %d",
   517 	TESTPRINT(buf);
       
   518 	buf.Zero();
       
   519 	
       
   520 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingJapanese;microseconds: %d"),
   498 		static_cast<TInt>(japaneseFormatting.Int64()));
   521 		static_cast<TInt>(japaneseFormatting.Int64()));
       
   522 	TESTPRINT(buf);	
   499 	}
   523 	}
   500 
   524 
   501 /**
   525 /**
   502 @SYMTestCaseID SYSLIB-FORMA-UT-1896
   526 @SYMTestCaseID SYSLIB-FORMA-UT-1896
   503 @SYMTestCaseDesc Benchmarks inserting text from the beginning of a paragraph
   527 @SYMTestCaseDesc Benchmarks inserting text from the beginning of a paragraph
   508 @SYMDEF DEF092140, DEF092139
   532 @SYMDEF DEF092140, DEF092139
   509 */
   533 */
   510 void RunInsertTextTestsL(TInt aRepeats, TInt aRepeatsPerParagraph,
   534 void RunInsertTextTestsL(TInt aRepeats, TInt aRepeatsPerParagraph,
   511 	RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
   535 	RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
   512 	{
   536 	{
   513 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1896 "));
   537     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1896 "));
   514 	TFormattingObjects o;
   538 	TFormattingObjects o;
   515 	CreateFormattingObjectsLC(o);
   539 	CreateFormattingObjectsLC(o);
   516 	TInt64 slowest = 0;
   540 	TInt64 slowest = 0;
   517 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   541 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   518 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   542 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   519 	MeasureInsertTextAtStartL(aRepeats, aRepeatsPerParagraph, aTimeStamps, o, slowest);
   543 	MeasureInsertTextAtStartL(aRepeats, aRepeatsPerParagraph, aTimeStamps, o, slowest);
   520 	aDocInfo = GetSampleDocInfoL(o);
   544 	aDocInfo = GetSampleDocInfoL(o);
   521 
   545 
   522 	RDebug::Printf("PERFORMANCE: Syslibs;Form_InsertText_Slowest;microseconds: %Ld", slowest);
   546 	TBuf<256> buf;
   523 
   547 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_InsertText_Slowest;microseconds: %Ld"), slowest);
       
   548 	TESTPRINT(buf);
       
   549 	
   524 	DestroyFormattingObjects(o);
   550 	DestroyFormattingObjects(o);
   525 	}
   551 	}
   526 
   552 
   527 /**
   553 /**
   528 @SYMTestCaseID SYSLIB-FORMA-UT-1895
   554 @SYMTestCaseID SYSLIB-FORMA-UT-1895
   533 @SYMTestExpectedResults The test must not fail or panic .
   559 @SYMTestExpectedResults The test must not fail or panic .
   534 @SYMDEF DEF092140, DEF092139
   560 @SYMDEF DEF092140, DEF092139
   535 */
   561 */
   536 void RunDeleteTextFromStartTest(RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
   562 void RunDeleteTextFromStartTest(RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
   537 	{
   563 	{
   538 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
   564     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
   539 	TFormattingObjects o;
   565 	TFormattingObjects o;
   540 	CreateFormattingObjectsLC(o);
   566 	CreateFormattingObjectsLC(o);
   541 	TInt64 slowest = 0;
   567 	TInt64 slowest = 0;
   542 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   568 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   543 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   569 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   547 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*o.iView);
   573 	TTimeIntervalMicroSeconds opening = MeasureOpeningL(*o.iView);
   548 
   574 
   549 	MeasureDeleteTextFromStartL(aTimeStamps, o, slowest);
   575 	MeasureDeleteTextFromStartL(aTimeStamps, o, slowest);
   550 	aDocInfo = GetSampleDocInfoL(o);
   576 	aDocInfo = GetSampleDocInfoL(o);
   551 
   577 
   552 	RDebug::Printf("PERFORMANCE: Syslibs;Form_DeleteText_Slowest;microseconds: %Ld", slowest);
   578 	TBuf<256> buf;	
       
   579 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_DeleteText_Slowest;microseconds: %Ld"), slowest);
       
   580 	TESTPRINT(buf);	
   553 
   581 
   554 	CleanupStack::PopAndDestroy();//bigbuf
   582 	CleanupStack::PopAndDestroy();//bigbuf
   555 	DestroyFormattingObjects(o);
   583 	DestroyFormattingObjects(o);
   556 	}
   584 	}
   557 
   585 
   558 void GetFormattingBenchmarkL(TInt aNumberOfIterations, TInt& aNumberOfCharacters, TInt64& aNormalisedBenchmark)
   586 void GetFormattingBenchmarkL(TInt aNumberOfIterations, TInt& aNumberOfCharacters, TInt64& aNormalisedBenchmark)
   559 	{
   587 	{
   560 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
   588     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
   561 	TFormattingObjects o;
   589 	TFormattingObjects o;
   562 	CreateFormattingObjectsLC(o);
   590 	CreateFormattingObjectsLC(o);
   563 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   591 	o.iLayout->SetWrapWidth(KInsertDisplayWidth);
   564 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   592 	o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
   565 
   593 
   594 roughly linear with the document size.
   622 roughly linear with the document size.
   595 @SYMDEF DEF095401
   623 @SYMDEF DEF095401
   596 */
   624 */
   597 void RunFormattingBenchmarksL()
   625 void RunFormattingBenchmarksL()
   598 	{
   626 	{
   599 	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1894 "));
   627     TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1894 "));
   600 	TInt numberOfCharacters = 0;
   628 	TInt numberOfCharacters = 0;
   601 	TInt numberOfIterations;
   629 	TInt numberOfIterations;
   602 	TInt64 normalisedBenchmark = 0;
   630 	TInt64 normalisedBenchmark = 0;
   603 
   631 
       
   632 	TBuf<256> buf;
       
   633 	
   604 	numberOfIterations = 1;
   634 	numberOfIterations = 1;
   605 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   635 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   606 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   636 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   607 
   637 	TESTPRINT(buf);
       
   638 	
       
   639 	buf.Zero();
   608 	numberOfIterations = 5;
   640 	numberOfIterations = 5;
   609 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   641 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   610 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   642 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   611 
   643 	TESTPRINT(buf);
       
   644 	
       
   645 	buf.Zero();
   612 	numberOfIterations = 10;
   646 	numberOfIterations = 10;
   613 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   647 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   614 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   648 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   615 
   649 	TESTPRINT(buf);
       
   650 
       
   651 	buf.Zero();
   616 	numberOfIterations = 50;
   652 	numberOfIterations = 50;
   617 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   653 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   618 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   654 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   619 
   655 	TESTPRINT(buf);
       
   656 
       
   657 	buf.Zero();
   620 	numberOfIterations = 100;
   658 	numberOfIterations = 100;
   621 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   659 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   622 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   660 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   623 
   661 	TESTPRINT(buf);
       
   662 
       
   663 	buf.Zero();
   624 	numberOfIterations = 250;
   664 	numberOfIterations = 250;
   625 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   665 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   626 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   666 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   627 
   667 	TESTPRINT(buf);
       
   668 
       
   669 	buf.Zero();
   628 	numberOfIterations = 500;
   670 	numberOfIterations = 500;
   629 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   671 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   630 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   672 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   631 
   673 	TESTPRINT(buf);
       
   674 	
       
   675 	buf.Zero();
   632 	numberOfIterations = 750;
   676 	numberOfIterations = 750;
   633 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   677 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   634 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   678 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
   635 
   679 	TESTPRINT(buf);
       
   680 	
       
   681 	buf.Zero();
   636 	numberOfIterations = 1000;
   682 	numberOfIterations = 1000;
   637 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   683 	GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
   638 	RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark);
   684 	buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
       
   685 	TESTPRINT(buf);
   639 	}
   686 	}
   640 
   687 
   641 void RunBenchmarksL()
   688 void RunBenchmarksL()
   642 	{
   689 	{
   643 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
   690 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
   683 	CleanupStack::PopAndDestroy(2);
   730 	CleanupStack::PopAndDestroy(2);
   684 	CleanupStack::PopAndDestroy(scheduler);
   731 	CleanupStack::PopAndDestroy(scheduler);
   685 
   732 
   686 	}
   733 	}
   687 
   734 
   688 TInt E32Main()
   735 TVerdict CTFormBenchmarkStep::doTestStepL()
   689 	{
   736 	{
   690 	test.Title();
   737     SetTestStepResult(EPass);
   691 	test.Start(_L("Start Font/Bitmap Server"));
   738     TestStep = this;
   692 	static CTrapCleanup* TrapCleanup = CTrapCleanup::New();
   739     
       
   740     TESTPRINT(KFormBenchmark);
       
   741     TESTPRINT(_L("Start Font/Bitmap Server"));
       
   742 
   693 	TInt error = RFbsSession::Connect();
   743 	TInt error = RFbsSession::Connect();
   694 	if (error == KErrNotFound)
   744 	if (error == KErrNotFound)
   695 		{
   745 		{
   696 		FbsStartup();
   746 		FbsStartup();
   697 		error = RFbsSession::Connect();
   747 		error = RFbsSession::Connect();
   698 		}
   748 		}
   699 	// Tests that FBServ actually starts
   749 	// Tests that FBServ actually starts
   700 	test(error == KErrNone);
   750 	TESTPOINT(error == KErrNone);
   701 	error = fs.Connect();
   751 	error = fs.Connect();
   702 	test(error == KErrNone);
   752 	TESTPOINT(error == KErrNone);
   703 
   753 
   704 	error = fileTimeStamps.Replace(fs, KLogTimeStampsName, EFileWrite);
   754 	error = fileTimeStamps.Replace(fs, KLogTimeStampsName, EFileWrite);
   705 	RDebug::Printf("> fileTimeStamps.Replace %d", error);
   755 	
   706 	test(error == KErrNone);
   756 	TBuf<256> buf;
   707 
   757 	buf.AppendFormat(_L("> fileTimeStamps.Replace %d"), error);
   708 	test.Next(_L("Run Benchmarks"));
   758 	TESTPRINT(buf);
       
   759 	
       
   760 	TESTPOINT(error == KErrNone);
       
   761 
       
   762 	TESTPRINT(_L("Run Benchmarks"));
   709 	TRAP(error, RunBenchmarksL());
   763 	TRAP(error, RunBenchmarksL());
   710 	// Tests that the Benchmarks did not run out of memory
   764 	// Tests that the Benchmarks did not run out of memory
   711 	// or otherwise leave
   765 	// or otherwise leave
   712 	test(error == KErrNone);
   766 	TESTPOINT(error == KErrNone);
   713 
   767 
   714 	fileTimeStamps.Close();
   768 	fileTimeStamps.Close();
   715 	fs.Close();
   769 	fs.Close();
   716 	RFbsSession::Disconnect();
   770 	RFbsSession::Disconnect();
   717 	delete TrapCleanup;
   771 
   718 	test.End();
   772 	return TestStepResult();
   719 	test.Close();
   773 	}
   720 	return error;
   774 
   721 	}
       
   722