cpu time

Hi,
Can you tell me about good tool for vs-6 that can tell me what functions in
my application take the most cpu time?

Thanks!


0
Dave
1/9/2005 8:59:14 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
1304 Views

Similar Articles

[PageSpeed] 23

In article <u$YZa3o9EHA.2680@TK2MSFTNGP09.phx.gbl>, dbg@012.net.il 
says...
> Hi,
> Can you tell me about good tool for vs-6 that can tell me what functions in
> my application take the most cpu time?

VS 6 includes a perfectly good profiler, which does exactly this. If 
you're working inside the environment, go to the link tab in the 
project settings, and click the "enable profiling" check box, then do 
a 'rebuild all' to generate an executable with profiling enabled. To 
collect the profile data, click 'profile...' on the build menu. It'll 
pop up a dialog asking what kind of profile you want, but defaults to 
a function timing profile, which is what you're asking for, so just 
click okay to let it run.

Be aware that your code will run slower when being profiled (because 
the profiler is constantly interrupting it to collect the data). When 
the run is done, the profile data will be in the profile output 
window at the bottom of the main environment window.

The VS profiler can really do quite a bit more than this, but I've 
rarely had a need to do so. If I need to do much more than this, I 
usually use Intel's Vtune profiler instead -- it can gather more data 
than I've ever had a use for and display it in all sorts of whizzy 
graphs and such, in case you need to make a presentation to superiors 
or something like that...

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
0
jcoffin1 (194)
1/10/2005 4:45:57 AM
How should I use those outputs profiler generates?
Is there any staring guide for beginers...
MSDN only says how to use them.
--
_______________________________________________________________________
"Jerry Coffin" <jcoffin@taeus.us> wrote in message
news:MPG.1c4bb6655a2f92fa9897c1@msnews.microsoft.com...
In article <u$YZa3o9EHA.2680@TK2MSFTNGP09.phx.gbl>, dbg@012.net.il
says...
> Hi,
> Can you tell me about good tool for vs-6 that can tell me what functions
in
> my application take the most cpu time?

VS 6 includes a perfectly good profiler, which does exactly this. If
you're working inside the environment, go to the link tab in the
project settings, and click the "enable profiling" check box, then do
a 'rebuild all' to generate an executable with profiling enabled. To
collect the profile data, click 'profile...' on the build menu. It'll
pop up a dialog asking what kind of profile you want, but defaults to
a function timing profile, which is what you're asking for, so just
click okay to let it run.

Be aware that your code will run slower when being profiled (because
the profiler is constantly interrupting it to collect the data). When
the run is done, the profile data will be in the profile output
window at the bottom of the main environment window.

The VS profiler can really do quite a bit more than this, but I've
rarely had a need to do so. If I need to do much more than this, I
usually use Intel's Vtune profiler instead -- it can gather more data
than I've ever had a use for and display it in all sorts of whizzy
graphs and such, in case you need to make a presentation to superiors
or something like that...

--
    Later,
    Jerry.

The universe is a figment of its own imagination.


0
playwin (34)
1/10/2005 12:53:42 PM
On Mon, 10 Jan 2005 18:23:42 +0530, "playwin"
<playwin@discussions.microsoft.com> wrote:

>How should I use those outputs profiler generates?
>Is there any staring guide for beginers...
>MSDN only says how to use them.

The only thing I have ever used the profiler for is locating functions
that need further optimization. The defaults, as Jerry suggested, are
all I've ever needed. 


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
1/10/2005 1:23:57 PM
I've not used the profiler, but you always need to pay attention not just to which
functions are using the most time, but WHY. Example: I had hand-tuned our storage
allocator until it was the fastest possible storage allocator ever seen. The compiler
group came back to me and said "we profiled the compiler and most of the time is being
spent in your allocator". So I sat down, tweaked a boolean variable with the debugger, and
had my allocator collect its own performance statistics. It was called something like
4,000,000 times! If you call a function 4,000,000 times, it is likely to be the one using
most of the time. It turns out some clever programmer had written a subroutine that did a
malloc and free in the function, and that function was called 2,000,000 times. First
question: why was it being called so often? Second question: why did it need to allocate
and free each time?

When the architectural problems were fixed, the performance improved dramatically. Let
this be a warning: optimize architecture before worrying about lines of code.
					joe

On Mon, 10 Jan 2005 13:23:57 +0000, steve@tropheus.demon.co.uk wrote:

>On Mon, 10 Jan 2005 18:23:42 +0530, "playwin"
><playwin@discussions.microsoft.com> wrote:
>
>>How should I use those outputs profiler generates?
>>Is there any staring guide for beginers...
>>MSDN only says how to use them.
>
>The only thing I have ever used the profiler for is locating functions
>that need further optimization. The defaults, as Jerry suggested, are
>all I've ever needed. 
>
>
>Steve

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
1/13/2005 5:45:50 AM
On Thu, 13 Jan 2005 00:45:50 -0500, Joseph M. Newcomer
<newcomer@flounder.com> wrote:

