double currentTime() { TTime current; current.HomeTime(); // second resolution instead of microsecond return I64REAL( current.Int64() ) / 1000000; }
void CPrimeGenPerformance::PerformAction(TRequestStatus& aStatus) { __UHEAP_MARK; TRequestStatus* status = &aStatus; TTime start, end; TTimeIntervalSeconds diff(0); const TTimeIntervalSeconds iterationTime(iIterations); TUint iterations=0; RInteger prime; start.UniversalTime(); while (diff < iterationTime) { prime = RInteger::NewPrimeL(iBits, TInteger::ETopBitSet); prime.Close(); iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); TTimeIntervalMicroSeconds time = end.MicroSecondsFrom(start); TReal rate = I64REAL(time.Int64()) / iterations; TReal rtime = I64REAL(time.Int64()); HBufC* realbuf = HBufC::NewLC(128); TPtr buf = realbuf->Des(); buf.Format(KPrimeGenFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); CleanupStack::PopAndDestroy(realbuf); User::RequestComplete(status, KErrNone); iActionState = CTestAction::EPostrequisite; iResult = ETrue; __UHEAP_MARKEND; }
void bases::NewSensorEventL(const TTupleName& aTuple, const TDesC& , const CBBSensorEvent& aEvent) { CALLSTACKITEM_N(_CL("bases"), _CL("NewSensorEventL")); #ifdef __WINS__ //User::Leave(KErrGeneral); //return; #endif const TBBCellId* cell=bb_cast<TBBCellId>(aEvent.iData()); if (aEvent.iPriority()!=CBBSensorEvent::VALUE || !cell) return; if (!testing) now=aEvent.iStamp(); bool missing_data=false; if ( cell->iLocationAreaCode()==0 ) { if (started) { if (aTuple==KNoTuple) { now_at_location(cell, -1, false, false, aEvent.iStamp()); } return; } missing_data=true; } TInt id=cell->iMappedId(); current_cell_value=*cell; cell_list_node *n=0; n=get_single(id); while (n && n->merged_to != n->id) { id=n->merged_to; n=get_single(id); } if (started && current) { // see if we have a gap between stop and start if (current->id!=id) { // different cell, allow 10 minute difference TTimeIntervalMinutes d(10); if (previous_time+d < now && !missed_data ) { current->f++; update_database(current, false); current=0; } } else { // same cell, allow 30 minute difference TTimeIntervalMinutes d(30); if (previous_time+d < now) { current->f++; update_database(current, false); current=0; } } if (!current) iCandidates->reset(); } started=false; bool same_loc=true; if (current) { if (current->id != id) { current->f++; same_loc=false; iGraph->AddEdge(current->id, id); } #ifdef __S60V3__ TInt64 diff=now.Int64()-previous_time.Int64(); double unaged_spent=I64REAL(diff)/(1024.0*1024.0); #else double unaged_spent=(now.Int64()-previous_time.Int64()).GetTReal()/(1024.0*1024.0); #endif if (unaged_spent<0.0) unaged_spent=0.0; double spent=scale*unaged_spent; current->unaged_t+=unaged_spent; MergeEvent(current, unaged_spent, !same_loc); previous_time=now; move_into_place(current, spent); update_database(current, same_loc); } else { previous_time=now; same_loc=false; } if (missing_data ) { now_at_location(cell, -1, false, false, aEvent.iStamp()); started=true; missed_data=true; return; } else { missed_data=false; } if (!n) { n=new (ELeave) cell_list_node(id, now); CC_TRAPD(err, cell_hash->AddDataL(id, n)); if (err!=KErrNone) { delete n; User::Leave(1); } n->prev=last_cell; if (last_cell) { last_cell->next=n; n->pos=last_cell->pos+1; } last_cell=n; } if (!first_cell) { first_cell=n; n->pos=0; } while (n && n->merged_to != n->id) { id=n->merged_to; n=(cell_list_node*)cell_hash->GetData(id); } current=n; n->last_seen=now; update_database(n, true); if (now.DayNoInYear()!=previous_day.DayNoInYear()) { scale*=(1.0/aging); if (scale>1024.0) { rescale(); } previous_day=now; bases_info->t=scale; update_database(bases_info, false); } if (!testing) { now_at_location(cell, id, n->is_base, !same_loc, aEvent.iStamp()); } }
void CMontgomeryPerformance::PerformAction(TRequestStatus& aStatus) { TRequestStatus* status = &aStatus; iResult = ETrue; CMontgomeryStructure* montConst; TUint iterations = 0; TTime start, end; TTimeIntervalSeconds diff(0); const TTimeIntervalSeconds iterationTime(iIterations); start.UniversalTime(); while (diff < iterationTime) { montConst = CMontgomeryStructure::NewL(iModulus); delete montConst; iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); TTimeIntervalMicroSeconds time = end.MicroSecondsFrom(start); TReal rate = I64REAL(time.Int64()) / (iterations); TReal rtime = I64REAL(time.Int64()); HBufC* realbuf = HBufC::NewLC(128); TPtr buf = realbuf->Des(); buf.Format(KPerfConstFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); CMontgomeryStructure* mont = CMontgomeryStructure::NewLC(iModulus); //Multiply diff = 0; iterations = 0; start.UniversalTime(); while (diff < iterationTime) { mont->MultiplyL(iA, iB); iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); time = end.MicroSecondsFrom(start); rate = I64REAL(time.Int64()) / iterations; rtime = I64REAL(time.Int64()); buf.Zero(); buf.Format(KPerfMultiplyFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); //Square diff = 0; iterations = 0; start.UniversalTime(); while (diff < iterationTime) { mont->SquareL(iA); iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); time = end.MicroSecondsFrom(start); rate = I64REAL(time.Int64()) / iterations; rtime = I64REAL(time.Int64()); buf.Zero(); buf.Format(KPerfSquareFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); //Exponentiate diff = 0; iterations = 0; start.UniversalTime(); while (diff < iterationTime) { mont->ExponentiateL(iA, iB); iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); time = end.MicroSecondsFrom(start); rate = I64REAL(time.Int64()) / iterations; rtime = I64REAL(time.Int64()); buf.Zero(); buf.Format(KPerfExpFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); //Reduce RInteger top = iA.TimesL(iB); CleanupStack::PushL(top); diff = 0; iterations = 0; start.UniversalTime(); while (diff < iterationTime) { mont->ReduceL(top); iterations++; end.UniversalTime(); end.SecondsFrom(start, diff); } end.UniversalTime(); CleanupStack::PopAndDestroy(&top); time = end.MicroSecondsFrom(start); rate = I64REAL(time.Int64()) / iterations; rtime = I64REAL(time.Int64()); buf.Zero(); buf.Format(KPerfReduceFormat, rate, iterations, rtime); iOut.writeString(buf); iConsole.Printf(_L(".")); CleanupStack::PopAndDestroy(mont); CleanupStack::PopAndDestroy(realbuf); User::RequestComplete(status, KErrNone); iActionState = CTestAction::EPostrequisite; }
void TDbStoreIndexStats::TBound::Set(const TInt64& aBound) {iValue=I64REAL(aBound);}