gprof (profiling)가 stdio.h 의 함수들 실행 정보도 알아낼 수

verytrue의 이미지

최근에 gprof에 대해 알게 되어서 사용해보던중
embedded linux의 라이브러리에도 적용에 어려움이
있어 질문을 드립니다.

제가 알고자 하는 것은 gprof가 과연 라이브러리들
(가령 <stdio.h>)의 function들에 대해서도 function call등을
체크할 수 있는지 여부입니다

예를 들면, atoi()함수가 <string.h>에 구현 되어있다고 하면
atoi()함수를 몇번 호출 했는지, 그리고 atoi()함수의 실행에는
얼만큼의 시간이 소요 되었는지를 알 수 있는가 입니다.

제가 테스트 해본 바로는 자신이 임의로 만든 헤더파일에 있는
함수가 호출될 때에는 profile을 보여주지만, 원래 갖고 있는
헤더파일(stdio.h등등..)의 함수들이 호출 될 때에는 정보를 전혀
보여주지 않는것 같아 보입니다.

제가 하고 있는 작업은 embedded linux에
올려져 있는 다른 사람들이 만든 library 파일들을
테스트 하는 것인데, 이 경우 library들은 헤더파일의
형태가 아니라 shared object의 형태로 존재해서 역시 profile
정보가 보여지지 않더군요.

그리고 stdio.h에 있는 함수들(prinf등등..)도 같은 성질일
것 같고, 이 정보를 보는 방법을 알아낸다면 embedded linux에
임의로 다른 사람들이 구현한 library 들의 profile 정보도
같은 방법으로 알아낼 수 있을 것 같아 이렇게 질문을 올립니다.

정리하자면, 질문은 두개가 되겠네요.
1. gprof 혹은 다른 툴로 stdio.h의 함수들의 profile 정보를
알아내는 방법이 있는지..

2. 방법이 있다면 embedded linux에 올리려고 만든
shared object형태의 library들의 profile 정보도 역시 볼 수 있는지
입니다.

1번의 방법이 존재해서 결과가 제대로 나온다면
printf() 함수가 몇번 호출되었고, 그 함수가 호출되어 수행되는
동안 걸린 시간은 얼만인지가 나오겠죠.

아시는 분의 답변이나 혹은 의견도 좋습니다.
감사합니다.

saxboy의 이미지

profiler 를 사용하시려면 컴파일을 새로 하셔야 하니, 코드를 가지고 있는 경우가 아니라면 곤란하지 않을까요. 라이브러리가 strip 된 경우라면 더욱 곤란할 것 같다는 생각이 드는군요. 오히려 strace같은 툴로 시스템 콜을 살펴보시는 것이 낫지 않을까 합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.