7

I've read a lot of the posts here giving profiling advice but I need to ask this.

From what I can tell, Visual C++ Express doesn't generate a debugging file that is used by profiler programs. I tried AMD Codeanalyst and it seemed to work fine except none of the routines in my program were identified -- just a lot of "unidentified modules".

I'm new to C++. I'm used to the simple profiler used by Python. Simple, I assume, because the language is interpreted.

I appreciate any insights.

P.S.: Is the rotation of the steering wheel the derivative of the rotation of the car?

jbatista
  • 2,747
  • 8
  • 30
  • 48
Peter Stewart
  • 2,857
  • 6
  • 28
  • 30
  • 1
    For serious development, you must either pay the Microsoft tax or switch to an open platform. Visual Studio Express is just a sample to get you hooked. As for the ps: I doubt it; the angle of the wheels will affect the friction with the road in a nonlinear way. – Mike Seymour Jun 22 '10 at 21:18
  • Can you recommend an open source similar, or as capable as Visulal Studio for c++? – Peter Stewart Jun 23 '10 at 17:16
  • 1
    I'm too much of a luddite to use an IDE, so I can't recommend anything myself; my preferred environment of a shell, the GNU tools and a basic source editor won't be to everyone's taste. I've heard people talk about Eclipse and Codeblocks, but I've no idea if they're any good, or how they compare with Visual Studio. – Mike Seymour Jun 24 '10 at 17:44
  • 1
    Regarding the "unidentified modules" problem - did the program you were profiling contain debug symbols? The profiler will need them to identify the functions. There should be a build option to include or remove these. – Mike Seymour Jun 24 '10 at 17:47
  • @Mike. I'll have a look at using the bare bones. You end up having to figure them out anyway as the IDEs I've come across (MS excluded) use them to compile,link,debug etc. Thanks for your responses. – Peter Stewart Jun 25 '10 at 21:58

3 Answers3

7

First, the polar angular velocity of the car should be proportional to the speed of the car and to the angular position of the steering wheel (to a first approximation).

Second, there's hardly a professor or blogger or book author who will tell you this, but if you want to see what the code is doing and optimize it, the hands-down simplest way is this.

Added: Programmers have a strong tendency to assume that any automated profiling tool will do a better job than the manual technique, but that depends on the details of exactly what they do. Most of them implement what's popular rather than what is most effective. The result is some performance problems being missed, putting a cap on the speedup you can get. Here is a list of common misconceptions that result in failing to find performance problems.

Some profilers do get it nearly right, including RotateRight/Zoom and LTProf.

Community
  • 1
  • 1
Mike Dunlavey
  • 40,059
  • 14
  • 91
  • 135
  • I don't know about professors, bloggers or authors, but that's exactly how oprofile for linux works. Although the sampling is done automatically, many times a second. – Mike Seymour Jun 22 '10 at 23:21
  • @Mike Seymour: You might think so, but it's pretty complicated, and following the doc, it appears to suffer from many of the issues outlined here: http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343 – Mike Dunlavey Jun 23 '10 at 00:42
  • 1
    @Mike Seymour: ... It needs to 1) get random stack samples of a thread even during I/O, 2) be able to ignore samples during user input or better let user control sampling by hot-key, 3) report per line (not per function) percent of samples containing that line (ignoring recursion), 4) ideally let user see individual stack samples. Finally, samples need not be taken in large numbers or at high frequency. In fact, **lsstack** is a perfectly useful way to take them. – Mike Dunlavey Jun 23 '10 at 00:50
  • @Mike Seymour: ... For example, any problem whose elimination would save 10% or more of execution time can be found pretty reliably in 20 samples. Not measured accurately - *found* accurately. – Mike Dunlavey Jun 23 '10 at 01:07
  • Yeah, pausing is a surprisingly effective technique. I've fixed several slow processes this way. – Steven Fisher Jun 23 '10 at 14:25
  • @tewha: Right. I've tried building tools to semi-automate this (along the lines of Zoom), but there's something about getting your fingers right in the code that can't be beat, like being able to read the *why* right off the stack, or being able to see variables as well as the stack. – Mike Dunlavey Jun 23 '10 at 14:42
  • +1 very clever way indeed, the efficiency of my code greatly increased when I stopped using profilers.. ("there's something about getting your fingers right in the code that can't be beat", I second that!) – codelidoo May 17 '12 at 01:48
0

Are you sure? IIRC, Visual Studio Express can create the .PDB file, though you might have to ask it to generate debugging information for you if you are using a release build. (It has to -- otherwise Visual Studio's debugger wouldn't work!)

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
0

It isn't hard to write your own profiler. Or you could pick up an open source that has some testing behind it. You might want to look at my own open source profiler, called cRunWatch

ravenspoint
  • 19,093
  • 6
  • 57
  • 103