![]() |
| | #1 |
| Registered User Join Date: Feb 2010
Posts: 3
| Profiler for C code Thanks for the help! |
| guess85 is offline | |
| | #2 |
| critical genius Join Date: Jul 2008 Location: SE Queens
Posts: 5,198
| Okay, here's how to use gprof: 1) compile: gcc -pg -fprofile-arcs -ftest-coverage 2) now run the executable once, this will create a file "gmon.out" 3) then gprof -b ./a.out (or the exe name). |
| MK27 is offline | |
| | #3 |
| Registered User Join Date: Dec 2009 Location: Henderson, NV
Posts: 539
| OK the MacBook is your problem to solve ![]() All joking aside, what about gprof did not work for you? As for Valgrind, that is a memory/leak checking tool, not a profiler... So if you can explain a little better what went wrong, maybe we can help you... |
| jeffcobb is offline | |
| | #4 | |
| Registered User Join Date: Dec 2009 Location: Henderson, NV
Posts: 539
| Quote:
![]() Happy Tuesday... | |
| jeffcobb is offline | |
| | #5 |
| Jack of many languages Join Date: Nov 2007 Location: Katy, Texas
Posts: 2,071
| Why not use Xcode tools?
__________________ Mac and Windows cross platform programmer. Ruby lover. |
| Dino is offline | |
| | #6 |
| critical genius Join Date: Jul 2008 Location: SE Queens
Posts: 5,198
| Oh yuck -- you need to contemplate my signature Jeff. The gprof man page is one of many still used in the FIFTH CIRCLE OF HELL!!! |
| MK27 is offline | |
| | #7 | |
| Registered User Join Date: Feb 2010
Posts: 3
| Quote:
I can say the same thing for other OS ![]() The code I want to profile is libsvm, if someone know. To compile this I do "make" in the dir and it compile svm-train and svm-predict. This what "makefile" file contains: Code: CXX ?= g++ CFLAGS = -Wall -Wconversion -O3 -fPIC SHVER = 1 all: svm-train svm-predict svm-scale lib: svm.o $(CXX) -shared svm.o -o libsvm.so.$(SHVER) svm-predict: svm-predict.c svm.o $(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm svm-train: svm-train.c svm.o $(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm svm-scale: svm-scale.c $(CXX) $(CFLAGS) svm-scale.c -o svm-scale svm.o: svm.cpp svm.h $(CXX) $(CFLAGS) -c svm.cpp clean: rm -f *~ svm.o svm-train svm-predict svm-scale I'm new in profiling and I need some help Thanks | |
| guess85 is offline | |
| | #8 |
| critical genius Join Date: Jul 2008 Location: SE Queens
Posts: 5,198
| Try adding it to CFLAGS. |
| MK27 is offline | |
| | #9 |
| Registered User Join Date: Feb 2010
Posts: 3
| |
| guess85 is offline | |
| | #11 | |
| Registered User Join Date: Dec 2009 Location: Henderson, NV
Posts: 539
| Quote:
And I am here to help...when I first got here I would jump on any request for code and post full working solutions to everything....until I realized the number of ppl coming here waiting for the answer to just be handed to them. I have a wife, the only person I work for unconditionally for free. Others must pay and if not monetarily (nothing that I am suggesting) then through gaining personal knowledge and experience, the latter of which can be the greatest teacher of all, IMHO....this is what working in FOSS has brought to me and one of its greatest virtues: not the free code, free support, security et al: free education... I dunno, maybe if we had just !had that rash flea-bags posting home-work and demanding answers w/o being willing to even *try* to do the coding I might have answered differently. And the MacBook *is* his problem ![]() I am not picking on him; I tease all of my Apple friends. | |
| jeffcobb is offline | |
| | #12 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,768
| I have altered the below to set the correct flags for profiling. Those changes are marked in blue. Quote:
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot | |
| brewbuck is offline | |
![]() |
| Tags |
| c code, gprof, macbook, profiler, profiling |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code profiler? | h3ro | Tech Board | 5 | 04-07-2008 09:16 AM |
| Proposal: Code colouring | Perspective | General Discussions | 28 | 05-14-2007 07:23 AM |
| Values changing without reason? | subtled | C Programming | 2 | 04-19-2007 10:20 AM |
| Obfuscated Code Contest | Stack Overflow | Contests Board | 51 | 01-21-2005 04:17 PM |
| Interface Question | smog890 | C Programming | 11 | 06-03-2002 05:06 PM |