delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/10/11/18:41:09

To: djgpp AT delorie DOT com
Message-Id: <2.7.9.191MP.H3U9EW@pauzner.dnttm.ru>
From: "Leonid Pauzner" <uue AT pauzner DOT dnttm DOT ru>
Date: Sat, 12 Oct 2002 02:35:20 +0400 (MSD)
X-Mailer: dMail [Demos Mail for DOS v2.7.9]
Subject: profiling with DJGPP
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Hi!

I am curious about the profile (attached below) I get from my program:
a lot of time spent in  getenv, days_to_years, timesub etc.
This seems due to profiling nature but probably there is bug here.

Looking the libc sources (djlsr203.zip) I got an impression that
1) getenv implemented ineffectively - no hashing
2) getenv heavily used by timer functions for timezone info
    (TZ, TZDIR, etc. - seems things are stored in static
     variables but probably not in all places?)
3) days_to_years intended for date calculation...
    but profiling needs only relative time.

4) I was unable to link my program with profiled libc version
to figure out the real number of calls of these strange functions:
linking with -lc_p (or just renaming my prepared libc_p.a to regular libc.a)
doesn't work: I got a coredump with error somewhere from mcount.c

Also I have some difficulties building profiled libc outside the DJGPP tree
(had no intention to destroy my normal DJGPP environment).
What is the *right way*?

Could you please comment highlighted items, at least the last one -
how to work in dual environment (normal/profiled libc).

Yours,
        Leonid Pauzner.

********************************************************
Flat profile:

Each sample counts as 0.0555556 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls   s/call   s/call  name
 14.94      6.33     6.33    13284     0.00     0.00  split_line
  8.39      9.89     3.56                             __dpmi_int
  6.55     12.67     2.78                             getenv
  6.42     15.39     2.72     6107     0.00     0.00  HTAnchor_findChild
  6.03     17.94     2.56                             top1
  4.85     20.00     2.06   634316     0.00     0.00  HTML_put_character
  4.85     22.06     2.06                             mcount
  3.93     23.72     1.67  4998014     0.00     0.00  HTIdentical
  3.93     25.39     1.67                             days_to_years
  3.67     26.94     1.56   620254     0.00     0.00  HText_appendCharacter
  3.54     28.44     1.50                             check_WrapSource
  3.41     29.89     1.44                             _doprnt
  2.88     31.11     1.22                             timesub
  2.49     32.17     1.06                             putc
  2.36     33.17     1.00                             __dpmi_simulate_real_mode_interrupt
  2.10     34.06     0.89   821570     0.00     0.00  SGML_character
  1.57     34.72     0.67     3425     0.00     0.00  LYUCFullyTranslateString
  1.31     35.28     0.56                             after_switch
  1.05     35.72     0.44                             time2
  0.92     36.11     0.39                             S_comment_put_c
  0.92     36.50     0.39                             localsub
  0.92     36.89     0.39                             malloc
  0.79     37.22     0.33                             free
...


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019