Ignore:
Timestamp:
Feb 4, 2008, 3:08:02 AM (18 years ago)
Author:
bird
Message:

kAVL: Implemented locking, root node and a direct cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kProfiler2/prfreader.cpp.h

    r2 r7  
    266266} KPRF_TYPE(,REPORTMODSEG), *KPRF_TYPE(P,REPORTMODSEG);
    267267
    268 /* Instantiate the AVL tree code. */
    269 #define KAVL_CHECK_FOR_EQUAL_INSERT
    270 #define KAVL_MAX_STACK          32
    271 #define KAVL_STD_KEY_COMP
    272 #define mKey                    offSegment
    273 #define KAVLKEY                 KDBGADDR
    274 #define KAVLNODE                KPRF_TYPE(,REPORTMODSEG)
    275 #define KAVL_FN(name)           KPRF_NAME(ReportTree ## name)
    276 #define KAVL_TYPE(prefix,name)  KPRF_TYPE(prefix, REPORTMODESEG ## name)
    277 #define KAVL_INT(name)          KPRF_NAME(REPORTMODESEGINT ## name)
    278 #define KAVL_DECL(type)         K_DECL_INLINE(type)
    279 #include <k/kAvlTmpl/kAvlBase.h>
    280 #include <k/kAvlTmpl/kAvlDestroy.h>
    281 #include <k/kAvlTmpl/kAvlGet.h>
    282 #include <k/kAvlTmpl/kAvlUndef.h>
    283 
    284268
    285269/**
     
    530514    /** The number of modules in the list. */
    531515    KU32                        cMods;
    532     /** The module segment tree. */
     516    /** The module segment tree. (Only kAvl cares about this.) */
    533517    KPRF_TYPE(P,REPORTMODSEG)   pModSegTree;
    534518    /** The number of module segments in the tree. */
     
    557541
    558542} KPRF_TYPE(,REPORT), *KPRF_TYPE(P,REPORT), **KPRF_TYPE(PP,REPORT);
     543
     544
     545/* Instantiate the AVL tree code. */
     546#define KAVL_CHECK_FOR_EQUAL_INSERT
     547#define KAVL_MAX_STACK          32
     548#define KAVL_STD_KEY_COMP
     549#define mKey                    offSegment
     550#define KAVLKEY                 KDBGADDR
     551#define KAVLNODE                KPRF_TYPE(,REPORTMODSEG)
     552#define mpRoot                  pModSegTree
     553#define KAVLROOT                KPRF_TYPE(,REPORT)
     554#define KAVL_FN(name)           KPRF_NAME(ReportTree ## name)
     555#define KAVL_TYPE(prefix,name)  KPRF_TYPE(prefix, REPORTMODESEG ## name)
     556#define KAVL_INT(name)          KPRF_NAME(REPORTMODESEGINT ## name)
     557#define KAVL_DECL(type)         K_DECL_INLINE(type)
     558#include <k/kAvlTmpl/kAvlBase.h>
     559#include <k/kAvlTmpl/kAvlDestroy.h>
     560#include <k/kAvlTmpl/kAvlGet.h>
     561#include <k/kAvlTmpl/kAvlUndef.h>
    559562
    560563
     
    592595    pReport->pFirstMod = NULL;
    593596    pReport->cMods = 0;
    594     pReport->pModSegTree = NULL;
     597    KPRF_NAME(ReportTreeInit)(pReport);
    595598    pReport->cModSegs = 0;
    596599    pReport->papSortedThreads = (KPRF_TYPE(P,REPORTTHREAD) *)((KU8 *)pReport + offSortedThreads);
     
    637640    }
    638641
    639     KPRF_NAME(ReportTreeDestroy)(&pReport->pModSegTree, KPRF_NAME(DeleteModSeg), NULL);
     642    KPRF_NAME(ReportTreeDestroy)(pReport, KPRF_NAME(DeleteModSeg), NULL);
    640643
    641644    /*
     
    688691        pSeg->cFunctions = 0;
    689692
    690         if (!KPRF_NAME(ReportTreeInsert)(&pReport->pModSegTree, pSeg))
     693        if (!KPRF_NAME(ReportTreeInsert)(pReport, pSeg))
    691694        {
    692695            free(pSeg);
     
    758761        pReport->papSortedFunctions[iFunc] = pReportFunc;
    759762        pReportFunc->pFunc = pFunc;
    760         pReportFunc->pModSeg = KPRF_NAME(ReportTreeGet)(&pReport->pModSegTree, pFunc->offModSeg);
     763        pReportFunc->pModSeg = KPRF_NAME(ReportTreeGet)(pReport, pFunc->offModSeg);
    761764        pReportFunc->pSym = NULL;
    762765        pReportFunc->pLine = NULL;
Note: See TracChangeset for help on using the changeset viewer.