>I've not used the profiler, but you always need to pay attention not just to which
>functions are using the most time, but WHY. 

(snip example)

>When the architectural problems were fixed, the performance improved dramatically. Let
>this be a warning: optimize architecture before worrying about lines of code.
>					joe
>

The same sort of trouble would be found using the profiler in one run.
It's worth using just to find unnecessary repeat calls. Lines of code
rarely need any attention once the multiple calls are sorted. The
documentation makes profiling seem quite complicated but it really
only needs one special build and one run. 


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
1/13/2005 12:45:54 PM
In article <uNh7EMx9EHA.2568@TK2MSFTNGP10.phx.gbl>, 
playwin@discussions.microsoft.com says...
> How should I use those outputs profiler generates?
> Is there any staring guide for beginers...

I'm not aware of one. The basics are pretty straightforward though -- 
you get a column telling how often each function was called, and what 
percentage of the total time that function took by itself, and what 
percentage it took including everything else it called.

The call count has a couple of uses -- if you have an idea of how 
often something should be called, it lets you check that it's only 
getting called about as often as you expect. It also lets you ensure 
that things that should balance do -- e.g. if you have more calls to 
a function to allocate a resource than to free that resource, you're 
probably looking at a resource leak.

The percentage of time spent in a function gives you an idea of how 
worthwhile it is to optimize that routine -- if a particular routine 
is only taking (say) 2% of the time to start with, then the most you 
can hope to save by optimizing it is 2%, so chances are you won't 
look too hard at that code. Some other code might seem a lot more 
boring but if the CPU is spending 95% of the time executing that 
code, then a big improvement means one of two things: either make 
that code faster, or else execute it less often.

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
0
jcoffin1 (194)
1/17/2005 5:50:49 AM
Reply:

Similar Artilces:

Run-time error '429' ActiveX component can't create object
Hi I have an application running in Access 2003 that is trying to open a second Access application and get the following error Run-time error '429' ActiveX component can't create object The references all seem OK - I have references to Visual Basic for Applications MS Access 10.0 Object Library MS DAO 3.6 Object Library MS ACtiveX Data Objects 2.1 Library OLE Automation My code is as follows Dim acApp As Access.Application Dim strDBPath As String strDBPath = "C:\NewAppName.mdb" Set acApp = New Access.Application With acApp ..OpenCurrentDatabase strDBPath ..DoCmd.O...

How to know CPU usage programmically.
Hi all, I want to analyze performance of my Application. Now I'm searching for an API which gives me the current CPU usage, in programmically. int nCPUUsage = GetCPUUsage(); // GetCPUUsage() return current CPU usage Please help me is there any API or way for fiunding this. Thanks in advance. As far as I know there is no single function that returns the actual CPU usage. That being said the Performance Counters reference in MSDN is the place to look. First open a performance query with PdhOpenQuery. Then create and set the counter path with PdhMakeCounterPath and PdhAddCounter...

kernrate and cpu
I have installed process explorer and kernrate to determine why my cpu is 100% I can access process explorer but I cannot access kernrate even though it is installed and I have an icon...what is wrong? On Nov 24, 12:04=A0pm, dec <decsep...@gmail.com> wrote: > I have installed process explorer and kernrate to determine why my cpu > is 100% > I can access process explorer but I cannot access kernrate even though > it is installed and I have an icon...what is wrong? Were you unable to diagnose the issue with just Process Explorer? On Nov 24, 4:04=A0pm, Jose <j...

sorry for posting 3 times it returned an error the first two
Sorry for posting 3 times it returned an error the first two and now it appears the error didn't matter. - DaveR ...

presenting quarterly time series data
I chart many time series of data, usually annual, financial year, monthly or quarterly. Monthly data chart well with time series on the x axis. For example, setting the major unit to 12 months and minor to 1 generates a neat x axis with a minor tick mark next to each data point, and a major tick mark plus label every 12 months (eg chart 1 in attached). I want to replicate this effect for quarterly data, with a minor tick mark next to each data point, and a major tick mark and label at regular intervals (mot necessarily annual). I understand that it is not possible to chart quarterly data in...

high CPU usage on systray icon
I've made a software placed in the systray when reduced. When i put the mouse pointer on his systray icon, the cpu usage rise up to 50%, just placing my mouse over the icon ! here is my src used to detect activity on my systray, what's wrong ? LRESULT CTitreurDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // Open window when double click to the Systray Icon if(message == MYWM_NOTIFYICON){ switch (lParam){ // Si on a un click case WM_LBUTTONDOWN: switch (wParam) { // sur l'icone de la systray case IDR_SYSTRAY: // on simule le click s...

