2011-09-30 12 views
6

नहीं बना रहा है सबसे पहले मैं मैकॉक्स 10.7.1 चला रहा हूं। मैंने सी लेंगेज के साथ काम करने के लिए सभी ठीक से, एक्सकोड 4 और सभी पुस्तकालयों को स्थापित किया है।gprof कमांड उचित out.txt

मुझे खोल में gprof कमांड चलाने में परेशानी हो रही है। मैं कदम उठाकर कदम उठाऊंगा जो मैं कर रहा हूं और जो आउटपुट मैं प्राप्त कर रहा हूं।

चरण 1:

~ roger$ cd Path/to/my/workspace 
~ roger$ ls 

आउटपुट (चरण 1):

queue.c   queue.h   testqueue.c 

चरण 2:

~ roger$ gcc -c -g -pg queue.c 
~ roger$ ls 

आउटपुट (चरण 2):

queue.c   queue.h   queue.o   testqueue.c 
,210

चरण 3:

~ roger$ gcc -o testqueue -g -pg queue.o testqueue.c 
~ roger$ ls 

आउटपुट (चरण 3):

queue.c   queue.h   queue.o   testqueue  testqueue.c 

चरण 4:

~ roger$ ./testqueue 
~ roger$ ls 

आउटपुट (चरण 4):

enqueue element 16807 
head=0,tail=1 
enqueue element 282475249 
head=0,tail=2 
enqueue element 1622650073 
head=0,tail=3 
enqueue element 984943658 
head=0,tail=4 
enqueue element 1144108930 
head=0,tail=5 
enqueue element 470211272 
head=0,tail=6 
enqueue element 101027544 
head=0,tail=7 
enqueue element 1457850878 
head=0,tail=8 
enqueue element 1458777923 
head=0,tail=9 
enqueue element 2007237709 
head=0,tail=10 
queue is full 
dequeue element 16807 
dequeue element 282475249 
dequeue element 1622650073 
dequeue element 984943658 
dequeue element 1144108930 
dequeue element 470211272 
dequeue element 101027544 
dequeue element 1457850878 
dequeue element 1458777923 
dequeue element 2007237709 
queue is empty 

gmon.out  queue.h   testqueue 
queue.c   queue.o   testqueue.c 

चरण 5 :

~ roger$ gprof -b testqueue gmon.out > out.txt 
~ roger$ nano out.txt 

आउटपुट (चरण 5):

GNU nano 2.0.6    File: out.txt 


granularity: each sample hit covers 4 byte(s) no time propagated 
called/total  parents 
index %time self descendents called+self name   index 
called/total  children 

^L 

granularity: each sample hit covers 4 byte(s) no time accumulated 

% cumulative self    self  total 
time seconds seconds calls ms/call ms/call name 

^L 

Index by function name 

अंत में। आउटपुट फ़ाइल को इस तरह कुछ दिखाना चाहिए:

% cumulative self    self  total 
time seconds seconds calls ms/call ms/call name 
33.34  0.02  0.02  7208  0.00  0.00 open 
16.67  0.03  0.01  244  0.04  0.12 offtime 
16.67  0.04  0.01  8  1.25  1.25 memccpy 
16.67  0.05  0.01  7  1.43  1.43 write 
16.67  0.06  0.01        mcount 
    0.00  0.06  0.00  236  0.00  0.00 tzset 
    0.00  0.06  0.00  192  0.00  0.00 tolower 
    0.00  0.06  0.00  47  0.00  0.00 strlen 
    0.00  0.06  0.00  45  0.00  0.00 strchr 
    0.00  0.06  0.00  1  0.00 50.00 main 
    0.00  0.06  0.00  1  0.00  0.00 memcpy 
    0.00  0.06  0.00  1  0.00 10.11 print 
    0.00  0.06  0.00  1  0.00  0.00 profil 
    0.00  0.06  0.00  1  0.00 50.00 report 
... 

और यह खाली क्षेत्र दिखाता है।

मैंने यहां खोज की और मुझे कुछ भी मददगार नहीं मिला। मैं इसे गूगल लेकिन एक ही बात है।

मैं बहुत आभारी हूं यदि कोई मेरी मदद कर सकता है।

+0

आप (http://stackoverflow.com [से gprof बेहतर] कर सकते हैं/प्रश्न/1777556/विकल्प करने वाली gprof/1779343 # 1779343)। –

उत्तर

10

gprof ओएस एक्स पर काम नहीं करता है। सिस्टम कॉल की जरूरत है कि कई संस्करण पहले हटा दिए गए थे। यह स्पष्ट नहीं है कि उपयोगिता अभी भी जहाजों क्यों है। विकल्पों का उपयोग dtrace और/या नमूना का उपयोग करना है।

संबंधित मुद्दे