Question

I am trying to profile tesseract-ocr with GNU gprof. After modifying the Makefile to add "-pg" to CFLAGS, I make/make install the program and then execute an OCR command. At this point, I'm expecting to see a generated "gmon.out" file somewhere, but nothing is being generated.

I have never used GNU gprof before. Am I missing something? Here is what I did, on a high level:

  1. compiled and installed Leptonica (a dependency for tesseract-ocr)
  2. ./configure on tesseract-ocr, and then added "-pg" to CFLAGS in the Makefile
  3. make, make install on tesseract-ocr
  4. Run an OCR command (tesseract /home/me/test.jpg ocr_out.txt -spa)

I have also tried to add "-pg" to other variables such as CXX and LDFLAGS. I tried this in the Makefile for both tesseract-ocr and Leptonica.

I should also note that I'm doing this all on cygwin...

Any ideas?

Was it helpful?

Solution

You need to modify the FLAGS in "config.status" which autoconfigurates the makefiles of all the applications in tesseract-ocr.

Add -pg to CFLAGS,CXXFLAGS, and CPPFLAGS and then tell me how it works.

Coincedentally, I'm also trying to profile tesseract with gnu gprof, except in my gmon.out I'm seeing that there is only one function in the call stack with 0s. I'd like to know if your result is any different, let me know how it goes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top