This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Dear SystemTap developers,
I noticed that compile time for a non-cached module greatly increased
since SystemTap snapshot 20070721.
On my system (RHEL4 with 2.6.25 kernel; dual Intel Xeon(TM) CPU
2.80GHz with HT; 5 GB RAM), phase 2
takes about half an hour to complete. This problem also occurs in
SystemTap 0.8 and in most recent snapshots.
Using strace, I found that stap spends most of time for generating the
header "stap-symbols.h" in function
dump_unwindsyms() (in translate.cxx). Here it is the "guilty" code:
// Add unwind data to be included if it exists for this module.
size_t len = 0;
void *unwind = get_unwind_data (m, &len);
if (unwind != NULL)
{
c->output << "#ifdef STP_USE_DWARF_UNWINDER" << endl;
c->output << "static uint8_t _stp_module_" << stpmod_idx
<< "_unwind_data[] = " << endl;
c->output << " {";
for (size_t i = 0; i < len; i++)
{
int h = ((uint8_t *)unwind)[i];
c->output << "0x" << hex << h << dec << ",";
if ((i + 1) % 16 == 0)
c->output << endl << " ";
}
c->output << "};" << endl;
c->output << "#endif /* STP_USE_DWARF_UNWINDER */" << endl;
}
and
for (unsigned secidx = 0; secidx < seclist.size(); secidx++)
{
c->output << "struct _stp_symbol "
<< "_stp_module_" << stpmod_idx<< "_symbols_" <<
secidx << "[] = {" << endl;
// We write out a *sorted* symbol table, so the runtime doesn't
have to sort them later.
for (addrmap_t::iterator it = addrmap[secidx].begin(); it !=
addrmap[secidx].end(); it++)
{
if (it->first < extra_offset)
continue; // skip symbols that occur before our chosen base address
c->output << " { 0x" << hex << it->first-extra_offset << dec
<< ", " << lex_cast_qstring (it->second) << " }," << endl;
}
c->output << "};" << endl;
}
As far as I know, the "stap-symbols.h" file contains the list of
kernel symbols (preliminarly ordered by name)
in order to speed-up symbol resolution at run-time. Because the symbol
list remains the same if the kernel
is unchanged, I think that stap-symbols.h should be cached in order to
speed up phase 2. You can find a
very simple patch I made on SystemTap 0.8 which caches stap-symbols.h
into ~/.systemtap
(it only takes into account the modification time of
/boot/vmlinux-VERSION, so it can be greatly improved).
Please consider the addition of caching mechanisms for stap-symbols.h
in future releases of SystemTap.
Thank you for your support
Roberto Natella
Attachment:
cache_unwind_symbols.patch
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |