当前位置: 首页>>代码示例>>C++>>正文


C++ CStopWatch::Start方法代码示例

本文整理汇总了C++中CStopWatch::Start方法的典型用法代码示例。如果您正苦于以下问题:C++ CStopWatch::Start方法的具体用法?C++ CStopWatch::Start怎么用?C++ CStopWatch::Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStopWatch的用法示例。


在下文中一共展示了CStopWatch::Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RasterizeImage

void CBathymetryRasterizer::RasterizeImage()
{
	CStopWatch sw;
	sw.Start();

	int LowPixel = 255;
	int HighPixel = 0;

	byte * ImageData = new byte[ImageSize * ImageSize * 3];
	for (int i = 0; i < ImageSize; ++ i)
	{
		for (int j = 0; j < ImageSize; ++ j)
		{
			int const Index = ImageSize * i + j;

			if (Buckets[Index].Count > 0)
			{
				double const Value = Buckets[Index].Sum / Buckets[Index].Count;
				double const Intensity = 2.5f;
				double const Bottom = 0;
				int const Pixel = 255 - Clamp<int>((int) (Value * Intensity - Bottom), 0, 255);

				LowPixel = Min(LowPixel, Pixel);
				HighPixel = Max(HighPixel, Pixel);

				ImageData[Index * 3 + 0] = Pixel;
				ImageData[Index * 3 + 1] = 0;
				ImageData[Index * 3 + 2] = 0;
			}
			else
			{
				ImageData[Index * 3 + 0] = 0;
				ImageData[Index * 3 + 1] = 0;
				ImageData[Index * 3 + 2] = 255;
			}

			if (Buckets[Index].Tag == -1)
			{
				ImageData[Index * 3 + 1] = 255;
			}
			//else if (Buckets[Index].Tag > 0)
			//{
			//	if (TagGroups[Buckets[Index].Tag].IsBridge)
			//	{
			//		ImageData[Index * 3 + 1] = ImageData[Index * 3 + 0];
			//		ImageData[Index * 3 + 0] = 0;
			//		ImageData[Index * 3 + 2] = 128;
			//	}
			//}
		}
	}

	Log::Info("Low value: %d High Value: %d", LowPixel, HighPixel);

	CImage * Image = new CImage(ImageData, vec2u(ImageSize), 3);
	Image->FlipY();
	Image->Write(OutputName);

	Log::Info("Rasterize to image took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:60,代码来源:CBathymetryRasterizer.cpp

示例2: GetArgs

void
CSeqDBPerfApp::x_InitApplicationData()
{
    CStopWatch sw;
    sw.Start();
    const CArgs& args = GetArgs();
    const CSeqDB::ESeqType kSeqType = ParseMoleculeTypeString(args["dbtype"].AsString());
    const string& kDbName(args["db"].AsString());
    m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
    m_DbIsProtein = static_cast<bool>(m_BlastDb->GetSequenceType() == CSeqDB::eProtein);

    int kNumThreads = 1;
#if (defined(_OPENMP) && defined(NCBI_THREADS))
    kNumThreads = args["num_threads"].AsInteger();
#endif
    m_DbHandles.reserve(kNumThreads);
    m_DbHandles.push_back(m_BlastDb);
    if (kNumThreads > 1) {
        for (int i = 1; i < kNumThreads; i++) {
            m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
            m_DbHandles.push_back(m_BlastDb);
        }
    }
    m_MemoryUsage.assign(kNumThreads, SMemUsage());

    sw.Stop();
    cout << "Initialization time: " << sw.AsSmartString() << endl;
}
开发者ID:swuecho,项目名称:igblast,代码行数:28,代码来源:seqdb_perf.cpp

示例3: FillInteriorPoints

void CTopographyRasterizer::FillInteriorPoints()
{
	CStopWatch sw;
	sw.Start();

	Buckets = new SPixelBucket[ImageSize * ImageSize];

	vector<STriangle2D<double>> Triangles;
	AddAtEnd(Triangles, TriangulateEarClipping(CatalinaOutline));

	double ActualMax = 0;

	for (int i = 0; i < ImageSize; ++ i)
	{
		for (int j = 0; j < ImageSize; ++ j)
		{
			bool InsideTriangle = false;
			vec2d const Point = vec2d(
				RegionXCorner + ((double) i / (double) (ImageSize - 1)) * RegionXSize,
				RegionYCorner + ((double) j / (double) (ImageSize - 1)) * RegionYSize
			);

			for (auto const & Triangle : Triangles)
			{
				if (ion::IsPointInOrOnTriangle(Triangle.A, Triangle.C, Triangle.B, Point))
				{
					InsideTriangle = true;
					break;
				}
			}

			if (InsideTriangle)
			{
				auto Bucket = Helper_GetBucket(i, j);
				Bucket->Interior = true;
				Bucket->Value = Helper_ClosestEdgeDistance(Point);

				ActualMax = Max(ActualMax, Bucket->Value);
			}
		}
	}

	double const ApexPoint = 0.06;
	double const ScaleUp = 255.0 / 0.05;

	for (int i = 0; i < ImageSize; ++ i)
	{
		for (int j = 0; j < ImageSize; ++ j)
		{
			auto Bucket = Helper_GetBucket(i, j);
			Bucket->Value /= ApexPoint;
			Bucket->Value = pow(Bucket->Value, 0.65f);
			Bucket->Value *= ApexPoint * ScaleUp;
		}
	}

	Log::Info("Max: %f Scaled Max: %f", ActualMax, ActualMax * ScaleUp);
	Log::Info("Topography fill interior took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:59,代码来源:CBathymetryRasterizer.cpp

示例4: TestApp_Init

bool CThreadPoolTester::TestApp_Init(void)
{
    s_Pool = new CThreadPool(kQueueSize, kMaxThreads);

    s_RNG.SetSeed(CProcess::GetCurrentPid());

    if (s_NumThreads > kQueueSize) {
        s_NumThreads = kQueueSize;
    }

    int total_cnt = kTasksPerThread * s_NumThreads;
    s_Actions.resize(total_cnt + 1);
    s_ActionTasks.resize(total_cnt + 1);
    s_CancelTypes.resize(total_cnt + 1);
    s_WaitPeriods.resize(total_cnt + 1);
    s_PostTimes.resize(total_cnt + 1);
    s_Tasks.resize(total_cnt + 1);

    int req_num = 0;
    for (int i = 1; i <= total_cnt; ++i) {
        int rnd = s_RNG.GetRand(1, 1000);
        if (req_num <= 10 || rnd > 100) {
            s_Actions[i] = eAddTask;
            s_ActionTasks[i] = req_num;
            s_WaitPeriods[req_num] = s_RNG.GetRand(50, 100);
            rnd = s_RNG.GetRand(0, 100);
            s_CancelTypes[req_num] = (rnd <= 1? eSimpleWait: eCheckCancel);
            ++req_num;
        }
        else if (rnd <= 1) {
            s_Actions[i] = eFlushWaiting;
        }
        else if (rnd <= 2) {
            s_Actions[i] = eFlushNoWait;
        }
        else if (rnd <= 4) {
            s_Actions[i] = eAddExclusiveTask;
            s_ActionTasks[i] = req_num;
            ++req_num;
        }
        else if (rnd <= 6) {
            s_Actions[i] = eCancelAll;
        }
        else /* if (rnd <= 100) */ {
            s_Actions[i] = eCancelTask;
            s_ActionTasks[i] = req_num - 8;
        }
        s_PostTimes[i] = 100 * (i / 20) + s_RNG.GetRand(50, 100);
    }

    MSG_POST("Starting test for CThreadPool");

    s_Timer.Start();

    return true;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例5: KillGroup

bool CProcess::KillGroup(unsigned long timeout) const
{
#if   defined(NCBI_OS_UNIX)

    TPid pgid = getpgid((TPid)m_Process);
    if (pgid == (TPid)(-1)) {
        // TRUE if PID does not match any process
        return errno == ESRCH;
    }
    return KillGroupById(pgid, timeout);

#elif defined(NCBI_OS_MSWIN)

    // Convert the process handle to process ID if needed
    TPid pid = 0;
    if (m_Type == eHandle) {
        // Some OS like Windows 2000 and WindowsXP (w/o SP1) don't
        // have GetProcessId() function. Try to load it directy from 
        // KERNEL32.DLL
        static bool  s_TryGetProcessId = true;
        typedef DWORD (STDMETHODCALLTYPE FAR* LPFN_GETPROCESSID)(HANDLE process);
        static LPFN_GETPROCESSID s_GetProcessId = NULL;

        if ( s_TryGetProcessId  &&  !s_GetProcessId ) {
            s_GetProcessId  = (LPFN_GETPROCESSID)GetProcAddress(
                                    GetModuleHandleA("KERNEL32.DLL"),
                                    "GetProcessId");
            s_TryGetProcessId = false;
        }
        if ( !s_GetProcessId ) {
            // GetProcessId() is not available on this platform
            return false;
        }
        pid = s_GetProcessId((TProcessHandle)m_Process);

    } else {  // m_Type == ePid
        pid = (TPid)m_Process;
    }
    if (!pid) {
        return false;
    }
    // Use safe process termination if timeout > 0
    unsigned long x_timeout = timeout;
    CStopWatch timer;
    if ( timeout ) {
        timer.Start();
    }
    // Kill process tree
    bool result = s_KillGroup(pid, (timeout > 0) ? &timer : 0, x_timeout);
    return result;

#endif
}
开发者ID:timothyjlaurent,项目名称:nacl_blast,代码行数:53,代码来源:ncbi_process.cpp

示例6: FillBridgeGroups

void CBathymetryRasterizer::FillBridgeGroups()
{
	CStopWatch sw;
	sw.Start();

	static vector<vec2i> const Neighbors =
	{
		vec2i(-1, 0),
		vec2i(1, 0),
		vec2i(0, -1),
		vec2i(0, 1),
	};

	int Tag = 1;
	while (TagGroups[Tag].count)
	{
		if (TagGroups[Tag].IsBridge)
		{
			vector<vec2i> Queue = Helper_GetAllMatchingGroup(Tag);

			int KernelSize = 4;
			int MinSamples = 2;

			while (Queue.size() && KernelSize <= 512)
			{
				for (auto const & Spot : Queue)
				{
					Helper_EstimatePixelValueBridge(Spot, KernelSize, MinSamples);
				}

				for (auto it = Queue.begin(); it != Queue.end(); )
				{
					if (Helper_GetBucket(*it)->Count > 0)
					{
						it = Queue.erase(it);
					}
					else
					{
						it ++;
					}
				}
				
				KernelSize += 2;
				MinSamples = 4;
			}
		}

		Tag ++;
	}

	Log::Info("Fill bridge groups took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:52,代码来源:CBathymetryRasterizer.cpp

示例7: Start

TEST(TestStopWatch, Start)
{
  CStopWatch a;
  CTestStopWatchThread thread;

  EXPECT_FALSE(a.IsRunning());
  EXPECT_EQ(0.0f, a.GetElapsedSeconds());
  EXPECT_EQ(0.0f, a.GetElapsedMilliseconds());

  std::cout << "Calling Start()" << std::endl;
  a.Start();
  thread.Sleep(1000);
  EXPECT_TRUE(a.IsRunning());
  std::cout << "Elapsed Seconds: " << a.GetElapsedSeconds() << std::endl;
  std::cout << "Elapsed Milliseconds: " << a.GetElapsedMilliseconds() << std::endl;
}
开发者ID:DJMatty,项目名称:xbmc,代码行数:16,代码来源:TestStopwatch.cpp

示例8: FillGroups

void CBathymetryRasterizer::FillGroups()
{
	CStopWatch sw;
	sw.Start();

	int tag = 1;
	while (TagGroups[tag].count)
	{
		if (TagGroups[tag].count < 96 && ! TagGroups[tag].IsBridge)
		{
			Helper_ReconstructTagGroup(TagGroups[tag], tag);
		}
		tag ++;
	}

	Log::Info("Fill groups took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:17,代码来源:CBathymetryRasterizer.cpp

示例9: DrawGLScene

void DrawGLScene(GLvoid)								// Here's Where We Do All The Drawing
{
#ifdef _DEBUG
	// DEBUG: FPS
	static CStopWatch w;
	static int nFrames = 0;
	if (nFrames == 0)
	{
		w.Init();
		w.Start();
	}
	if (++nFrames == 500)
	{
		FILE *f = fopen("cuckoo.debug.log", "a");
		fprintf(f, "FPS: %.2f\n", nFrames/w.GetElapsed());
		fclose(f);
		Beep(5000, 100);
	}

	// DEBUG: Gestion d'erreurs
	GLenum error = glGetError();
	if (error != GL_NO_ERROR)
	{
		FILE *f = fopen("cuckoo.debug.log", "a");
		fprintf(f, "Error: %s\n", gluErrorString(error));
		fclose(f);
		Beep(3000, 1000);
	}
#endif

	glLoadIdentity();									// Reset The View

	// Affiche l'horloge
	g_pClock->Render(g_swTimer.GetElapsed());

/*	glAccum(GL_MULT, 0.5f);
	glAccum(GL_ACCUM, 0.5f);
	glAccum(GL_RETURN, 1.0f);
	glFlush();*/

	return;
}
开发者ID:wernight,项目名称:cuckoo,代码行数:42,代码来源:Cuckoo.cpp

示例10: CopySourcePointsToBuckets

void CBathymetryRasterizer::CopySourcePointsToBuckets()
{
	CStopWatch sw;
	sw.Start();

	for (auto const & Point : SourceElevationPostings)
	{
		int const IndexX = (int) (((Point.X - RegionXCorner) / RegionXSize) * ImageSize);
		int const IndexY = (int) (((Point.Y - RegionYCorner) / RegionYSize) * ImageSize);

		if (IndexX >= 0 && IndexX < ImageSize &&
			IndexY >= 0 && IndexY < ImageSize)
		{
			Buckets[ImageSize * IndexX + IndexY].Sum += Point.Z;
			Buckets[ImageSize * IndexX + IndexY].Count ++;
		}
	}

	Log::Info("Copy to buckets took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:20,代码来源:CBathymetryRasterizer.cpp

示例11: _tmain


//.........这里部分代码省略.........
		{
		iFileLogLevel = eDLNone;
		szLogFile[0] = '\0';
		}

	iProcMode = ProcMode->count ? ProcMode->ival[0] : eProcModeStandard;
	if(iProcMode < eProcModeStandard || iProcMode > eProcModeScore)
		{
		printf("\nError: Requested processing mode '-x%d' not supported",iProcMode);
		exit(1);
		}

	iMinLen = MinLen->count ? MinLen->ival[0] : 0;
	if(iMinLen < 0)
		{
		printf("\nError: Requested minimum length '-l%d' is negative",iMinLen);
		exit(1);
		}

	iMaxLen = MaxLen->count ? MaxLen->ival[0] : 1000000000;
	if(iMaxLen < iMinLen)
		{
		printf("\nError: Requested maximum ength '-l%d' must be >= minimum %d",iMaxLen,iMinLen);
		exit(1);
		}



	strcpy(szRefFile,RefFile->filename[0]);
	strcpy(szRelFile,RelFile->filename[0]);
	strcpy(szRsltfile,Rsltfile->filename[0]);

	if(FilterRefIDFile->count)
		{
		strncpy(szFilterRefIDFile,FilterRefIDFile->filename[0],sizeof(szFilterRefIDFile));
		szFilterRefIDFile[sizeof(szFilterRefIDFile)-1] = '\0';
		}
	else
		szFilterRefIDFile[0] = '\0';


			// now that command parameters have been parsed then initialise diagnostics log system
	if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true))
		{
		printf("\nError: Unable to start diagnostics subsystem.");
		if(szLogFile[0] != '\0')
			printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile);
		exit(1);
		}

	gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %d.%2.2d Processing parameters:",cProgVer/100,cProgVer%100);
	switch(iProcMode) {
		case eProcModeStandard:
			gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode:  Identity = Match/(Match+Mismatch)");
			break;
		case eProcModeIdentity:
			gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode:  Identity = Match/(CoreLength)");
			break;
		case eProcModeAligned:
			gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode:  Aligned = (Match+Mismatch)/CoreLength");
			break;
		case eProcModeScore:
			gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode: score");
			break;
		}

	gDiagnostics.DiagOutMsgOnly(eDLInfo,"reference csv file to process: '%s'",szRefFile);
	gDiagnostics.DiagOutMsgOnly(eDLInfo,"relative csv file(s) to processs: '%s'",szRelFile);
	gDiagnostics.DiagOutMsgOnly(eDLInfo,"results file to generate: '%s'",szRsltfile);
	if(szFilterRefIDFile[0])
		gDiagnostics.DiagOutMsgOnly(eDLInfo,"Exclude any RefIDs in this filter file: '%s'",szFilterRefIDFile);

	gDiagnostics.DiagOutMsgOnly(eDLInfo,"minimum length: %d",iMinLen);
	gDiagnostics.DiagOutMsgOnly(eDLInfo,"maximum length: %d",iMaxLen);

	gStopWatch.Start();
#ifdef _WIN32
	SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#endif
	Rslt = Process((etProcMode)iProcMode,		// processing mode 0: default
					szRefFile,		// reference csv file to process
					szFilterRefIDFile, // exclude any RefIDs in this filter file
					szRelFile,		// relative csv file(s) to processs
					szRsltfile,  	// results file to generate
					iMinLen,		// minimum accepted ref length
					iMaxLen);		// maximum accepted ref length

	gStopWatch.Stop();
	Rslt = Rslt < 0 ? 1 : 0;
	gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit Code: %d Total processing time: %s",Rslt,gStopWatch.Read());
	exit(Rslt);
	}
else
	{
	arg_print_errors(stdout,end,gszProcName);
	arg_print_syntax(stdout,argtable,"\nend of help\n");
	exit(1);
	}
return 0;
}
开发者ID:ste69r,项目名称:Biokanga,代码行数:101,代码来源:ProcessCSVfiles.cpp

示例12: DetectBridgeGroups

void CBathymetryRasterizer::DetectBridgeGroups()
{
	CStopWatch sw;
	sw.Start();

	static vector<vec2i> const Neighbors =
	{
		vec2i(-1, 0),
		vec2i(1, 0),
		vec2i(0, -1),
		vec2i(0, 1),
	};

	int Tag = 1;
	while (TagGroups[Tag].count)
	{
		vector<vec2i> const Group = Helper_GetAllMatchingGroup(Tag);

		bool NextToData = false;
		bool NextToLand = false;
		vec2i LandPt, DataPt;

		for (auto Tile : Group)
		{
			for (auto Neighbor : Neighbors)
			{
				auto Bucket = Helper_GetBucket(Tile + Neighbor);

				if (Bucket)
				{
					if (Bucket->Count > 0)
					{
						NextToData = true;
						DataPt = Tile;
						if (NextToLand)
						{
							break;
						}
					}

					if (Bucket->Tag == -1)
					{
						NextToLand = true;
						LandPt = Tile;
						if (NextToData)
						{
							break;
						}
					}
				}
			}

			if (NextToData && NextToLand)
			{
				break;
			}
		}

		if (NextToData && NextToLand)
		{
			TagGroups[Tag].IsBridge = true;
			Log::Info("      Tag group %d is bridge because {%d, %d} next to Data and {%d, %d} next to Land", Tag, DataPt.X, DataPt.Y, LandPt.X, LandPt.Y);
		}

		Tag ++;
	}

	Log::Info("Detect bridge groups took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:69,代码来源:CBathymetryRasterizer.cpp

示例13: ClassifyGroups

void CBathymetryRasterizer::ClassifyGroups()
{
	CStopWatch sw;
	sw.Start();

	vector<STriangle2D<double>> Triangles;
	AddAtEnd(Triangles, TriangulateEarClipping(CatalinaOutline));
	AddAtEnd(Triangles, TriangulateEarClipping(BirdRock));

	for (int i = 0; i < ImageSize; ++ i)
	{
		for (int j = 0; j < ImageSize; ++ j)
		{
			bool InsideTriangle = false;
			vec2d const Point = vec2d(
				RegionXCorner + ((double) i / (double) (ImageSize - 1)) * RegionXSize,
				RegionYCorner + ((double) j / (double) (ImageSize - 1)) * RegionYSize
			);

			for (auto const & Triangle : Triangles)
			{
				if (ion::IsPointInOrOnTriangle(Triangle.A, Triangle.C, Triangle.B, Point))
				{
					InsideTriangle = true;
					break;
				}
			}

			if (InsideTriangle)
			{
				auto Bucket = Helper_GetBucket(i, j);
				Bucket->Tag = -1;
				Bucket->Count = 1;
				Bucket->Sum = 0;
			}
		}
	}

	int tag = 1;
	TagGroups = new STagInfo[ImageSize * ImageSize]();
	for (int i = 0; i < ImageSize; ++ i)
	{
		for (int j = 0; j < ImageSize; ++ j)
		{
			TagGroups[tag].count = Helper_FillBucketTags(i, j, tag);
			if (TagGroups[tag].count)
			{
				TagGroups[tag].start_x = i;
				TagGroups[tag].start_y = j;
				tag ++;
			}
		}
	}
	tag = 1;
	while (TagGroups[tag].count)
	{
		Log::Info("    Group %d has %d members", tag, TagGroups[tag].count);
		tag ++;
	}

	Log::Info("Classify groups took %.3f", sw.Stop());
}
开发者ID:iondune,项目名称:Aqueous-2.0,代码行数:62,代码来源:CBathymetryRasterizer.cpp

示例14: RunTest

void CTestTlsObjectApp::RunTest(void)
{
    const size_t OBJECT_SIZE = sizeof(CObjectWithNew);
    for ( int t = 0; t < 1; ++t ) {
        // prealloc
        {
            size_t size = (OBJECT_SIZE+16)*COUNT;
            void* p = ::operator new(size);
            memset(p, 1, size);
            ::operator delete(p);
        }
        {
            const size_t COUNT2 = COUNT*2;
            void** p = new void*[COUNT2];
            for ( size_t i = 0; i < COUNT2; ++i ) {
                add_alloc(1);
                add_step();
                p[i] = ::operator new(OBJECT_SIZE);
            }
            for ( size_t i = 0; i < COUNT2; ++i ) {
                add_alloc(-1);
                add_step();
                ::operator delete(p[i]);
            }
            delete[] p;
        }
        {
            const size_t COUNT2 = COUNT*2;
            int** p = new int*[COUNT2];
            for ( size_t i = 0; i < COUNT2; ++i ) {
                add_alloc(1);
                add_step();
                p[i] = new int(int(i));
            }
            for ( size_t i = 0; i < COUNT2; ++i ) {
                add_alloc(-1);
                add_step();
                delete p[i];
            }
            delete[] p;
        }
    }
    //return;
    CStopWatch sw;
    check_cnts();
    for ( int t = 0; t < 1; ++t ) {
        void** ptr = new void*[COUNT];
        sw.Start();
        for ( size_t i = 0; i < COUNT; ++i ) {
            add_alloc(1);
            add_step();
            ptr[i] = ::operator new(OBJECT_SIZE);
        }
        double t1 = sw.Elapsed();
        sw.Start();
        for ( size_t i = 0; i < COUNT; ++i ) {
            add_alloc(-1);
            add_step();
            ::operator delete(ptr[i]);
        }
        double t2 = sw.Elapsed();
        message("plain malloc", "create", t1, "delete", t2, COUNT);
        delete[] ptr;
    }
    check_cnts();
    {
        sw.Start();
        int* ptr = new int;
        sx_PushLastNewPtr(ptr, 2);
        double t1 = sw.Elapsed();
        sw.Start();
        _VERIFY(sx_PopLastNewPtr(ptr));
        delete ptr;
        double t2 = sw.Elapsed();
        message("tls", "set", t1, "get", t2, COUNT);
    }
    check_cnts();
    {
        CObjectWithNew** ptr = new CObjectWithNew*[COUNT];
        for ( size_t i = 0; i < COUNT; ++i ) {
            ptr[i] = 0;
        }
        sw.Start();
        s_CurrentStep = "new CObjectWithNew";
        s_CurrentInHeap = true;
        for ( size_t i = 0; i < COUNT; ++i ) {
            add_step();
            ptr[i] = new CObjectWithNew;
        }
        s_CurrentInHeap = false;
        double t1 = sw.Elapsed();
        check_cnts(COUNT);
        for ( size_t i = 0; i < COUNT; ++i ) {
            _ASSERT(ptr[i]->IsInHeap());
        }
        sw.Start();
        for ( size_t i = 0; i < COUNT; ++i ) {
            add_step();
            CObjectWithNew::Delete(ptr[i]);
        }
//.........这里部分代码省略.........
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:101,代码来源:test_tls_object.cpp

示例15: _tmain


//.........这里部分代码省略.........
	gExperimentID = 0;
	gProcessID = 0;
	gProcessingID = 0;
	szSQLiteDatabase[0] = '\0';
	szExperimentDescr[0] = '\0';
	if(summrslts->count)
		{
		strncpy(szSQLiteDatabase,summrslts->filename[0],sizeof(szSQLiteDatabase)-1);
		szSQLiteDatabase[sizeof(szSQLiteDatabase)-1] = '\0';
		CUtility::TrimQuotedWhitespcExtd(szSQLiteDatabase);
		if(strlen(szSQLiteDatabase) < 1)
			{
			gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no SQLite database specified with '-q<filespec>' option");
			return(1);
			}

		if(strlen(szExperimentName) < 1)
			{
			gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no SQLite experiment name specified with '-w<str>' option");
			return(1);
			}
		if(experimentdescr->count)
			{
			strncpy(szExperimentDescr,experimentdescr->sval[0],sizeof(szExperimentDescr)-1);
			szExperimentDescr[sizeof(szExperimentDescr)-1] = '\0';
			CUtility::TrimQuotedWhitespcExtd(szExperimentDescr);
			}
		if(strlen(szExperimentDescr) < 1)
			{
			gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: After removal of whitespace, no SQLite experiment description specified with '-W<str>' option");
			return(1);
			}

		gExperimentID = gSQLiteSummaries.StartExperiment(szSQLiteDatabase,false,true,szExperimentName,szExperimentName,szExperimentDescr);
		if(gExperimentID < 1)
			return(1);
		gProcessID = gSQLiteSummaries.AddProcess((char *)gszProcName,(char *)gszProcName,(char *)szExperimentDescr);
		if(gProcessID < 1)
			return(1);
		gProcessingID = gSQLiteSummaries.StartProcessing(gExperimentID,gProcessID,(char *)cpszProgVer);
		if(gProcessingID < 1)
			return(1);
		gDiagnostics.DiagOut(eDLInfo,gszProcName,"Initialised SQLite database '%s' for results summary collection",szSQLiteDatabase);
		gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database experiment identifier for '%s' is %d",szExperimentName,gExperimentID);
		gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database process identifier for '%s' is %d",(char *)gszProcName,gProcessID);
		gDiagnostics.DiagOut(eDLInfo,gszProcName,"SQLite database processing instance identifier is %d",gProcessingID);
		}
	else
		{
		szSQLiteDatabase[0] = '\0';
		szExperimentDescr[0] = '\0';
		}

	PMode = mode->count ? mode->ival[0] : 0;
	if(PMode < 0 || PMode > 1)
		{
		gDiagnostics.DiagOut(eDLFatal,gszProcName,"Error: Processing mode '-m%d' must be in range 0..0",PMode);
		return(1);
		}

	strcpy(szInPE1File,inpe1file->filename[0]);
	CUtility::TrimQuotedWhitespcExtd(szInPE1File);

	strcpy(szInPE2File,inpe2file->filename[0]);
	CUtility::TrimQuotedWhitespcExtd(szInPE2File);
开发者ID:ste69r,项目名称:Biokanga,代码行数:66,代码来源:PEscaffold.cpp


注:本文中的CStopWatch::Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。