1

I asked a question on GPROF Automating the profling of C program using GPROF

It seems I have figure out half of the solution (I now know how to automate gporf using bash script). The other half is that if I have lets say 50 profiling results stored in analysis[i].text (with 1=1 to 50), how do I combine all those results in a single file so that I can compare all the results easily and may be easily copy the timings and plot a graph in excelsheet.

Final combined profiling result file may look like this;

run#    profiling result (as usual we get from gprof)               

1             matUnopt  time .....
              matOpt    time .....  

2             matUnopt  time .....
              matOpt    time .....  

3             matUnopt  time .....
              matOpt    time .....  

4             matUnopt  time .....
              matOpt    time .....  


and so on.

where each entry is taken from different file and combined like this. Now I can see all the results from different run or file in one table.

How do I do this?

Update To elaborate suppose I have two files: file1 and file2

file1

field 1
A
B


field 2
c
D


field 3
E
F

file2

field 1
G
H


field 2
I
J


field 3
K
L

Now what I want is a way to get:

file3

field 1
A
B
G
H

field 2
C
D
I
J


field 3
E
F
K
L
3
  • Is this already what you need? pubs.opengroup.org/onlinepubs/009695399/utilities/cat.html . You tagged your question "C" but I think, you want a shell solution (and you are on a POSIX system)? Commented Jan 6, 2014 at 10:42
  • I guess cat command would simply concatenate two files (ie, append at then end of the file), but I need field wise concatenation. so field 1 of file 1 and file 2 are concatenated, then field 2 of both these files are concatenated and so on. Commented Jan 6, 2014 at 12:12
  • I have updated my question to explain further what I am looking for. Commented Jan 6, 2014 at 12:19

1 Answer 1

1

Use "gprof -s" to combine output files https://sourceware.org/binutils/docs/gprof/Sampling-Error.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.