How to get running time and used memory of an process in C# using Process class?

I am working on an online judge recently.and the very important function is  to get the running time and used memory of the user's programme.I know there's a Process class in C#. and i can start an exe using this class,along with additional parameters.The class also provides the ability to get the memory of the running process and running time.But the  problem is,there're types of defined memory in this class:paged memory,unpaged memory,working set,...etc.which is the real memory the programme take?The same problem goes with time.there's user time and cpu time in process class of which i am confused.which time should i choose?There's another  problem:all info of the programme is returned when it's still running,and when the programme exits,we cannot get anything.But the online judge just requires the time and memory(esp. time,as to memory,we just need peak memory used during execution) after the programme exits.So is it proper to use this method to get the time and memory?Or anyone knows a better way to do this?I'd really appriciate your help!
 


Work hard~~~
0
inte_sleeper
11/15/2006 9:44:04 AM
asp.net.free-for-all 9281 articles. 0 followers. Follow

0 Replies
1274 Views

Similar Articles

[PageSpeed] 43
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

FileInfo Class: The process cannot access the file because it is being used by another process
I wasn't sure which forum to put this under since there is nothing for system.IO so I just ended up sticking it in here. Problem: I'm trying to create a very simple script that will allow admins/useres to change images on the fly with a input control. The script works fine when no image already exist, but when you go to upload a new image and delete the old, it states that the file is already used by another process, and I can't do anything for about 5-10 min before it is unlocked. Code:1 If int32.parse(session("access").toString) < 50 Then 2 If NOT fi.Exi...

Memory Used by a Process (or Memory Avail)
Does anyone know the best way to determine (using Power++) how much memory is currently used or available for the system. What I am actually trying to do is do a difference on memory in order to see how much memory is being consumed by a datawindow as it runs (it seems to suck up memory). Thanks. DonL You aren't going to believe this but the dw has a property that will do this already. This is the code that will work in Powerbuilder dw_1.Describe("DataWindow.Storage"). See "Storage DataWindow object property" in the online help. (At least that...

Powersite Use Hard Disk or Memory to run process ?????
Hi there, We are having a tough time running powersite on a machine, everything works fine till powersite is down , Once we load the Powersite it takes lots of time to load with a heavy usage of hard disk (HD). Also if we type a single word or move mouse in Powersite developement window, it keeps using HD heavily , which creates lots of HD access noise aswell as slow down the machine too. Is this some registry problem or know bug with powersite. It happens only with Powersite, other application (jaguar, PB, PD ) runs fine. Thanx Salim One thing that can cause PowerSite t...

