Jump to content
Sign in to follow this  
wowo

Time taken to open the application

Recommended Posts

Hi guys,

I have to check time taken to open the application (one is on c# and another is written on c++), how can I do so?

Thanks in advance.

Share this post


Link to post
Share on other sites
50 minutes ago, wowo said:

Hi guys,

I have to check time taken to open the application (one is on c# and another is written on c++), how can I do so?

Thanks in advance.

You must have put before a timer on your C# and C++ application so it become possible.

Share this post


Link to post
Share on other sites

C++

#include <iostream> 
#include <time.h> // header for clock()
#include <windows.h> // header for sleep()
using namespace std;

int main()
{
	// Start the timer in the top of main() or winMain()
	clock_t t = clock(); 

	/*Code block with all code that the program has to run before starting*/ 
	Sleep(5000);
	/*End of code block*/

	// Get the time taken to start
	t = clock() - t;
	cout << "Time taken to start in seconds: " << ((float)t) / CLOCKS_PER_SEC << endl;
	
	return 0;
}

I hope this is what you were looking for.

  • Like 2

Share this post


Link to post
Share on other sites
6 minutes ago, Snre3n said:

C++


#include <iostream> 
#include <time.h> // header for clock()
#include <windows.h> // header for sleep()
using namespace std;

int main()
{
	// Start the timer in the top of main() or winMain()
	clock_t t = clock(); 

	/*Code block with all code that the program has to run before starting*/ 
	Sleep(5000);
	/*End of code block*/

	// Get the time taken to start
	t = clock() - t;
	cout << "Time taken to start in seconds: " << ((float)t) / CLOCKS_PER_SEC << endl;
	
	return 0;
}

I hope this is what you were looking for.

Thank you, will check it out today.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...