Changeset 7427 for trunk/src


Ignore:
Timestamp:
Nov 22, 2001, 2:35:42 PM (24 years ago)
Author:
phaller
Message:

.

Location:
trunk/src/odinprof
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odinprof/profiler.cpp

    r7423 r7427  
    1 /* $Id: profiler.cpp,v 1.2 2001-11-22 11:34:43 phaller Exp $ */
     1/* $Id: profiler.cpp,v 1.3 2001-11-22 13:35:42 phaller Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    710710  {
    711711    PPROFILEENTRY p = (PPROFILEENTRY)arrEntries[i].pObject;
    712     if (p->ulCalls > 1)
    713712    fprintf(file,
    714713            "%10d %10d %10d %10d %10d %s(%s)\n",
     
    738737  {
    739738    PPROFILEENTRY p = (PPROFILEENTRY)arrEntries[i].pObject;
    740     if (p->ulCalls > 1)
    741739    fprintf(file,
    742740            "%10d %10d %10d %s(%s)\n",
     
    764762  {
    765763    PPROFILEENTRY p = (PPROFILEENTRY)arrEntries[i].pObject;
    766     if (p->ulCalls > 1)
    767764    fprintf(file,
    768765            "%10d %10d %10d %s(%s)\n",
     
    790787  {
    791788    PPROFILEENTRY p = (PPROFILEENTRY)arrEntries[i].pObject;
    792     if (p->ulCalls > 1)
    793789    fprintf(file,
    794790            "%10d %10d %10d %s(%s)\n",
     
    810806  // write to file
    811807  fprintf(file,
    812           "Functions / symbols sorted by address\n"
     808          "\nFunctions / symbols sorted by address\n"
    813809          "Address ----- Function / Symbol -------------------------------------------\n");
    814810  for(i = 0;
     
    817813  {
    818814    PPROFILEENTRY p = (PPROFILEENTRY)arrEntries[i].pObject;
    819     if (p->ulCalls > 1)
    820815    fprintf(file,
    821816            "#%08xh %-9s %s\n",
     
    825820  }
    826821 
     822  // at last print the sym map
     823  pSymPool->printSYMs(file);
    827824
    828825  ProfilerEnable(flagLock);
  • trunk/src/odinprof/symfile.cpp

    r7423 r7427  
    1 /* $Id: symfile.cpp,v 1.2 2001-11-22 11:34:43 phaller Exp $ */
     1/* $Id: symfile.cpp,v 1.3 2001-11-22 13:35:42 phaller Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    395395  if (NULL == pSym)
    396396  {
    397     CHAR szFilename[260];
     397    DosEnterCritSec();
    398398   
    399     // 1 - locate the file
    400     APIRET rc = searchModule(pszModule, szFilename, sizeof(szFilename));
     399    // try again since someone else could have loaded the map already
     400    pSym = (LXSymbolFile*)pHashModules->getElement(pszModule);
     401    if (NULL == pSym)
     402    {
     403      CHAR szFilename[260];
     404     
     405      // 1 - locate the file
     406      APIRET rc = searchModule(pszModule, szFilename, sizeof(szFilename));
     407     
     408      // create new entry
     409      pSym = new LXSymbolFile(pszModule, szFilename);
     410     
     411      // parse the file
     412      if (rc == NO_ERROR)
     413        pSym->parseFile();
     414      else
     415        pSym->setErrorMessage("file not found");
     416     
     417      // add to the hashtable
     418      PSZ pszCopyOfModuleName = strdup(pszModule);
     419      pHashModules->addElement(pszCopyOfModuleName, pSym);
     420    }
    401421   
    402     // create new entry
    403     pSym = new LXSymbolFile(pszModule, szFilename);
    404    
    405     // parse the file
    406     if (rc == NO_ERROR)
    407       pSym->parseFile();
    408     else
    409       pSym->setErrorMessage("file not found");
    410    
    411     // add to the hashtable
    412     pHashModules->addElement(pszModule, pSym);
     422    DosExitCritSec();
    413423  }
    414424 
     
    457467}
    458468
     469
     470static int _Optlink sortHashtableSYMs(const void *arg1,const void *arg2)
     471{
     472  PHASHTABLEENTRY pHTE1 = (PHASHTABLEENTRY)arg1;
     473  PHASHTABLEENTRY pHTE2 = (PHASHTABLEENTRY)arg2;
     474 
     475  LXSymbolFile* p1 = (LXSymbolFile*)pHTE1->pObject;
     476  LXSymbolFile* p2 = (LXSymbolFile*)pHTE2->pObject;
     477 
     478  return stricmp(p1->getName(), p2->getName());
     479}
     480
     481
     482void SymbolFilePool::printSYMs(FILE *file)
     483{
     484  int iEntries = pHashModules->getNumberOfElements();
     485 
     486  // get a list of all entries of the hashtable
     487  PHASHTABLEENTRY arrEntries = (PHASHTABLEENTRY)malloc( iEntries * sizeof(HASHTABLEENTRY) );
     488  iEntries = pHashModules->getElementMap(arrEntries);
     489 
     490  fprintf(file,
     491          "\nSymbolic debug information maps (%d maps)\n",
     492          iEntries);
     493 
     494  // sort the list by name
     495  qsort(arrEntries,
     496        iEntries,
     497        sizeof( HASHTABLEENTRY ),
     498        sortHashtableSYMs);
     499 
     500  // write to file
     501  fprintf(file,
     502          "Module ---- Status --------------------------------------------------------\n");
     503  for(int i = 0;
     504      i < iEntries;
     505      i++)
     506  {
     507    LXSymbolFile* p = (LXSymbolFile*)arrEntries[i].pObject;
     508    fprintf(file,
     509            "%-10s %s (%s)\n",
     510            p->getName(),
     511            p->getFileName(),
     512            (p->getErrorMessage() != NULL) ? p->getErrorMessage() : "");
     513  }
     514}
  • trunk/src/odinprof/symfile.h

    r7423 r7427  
    1 /* $Id: symfile.h,v 1.2 2001-11-22 11:34:44 phaller Exp $ */
     1/* $Id: symfile.h,v 1.3 2001-11-22 13:35:42 phaller Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    164164                         ULONG  ulNameBufferLength,
    165165                         PULONG pulSymbolOffset);
     166    void   printSYMs(FILE *file);
    166167
    167168  protected:
Note: See TracChangeset for help on using the changeset viewer.