Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, I need a way to know the memory consumption in a C# project, I'm doing a 8-puzzle solver using WPF as the user Interface and C# as my language, I already solve the entire puzzle using BFS and DFS, both because I need to compare the time and memory consuptions between them solving the same puzzle and show the results in a new window, if anyone of you know any kind of library or technic to do this, please, need your help, thanks
Posted

1 solution

Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
long totalBytesOfMemoryUsed = currentProcess.WorkingSet64;
/ravi
 
Share this answer
 
Comments
Cesar Bretana Gonzalez 15-Sep-14 14:40pm    
thanks, already got the memory usage, but how can i get the time of the algorithm?
Ravi Bhavnani 15-Sep-14 15:10pm    
You could use a Stopwatch to time code execution. Although the right way to instrument is to use a profiler.

/ravi
Sergey Alexandrovich Kryukov 15-Sep-14 21:16pm    
Stopwatch is good enough for many cases. My 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900