In spite of compiling my code with -pg flag set, I am unable to view the complete details of the gprof output from gmon.out
Specifically, I am not getting the details of calls, self Ts/call and total Ts/call.
This is the output of gprof deepflow-static gmon.out :
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
52.72 7.18 7.18 sor_coupled
34.07 11.82 4.64 compute_data_and_match
2.28 12.13 0.31 convolve_vert
2.28 12.44 0.31 compute_smoothness
2.06 12.72 0.28 convolve_horiz
1.47 12.92 0.20 color_image_resize_vert
1.03 13.06 0.14 sub_laplacian
0.88 13.18 0.12 image_resize_vert
0.88 13.30 0.12 image_warp
0.73 13.40 0.10 color_image_resize_horiz
0.59 13.48 0.08 image_resize_horiz
0.18 13.51 0.03 frexp
0.15 13.53 0.02 compute_one_level
0.15 13.55 0.02 fwrite
0.15 13.57 0.02 memcpy
0.11 13.58 0.02 __floorf_sse41
0.07 13.59 0.01 brk
0.07 13.60 0.01 color_image_png_load
0.07 13.61 0.01 get_derivatives
0.07 13.62 0.01 png_read_filter_row_paeth_multibyte_pixel
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the number of times this function was invoked, if
this function is profiled, else blank.
self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.
total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.
name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.
Copyright (C) 2012 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
This is my Makefile :
CC=gcc
CFLAGS=-Wall -g -O3
LDFLAGS=-g -Wall -O3
LIBFLAGS=-lm -ljpeg -lpng -pg
LIBAFLAGS=-static /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/local/lib/libpng16.a /usr/lib/x86_64-linux-gnu/libz.a /usr/lib/x86_64-linux-gnu/libm.a
all: deepflow-static
deepflow: deepflow.o image.o io.o opticalflow_aux.o opticalflow.o solver.o
$(CC) $(LDFLAGS) $(LIBFLAGS) -o $# $^
deepflow-static: deepflow.o image.o io.o opticalflow_aux.o opticalflow.o solver.o
$(CC) $(LIBFLAGS) -o $# $^ $(LIBAFLAGS)
%.o: %.c
$(CC) -o $# $(CFLAGS) -c $+
clean:
rm -f *.o deepflow
Please help me in figuring out what is missing.
Thanks in advance
This has happened to me when the application being run with gprof was not terminating successfully.
The generation of the analysis file could not complete as the information was not fully written to gmon.out.
Try exiting the program after a few lines with:
exit(EXIT_SUCCESS);
And check whether or not the file is correctly generated.
You can also run the program through gdb.
I am not a Makefile expert, but you should be using the -pg flag on two steps:
GPROF=-pg
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $# $(LIBS) $(GPROF)
.cpp.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $# $(GPROF)
Related
I'm trying to build and run Go on a self-hosted jailbroken iOS device (Corellium virtual devices). Go bootstraps and can build and run regular binaries. However, Go archives fail to build because ar doesn't work:
$ dpkg -S /usr/bin/clang /usr/bin/ar /usr/bin/libtool
org.coolstar.llvm-clang64: /usr/bin/clang
org.coolstar.cctools: /usr/bin/ar
org.coolstar.cctools: /usr/bin/libtool
$ apt policy org.coolstar.cctools org.coolstar.llvm-clang64
org.coolstar.cctools:
Installed: 895
Candidate: 895
Version table:
*** 895 500
500 http://apt.thebigboss.org/repofiles/cydia stable/main iphoneos-arm Packages
100 /Library/dpkg/status
org.coolstar.llvm-clang64:
Installed: 5.0.1-2
Candidate: 5.0.1-2
Version table:
*** 5.0.1-2 500
500 http://apt.thebigboss.org/repofiles/cydia stable/main iphoneos-arm Packages
100 /Library/dpkg/status
$ ../bin/go build -buildmode=c-archive -ldflags="-v" -work ../misc/ios/detect.go
WORK=/tmp/go-build734936238
# command-line-arguments
HEADER = -H1 -T0x2000 -R0x1000
0.00 deadcode
0.05 symsize = 0
0.08 pclntab=740717 bytes, funcdata total 185492 bytes
0.08 dodata
0.08 symsize = 0
0.08 symsize = 0
0.09 dynreloc
0.09 dwarf
0.12 asmb
0.13 datblk
0.14 reloc
0.20 sym
0.22 header
archive: ar -q -c -s $WORK/b001/exe/a.out.a /tmp/go-link-569975294/go.o /tmp/go-link-569975294/000000.o /tmp/go-link-569975294/000001.o /tmp/go-link-569975294/000002.o /tmp/go-link-569975294/000003.o /tmp/go-link-569975294/000004.o /tmp/go-link-569975294/000005.o /tmp/go-link-569975294/000006.o /tmp/go-link-569975294/000007.o /tmp/go-link-569975294/000008.o /tmp/go-link-569975294/000009.o /tmp/go-link-569975294/000010.o /tmp/go-link-569975294/000011.o /tmp/go-link-569975294/000012.o /tmp/go-link-569975294/000013.o /tmp/go-link-569975294/000014.o
/var/mobile/go-tip/pkg/tool/darwin_arm64/link: running ar failed: exit status 1
fatal error: ar: can't find or exec: /usr/bin/arm64-apple-darwin14-ranlib (No such file or directory)
ar: internal ranlib command failed
Optimistic as I am, I tried symlinking ranlib:
# ln -s /usr/bin/ranlib /usr/bin/arm64-apple-darwin14-ranlib
$ ../bin/go build -buildmode=c-archive -ldflags="-v" -work ../misc/ios/detect.go
WORK=/tmp/go-build239621581
# command-line-arguments
HEADER = -H1 -T0x2000 -R0x1000
0.00 deadcode
0.06 symsize = 0
0.08 pclntab=740717 bytes, funcdata total 185492 bytes
0.08 dodata
0.09 symsize = 0
0.09 symsize = 0
0.09 dynreloc
0.10 dwarf
0.12 asmb
0.13 datblk
0.15 reloc
0.20 sym
0.22 header
archive: ar -q -c -s $WORK/b001/exe/a.out.a /tmp/go-link-618780113/go.o /tmp/go-link-618780113/000000.o /tmp/go-link-618780113/000001.o /tmp/go-link-618780113/000002.o /tmp/go-link-618780113/000003.o /tmp/go-link-618780113/000004.o /tmp/go-link-618780113/000005.o /tmp/go-link-618780113/000006.o /tmp/go-link-618780113/000007.o /tmp/go-link-618780113/000008.o /tmp/go-link-618780113/000009.o /tmp/go-link-618780113/000010.o /tmp/go-link-618780113/000011.o /tmp/go-link-618780113/000012.o /tmp/go-link-618780113/000013.o /tmp/go-link-618780113/000014.o
/var/mobile/go-tip/pkg/tool/darwin_arm64/link: running ar failed: exit status 1
/usr/bin/arm64-apple-darwin14-ranlib: archive member: $WORK/b001/exe/a.out.a(go.o) offset in archive not a multiple of 8 (must be since member is an 64-bit object file)
fatal error: ar: fatal error in /usr/bin/arm64-apple-darwin14-ranlib
I even switched Go to use libtool:
$ ../bin/go build -buildmode=c-archive -ldflags="-v" -work ../misc/ios/detect.go
WORK=/tmp/go-build502332895
# command-line-arguments
HEADER = -H1 -T0x2000 -R0x1000
0.00 deadcode
0.04 symsize = 0
0.08 pclntab=740717 bytes, funcdata total 185492 bytes
0.08 dodata
0.08 symsize = 0
0.09 symsize = 0
0.09 dynreloc
0.10 dwarf
0.12 asmb
0.14 datblk
0.15 reloc
0.20 sym
0.22 header
archive: libtool -static -o $WORK/b001/exe/a.out.a /tmp/go-link-320669019/go.o /tmp/go-link-320669019/000000.o /tmp/go-link-320669019/000001.o /tmp/go-link-320669019/000002.o /tmp/go-link-320669019/000003.o /tmp/go-link-320669019/000004.o /tmp/go-link-320669019/000005.o /tmp/go-link-320669019/000006.o /tmp/go-link-320669019/000007.o /tmp/go-link-320669019/000008.o /tmp/go-link-320669019/000009.o /tmp/go-link-320669019/000010.o /tmp/go-link-320669019/000011.o /tmp/go-link-320669019/000012.o /tmp/go-link-320669019/000013.o /tmp/go-link-320669019/000014.o
/var/mobile/go-tip/pkg/tool/darwin_arm64/link: running libtool failed: signal: segmentation fault
Now, ar (with symlinked ranlib) fails on even simple object files:
$ cat blah.c
int blah() {
return 0;
}
$ clang -c blah.c
$ ar -q -c -s blah.a blah.o
/usr/bin/arm64-apple-darwin14-ranlib: archive member: blah.a(blah.o) offset in archive not a multiple of 8 (must be since member is an 64-bit object file)
Libtool works:
$ libtool -static -o blah.a blah.o
But segfaults on more complex object files as seen above.
Go can already successfully create archives using the Xcode ar tool. It's only the iOS native "cctools" version that fails.
I worked around the problem by using llvm-ar. The command line flags are slightly different, but at least I now have a working archive.
When my Docker build reaches this part of the Dockerfile:
ARG cabal=1.22.9.0
RUN curl -L http://hackage.haskell.org/package/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz | tar -xzf- && \
cd cabal-install-${cabal} && \
EXTRA_CONFIGURE_OPTS= ./bootstrap.sh --global
It eventually ends with this error.
Downloading zlib-0.6.1.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 139k 0 139k 0 0 293k 0 --:--:-- --:--:-- --:--:-- 293k
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Linking Setup ...
Configuring zlib-0.6.1.1...
Setup: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Error during cabal-install bootstrap:
Configuring the zlib package failed.
The command '/bin/sh -c curl -L http://hackage.haskell.org/package/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz | tar -xzf- && cd cabal-install-${cabal} && EXTRA_CONFIGURE_OPTS= ./bootstrap.sh --global' returned a non-zero code: 2
Is there something I can include in my Dockerfile that can prevent this?
I am following this link and trying to implement the scenarios there.
So I need to generate a data for MANET nodes representing their location in this format:
Current time - latest x – latest y – latest update time – previous x –previous y – previous update time
with the use of setdest tool with these options:
1500 by 300 grid, ran for 300 seconds and used pause times of 20s and maximum velocities of 2.5 m/s.
so I come up with this command
./setdest -v 2 -n 10 -s 2.5 -m 10 -M 50 -t 300 -p 20 -x 1500 -y 300 > test1.tcl
which worked and generated a tcl file, but I don't know how can I obtain the data in the required format.
setdest -v 2 -n 10 -s 2.5 -m 10 -M 50 -t 300 -p 20 -x 1500 -y 300 > test1.tcl
Not a tcl file : Is a "scen" / scenario file with 1,700 "ns" commands. Your file was renamed to "test1.scen", and is now used in the manet examples, in the simulation example aodv-manet-20.tcl :
set val(cp) "test1.scen" ;#Connection Pattern
Please be aware that time settings are maximum time. "Long time settings" were useful ~20 years ago when computers were slow. (Though there are complex simulations lasting half an hour to one hour.)
Link, manet-examples-1.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNR05CclpEdVdvQm8/view?usp=sharing
Edit: New example added → manet0-16-nam.tcl → → https://drive.google.com/file/d/0B7S255p3kFXNR0ZuQ1l6YnlWRGc/view?usp=sharing
So I've been trying to run the command
opencv_traincascade -data HandsData -vec hands.vec -bg HandsNeg.txt -numPos 3641 -numNeg 2578 -numStages 20 -w 27 -h 48 -mode ALL -minHitRate 0.999 -maxFalseAlarmRate 0.5 -precalcValBufSize 1024 -precalcIdxBufSize 1024
and I get the error
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 3641 : 3641
OpenCV Error: Assertion failed (_img.cols == winSize.width) in get, file /builddir/build/BUILD/OpenCV-2.0.0/apps/traincascade/imagestorage.cpp, line 86
terminate called after throwing an instance of 'cv::Exception'
Aborted
I've seen suggestions around to change the positive image number, where I use 1043 instead and still get the same error. Then I also see suggestions of editing the source code. The problem is that I built OpenCV with yum and would like to not have to rebuild from source.
sudo find / -name imagestorage.cpp
turns up nothing.
I'm at a complete loss of what to do.
Additional info: Steps I took to get to this point
I created everything from some videos using ffmpeg. These were from a phone and VLC lists the info as
Resolution: 1920x1090
Display resolution: 1920x1080
The ffmpeg command was (replacing input/output with respective videos and locations)
steven ~/computer_vision $ ffmpeg -i videos/Not\ hands\ stuff.mp4 -y -r 40 -s 27x48 -f image2 NotHandsorFists/Negs-%4d.png
Files in Hands.txt are of the form
steven ~/computer_vision $ cat Hands.txt | head -n 1
Hands/LeftHand-0001.png 1 0 0 27 48
I compiled the vec file with
steven ~/computer_vision $ opencv_createsamples -info Hands.txt -num 3641 -w 27 -h 48 -vec hands.vec
The negative file is in the form
steven ~/computer_vision $ cat HandsNeg.txt | head -n 1
Fists/LeftFist-0001.png
and the working directory is
steven ~/computer_vision $ ls
Fists fists.txt Hands HandsData HandsNeg.txt Hands.txt hands.vec NotHandsorFists NotHandsorFists.txt videos
Edit:
I've tried changing png to jpg and bmp to get rid of the channels. No help.
I want to capture all bandwidth value in iperf not only Mbits size but also bits and Kbits as well.
[3] 0.0 - 1.0 sec 128 Kbytes 1.05 Mbits/sec
[3] 1.0 - 2.0 sec 0 Kbytes 0.00 bits/sec
[3] 2.0 - 3.0 sec 90 Kbytes 900.5 Kbits/sec
So far I know about this
iperf -c 10.0.0.1 -i 1 -t 100 | grep -Po '[0-9.]*(?= Mbits/sec)'
but that only captures Mbits value. How to capture bits/sec and Kbits/sec as well at the same time with Mbits/sec?
Thank you
I know this is old, but in case someone stumbles upon it, you could add an optional character class to your grep:
grep -Po '[0-9.]*(?= [KM]*bits/sec)'
This should do it
iperf -c 10.0.0.1 -i 1 -t 100 | awk '{print$5}' FPAT=[.0-9]+
FPAT=[.0-9]+ defines a field as one or more of .0-9
{print$5} prints just the rate
you might want to man iperf to see what's supported. Here's the latest from 2.0.10
-f, --format
[abkmgKMG] format to report: adaptive, bits, Kbits, Mbits, KBytes, MBytes (see NOTES for more)