Time Division
I've searched everywhere for a solution to these time problems. 1) In a column are a series of times (>100) that are in the hundreds of hours (time formatted [hh]:mm:ss), I -cannot- SUM this column, so I had to write a custom function for it. Other columns with lesser time values SUM() properly. Sample of the data: 244:11:30 224:58:13 112:24:10 ...etc... Why does SUM not work with large time values? 2) I also need to divide that large time value by a whole number, eg [FONT=courier new]=21519:51:56/1885[/FONT] I cannot figure out how to make this happen! TIA. --- Message poste...

Online Maintenance wrog times
My exchange servers are performing online maintenance at the same time everyday but they are not the times I set in the custom schedule. I don't have them in a system policy, they never complete and I never get 1221. I don't see any additional policies in ADSI edit. Any insight? Thanks Hi Check the maintenance interval set on your information stores (Right click properties on an informations store | Database tab | Maintenance Interval ) This is a different setting from Server Mailbox Management. Regards -- Ben Hoffman MVP Exchange http://www.exchangeis.com "Rp" <...

Outlook 2000 shuts down several times each day without notice.
Outlook 2000 has begun shutting down several times a day with no error messages or notices. Check your application event viewer. Try running Detect and Repair from the Help menu (you may need your installation disk for that), try checking the size of your PST (Outlook 2002 and older have a size limit of 2 GB), try repairing your PST. http://www.howto-outlook.com/faq/aboutpst.htm "Rob from VA" <Rob from VA@discussions.microsoft.com> wrote in message news:FB9F7D1A-D5CD-4D6A-9FF4-F631E90482F9@microsoft.com... > Outlook 2000 has begun shutting down several times a...

Winsock2 connect taking long time to timeout
Hi, I have a situation whereby when I call to the Winsock2's connect() function, it takes a long time to respond back. This causes my CPictureEx animated GIF to show hanging on the screen. I'm thinking of creating a thread for the connect() function call so that it will not hang my animated GIF. Can anyone show me how to go about doing that? TIA. Rgds, Mike Hi mike , Hope the following code snippet will help you .Please do read more abt CreateThraed API in MSDN where u can get good samples of thread implementations. InitialzeThraed() // User Defined Method { DWORD d...

Showing Appointment times
Outlook 2003 SP2 XP2 / SP2 A user enters appointments into the calendar. In DAY view, some of the completed entries show the time of the appointment and others do not - these items were entered one right after the other on the same day, and on the same day of the month (one at 8:00 am the other at 2:30 pm). (In month and week view, the appointment time displays on all entries.) Can you shed any light on how/why this might happen and how we can fix it? Thanks MUCH in advance!!! C.H. *tap* *tap* *tap* - Is this thing on? Can anyone help me with my question? ...

Windows Time
Afternoon all, My DC (windows 2003 R2) running the PDCe role couldn't sync with time.windows.com and I've now got mismatched times on other servers. After doing some checking I notice that under HKLM\system\services\currentcoltrolset\w32time that some server have time.windows.com,0x1 as the NtpServer - is thi sby deault, of has hapenned since my issues? Should I correct this key? My understanding is that devices sync with local DC, local DC syncs with PDCe, PDCe syncs with external time source (in this instance time.windows.com) Hello Andrew, If you have ...

100% CPU by using filter in Excel
An employee tried to use filter in one special table and the PC did nee 100% CPU time and work more than 15 min. I checked it with other PC. The table is working and PC use only abou 50% CPU and need about 3 min to finish the job. I installed the last SP3 for office XP and it is not solved th problem. The employee has German OS and english office. Has anyone an idea? Please help -- languate ----------------------------------------------------------------------- languatec's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2654 View this thread: http://www.excelforum...

adding decimal time
I have access database that keeps track of time spent performing a task. I export the table to excel and attempt to add the “time_spent” (Decimal) column as hours/minutes. The problem is how I add this decimal column and it treat the answer as time? Example; 1.20 would be 1 h 20 m ..45 would be 45 m But when I add this it returns 1.65 instead of 2.05 Hi To Excel, Access, SQLserver, Windows, MacOS, .... 1.2 is 1.2 days, not 1.2 hours. Better than fight it, why not use the native time format 1:20 and avoid all those problems ? See http://www.cpearson.com/excel/datetime.aspx for theory on...

CPU Usage
When I checked my exchange server today I noticed it was running very slow. I opened task manger and under processes tap I noticed that the Inetinfo.exe using 100% of the CPU. I am not sure if this is a one time thing or it is a reoccurring thing. This email server has been running great for a long time. Make sure you have all the critical patches from Windows Update. Is it running normal now? -- Hope that helps, Dan Townsend This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send email to this address, post a reply to t...