The process cannot access the file "c:\sample.txt" because it is being used by another process.
hi I got this error while executing following code 2nd time. First time it works perfectly. public void Button1_Click(object sender, System.EventArgs e) { string flag="P"; string strOutPut; string newLine; Stack stTitle=new Stack(); string fileName="c:\\sample.txt"; WebClient myClient=new WebClient(); Stream sr=myClient.OpenRead(txtUrl.Text.Trim()); StreamReader objreader=new StreamReader(sr); StreamWriter sw=File.CreateText(fileName); Regex rg=new Regex("<(.|\n)+?>",RegexOptions.IgnoreCase); while ((newLine=objreader.ReadLine())!=null) { strOutPut=rg.Replace(newLine,...

problem in binding a text box with datagrid at run time using web forms using C#
the code below is working properly. in this code 2 times(timeIn and timeOut) are subtracted and the result is bound to a datagrid(dbgMyGrid), what i want is that now the value (difference of both times) should also bound with a textbox control.  or inspite of binnding the SQl Squery result with datagrid(dbgMyGrid) it should directly bound to a textbox. Any of the result is appraicated. this.lblEmpTimeOut.Text=DateTime.Now.ToShortTimeString();SqlConnection myConnection = new SqlConnection("server=WAHEED;uid=sa;pwd=waheed;database=HRMS_EMPLOYEE");SqlCommand myCommand = ne...

Export data to Excel, get the error "The process cannot access the file ... because it is being used by another process"
Hi, Well, I hope this is the right forum, I didn't find one related to generating excel files dynamically. I'm having the error I mentioned, it happens when I get an oledb connection to send data to an excel file. The problem arises when I generate large files and not with small files. So, I assume with this that the code is fine, because it works most of the times. I tried to isolate the problem, so now I'm just generating the file on the server and I'm not even sending it to the client. This is what I'm doing: Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"...

(VB) The process cannot access the file 'C:something/something.jpg' because it is being used by another process.
I found articles about this error but none mentioned the situation where the very first action the code takes (or so I believe) shuts down the program as if something else had previously happened to tie up the file. The code below is very short, two controls on the ASPX page and only two lines of code behind.  The first one causes the error: PictureUploadControl.SaveAs(Server.MapPath("~/images/ORIGINAL") & PictureUploadControl.FileName) Please find, if possible, in the code below what error is causing a denial of file access.  Thank you for your help. The an...

Stop process used by another process
 Hi,In a loop.  I have created a batch(.bat) file which process (updates) a text (.txt) file through C#.net after  creating .bat file runs and it updates .txt file. when loop return for second timeagain a batch file is created and when it execute (process) the text file gives an errorerror Message : the process cannot access the file because it is used by another process  But when I trace the code and run then even second or n number of times, it runs fine.even i used Thread.Sleep(10000) No use. how can I stop .txt  process in C#.net    I thing ...

What does this mean process being used by another process ???????
I'm building this ASP.NET webapplication using VB.NET as code behind file.I tried adding text to an already exsisting .txt file and also i tried creating a new .txt file and adding and reading text from that file.(importing system.IO)I tried placing that file in different folders but the problem reamined the same as shown below(for wwwroot location)as an exception stating "The process cannot access the file "path" because it is being used by another process." What actually does that mean? The process cannot access the file "D:\Inetpub\wwwroot\ticket\Ne.txt" because it is being used by anoth...

Use of SFTP::Foreign with backend processing and having problems ( not apparent within the code ) in getting remote SFTP to quit it's processes
I am running AS 5.10.1 on Windows XP SP3 and attempting to use sFTP within my processing communicating to MVS/IBM. What I am trying to do is to do so many gets, then undef the variable and re-login and to continue on to end of processing. I did this with the FTP processing and never had any problems. What I am seeing is when I do the above and go through the login/undef say three times, it has the remote processes all still open. If I run through 5 times, then I have five processes open. But if I close the script completely, then all the processes quit as expected. How would ...

PLease help getting error as The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End  I generated local mode report but as there was no printing option available . I assign printing feature to button click by exporting the data to EMF format and print Now when I run it through IDE VS2005 then it does not show any error. But when I run in through IIS in intranet it showing me this error   The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process Where I am going wrong pl...

PLease help getting error as The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process #2
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End  I generated local mode report but as there was no printing option available . I assign printing feature to button click by exporting the data to EMF format and print Now when I run it through IDE VS2005 then it does not show any error. But when I run in through IIS in intranet it showing me this error   The process cannot access the file 'D:\Inventracksys\Inventorytracking Vendorwisereport_1.emf' because it is being used by another process Where I am going wrong pl...

AJAX: How to get xml data using XMLHTTP.responseXml where xml data processed in C# code
Hi All, I am trying t retrieve data from an xml file on server side using Ajax: How to get xml data using XMLHTTP.responseXml  where xml data processed in C#  as:- C# part xmldoc.Load(xmlfile);this.Response.ContentType= "text/xml"; this.Response.Write(xmldoc); --- AJAX- Javascript part is ---if(XMLHTTP) { XMLHTTP.onreadystatechange = function() {if(XMLHTTP.readystate==4 && XMLHTTP.status == 200){ var xmlDoc = XMLHTTP.responseXml; //********  HERE THIS IS NOT RETRIEVING THE xml data instead this brings  XMLHTTP.responseText data *...

Web resources about - How to get running time and used memory of an process in C# using Process class? - asp.net.free-for-all

Running - Wikipedia, the free encyclopedia
This article is about the type of locomotion in humans. For running in horses, see Horse gait . For locomotion in dogs, see Gait (dog) . For ...

Jarryd Hayne in frame after injury to San Francisco 49ers running back Shaun Draughn
&#8203;The San Francisco 49ers' running back injury curse has struck again and it could elevate Jarryd Hayne back into the beleaguered NFL team's ...

Flemington rail won't be used - running trains will slow train system: Andrews government
Neighbours fear gridlock as Andrews government says no to regular train services from Flemington Racecourse.

Meet the 17-Year-Old Running a Profitable Agency out of His Prep-School Dorm Room
Marketing exec Max Baron has a jam-packed day. Today, he's reaching out to five clients, facilitating a mailing giveaway, planning his firm's ...

HILLARY AND THE U.N.: Your 2016 Democrat Running Mates
By Anne Bayefsky Islamic activists say 9/11 and San Bernardino were terrible — because of their effects on Muslims. O ver at the United Nations, ...

Running back LeSean McCoy the lone Pro Bowl selection for Bills
LeSean McCoy's first season with the Buffalo Bills will end with a trip to the Pro Bowl. Maybe. The running back was the lone member of the team ...

This guy turned his running routine into awesome 'Star Wars' drawings
Portland's Gene Lu has been using the Nike+ app to turn his running routine into an outlet for his love for "Star Wars." The app lets you trace ...

Dickerson: Sanders running out of time to close gap with Clinton - Videos - CBS News
John Dickerson, CBS News political director and host of "Face the Nation”, considers whether Bernie Sanders is running out of time to close the ...

Putin to be Donald Trump's running mate, mock John Kasich press release says - CNNPolitics.com
Donald Trump has revealed his running mate, and it's Russian President Vladimir Putin.

Williams-Sonoma Wasn’t Really Running A ‘Buy One Knife, Get 99 Free’ Sale
Some of our readers experience a modern moral dilemma: they order an item online, and multiple duplicates of that item appear on their doorstep. ...

Resources last updated: 12/25/2015 6:49:13 PM