cpu
error code723729147`32043094835085459145845197415481305883`48`3257356743368137513 On Thu, 13 May 2010 15:30:19 -0700, "lane" <harry888844@gmail.com> wrote: >error >code723729147`32043094835085459145845197415481305883`48`3257356743368137513 > Do you have a question about Microsoft Access databases, Lane? If so please use the textbox to post it in a comprehensible way. We're all unpaid volunteers here and your message isn't going to get any useful answers if nobody has any idea what you're asking. -- John W. Vinson [MVP...

chart
Is there a way to graph mixed times series information (i.e. monthly data for 6 months that continues in biweekly increments) without coding involved? ...

Outlook 2000 crashing all the time
My Outlook 2000 (sp3 9.0.0.6627) is just shutting down by itself. It juststarted happening. I haven't installed or added anything to Office or my PC. The newest thing was SpamFighter which hooks onto Outlook--and that was 2 months ago. The "shutting down" has started in the last couple days. I've reinstalled it and at first that seemed to work--but then the shutting down resumed. Any ideas? What is logged to the Event Viewer regarding this? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Creating Signatures -Create an Office XP CD slip...

Refreshing all data imports on different sheets from the same file at the same time
I am importing a text file that has a lot more than 256 columns. The data will be updated weekly with a different text file. I know how to get past the 256 column limit when importing a text file like this. This link explains the method I am using to import the text file. http://office.microsoft.com/en-gb/as...548201033.aspx Since I am importing onto several sheets I get the dialogue box asking me to choose a file to import from for every sheet when I use RefreshAll. The same file that is used by the first sheet will be used by the rest of the sheets. Each sheet just imports a different sectio...

how do I record track meet times #2
how do I record times for track meets It would help if you would provide some details! >-----Original Message----- >how do I record times for track meets >. > ...

Calc. Length of time with time-in, time-out, date-in, date-out in diff. columns
I need to calculate total length of time in hours:minutes:seconds. ColumnA: Arrive date in M/D/YYYY ColumnB: Depart date in M/D/YYYY ColumnC: Arrive time in H:M:Seconds ColulmnD: Depart time in H:M:Seconds I can't figure out how to get my formulas to look at BOTH date AND TIME & arrive at a total length of time that honors a period over 24 hours. I know I can format [H], and I've looked at other formula pieces, but I'm unable to get all four pieces above to connect. How do I do that? Nic. --- Message posted from http://www.ExcelForum.com/ Hi use the following for...

Subtract times (dates)
Hi, I have been asked to put a timesheet togther for wafes caluulation in a small business. There are night shifts involved and whilst i can get one column to subtract from the adjacent column (start time / finish time) i cannot make it do it when the start time is say 19:00 hours an a monday eve and the finish time is 07.00 hours on the tuesday morning .... anyone any ideas ? Many thanks Garry On Sun, 18 Nov 2007 11:39:33 -0000, "Garry Kennedy" <garrykennedy@pobox.com> wrote: >Hi, > >I have been asked to put a timesheet togther for wafes caluulation in a...

Mobile using up CPU
Hi there Since we installed CRMMobile our (new) server has been SO SLOW! SqlServer is taking anywhere from 69 - 99% cpu time (mostly around 99) I have run sql profiler and discovered that many times a second the following transactions are running: exec sp_executesql N'SELECT recipientAddr,recipientSrvcPort,sourceAddr,sourceSrvcPort, MIN(arrivalDate) as minArrivalDate, count(*) as messageCount FROM vwInBoundQueue WHERE recipientAddr=@recipientAddr AND recipientSrvcPort=@recipientSrvcPort GROUP BY sourceAddr,sourceSrvcPort,recipientAddr,recipientSrvcPort ORDER BY minArrivalDat...

Convert times to text string
In adjacent cells (A1 and A2) I have formatted start/stop times showing as 7:00 AM and 5:30 PM. In cell A3 I want concantenated text to appear as "7:00am-5:30pm". So far this formula > =TEXT(HOUR(A1),"0")&":"&TEXT(MINUTE(A1),"00")&IF(HOUR(A1)<12,"am-","pm-")&TEXT(HOUR(B1),"0")&":"&TEXT(MINUTE(B1),"00")&IF(HOUR(B1)<12,"am","pm") gives 7:00am-17:30pm. I want the 17:30pm to appear as 5:30pm Please help, I haven't quite cracked this ...

Calculating time #3
I know this question has been asked before, but the answers that I have found do not seem to work for me for some reason. I am probably doing something wrong. What I need to do is calculate hours worked for the day. I have set up a spreadsheet to include the following: C3 is the time in D3 is the time out E3 is .5 hours (this is lunch) F3 is the total number hours worked for the day. The formula I have put in this cell is: =HOUR(D3-C3)-E3 [this is exactly how the formula is typed in] Now, if someone put their time in as 7:30 a.m. and their time out at 4:00 p.m. and they take the .5...