VirtualBox

Ignore:
Timestamp:
Jun 7, 2013 4:18:29 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86286
Message:

STAM: Registration optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/STAMInternal.h

    r46438 r46443  
    2424#include <VBox/vmm/gvmm.h>
    2525#include <VBox/vmm/gmm.h>
     26#include <iprt/list.h>
    2627#include <iprt/semaphore.h>
    2728
     
    3637 */
    3738
     39/** Enables the lookup tree.
     40 * This is an optimization for speeding up registration as well as query. */
     41#define STAM_WITH_LOOKUP_TREE
     42
     43
     44/** Pointer to sample descriptor. */
     45typedef struct STAMDESC    *PSTAMDESC;
     46/** Pointer to a sample lookup node. */
     47typedef struct STAMLOOKUP  *PSTAMLOOKUP;
     48
     49/**
     50 * Sample lookup node.
     51 */
     52typedef struct STAMLOOKUP
     53{
     54    /** The parent lookup record. This is NULL for the root node. */
     55    PSTAMLOOKUP         pParent;
     56    /** Array of children (using array for binary searching). */
     57    PSTAMLOOKUP        *papChildren;
     58    /** Pointer to the description node, if any. */
     59    PSTAMDESC           pDesc;
     60    /** Number of decentants with descriptors. (Use for freeing up sub-trees.) */
     61    uint32_t            cDescsInTree;
     62    /** The number of children. */
     63    uint16_t            cChildren;
     64    /** The index in the parent paChildren array. UINT16_MAX for the root node. */
     65    uint16_t            iParent;
     66    /** The path offset. */
     67    uint16_t            off;
     68    /** The size of the path component. */
     69    uint16_t            cch;
     70    /** The name (variable size). */
     71    char                szName[1];
     72} STAMLOOKUP;
     73
     74
    3875/**
    3976 * Sample descriptor.
     
    4178typedef struct STAMDESC
    4279{
    43     /** Pointer to the next sample. */
    44     struct STAMDESC    *pNext;
     80    /** Our entry in the big linear list. */
     81    RTLISTNODE          ListEntry;
     82    /** Pointer to our lookup node. */
     83    PSTAMLOOKUP         pLookup;
    4584    /** Sample name. */
    4685    const char         *pszName;
     
    88127    const char         *pszDesc;
    89128} STAMDESC;
    90 /** Pointer to sample descriptor. */
    91 typedef STAMDESC        *PSTAMDESC;
    92 /** Pointer to const sample descriptor. */
    93 typedef const STAMDESC  *PCSTAMDESC;
    94129
    95130
     
    99134typedef struct STAMUSERPERVM
    100135{
    101     /** Pointer to the first sample. */
    102     R3PTRTYPE(PSTAMDESC)    pHead;
    103     /** Lookup hint (pPrev value). */
    104     R3PTRTYPE(PSTAMDESC)    pHint;
    105     /** RW Lock for the list. */
     136    /** List of samples. */
     137    RTLISTANCHOR            List;
     138    /** Root of the lookup tree. */
     139    PSTAMLOOKUP             pRoot;
     140
     141    /** RW Lock for the list and tree. */
    106142    RTSEMRW                 RWSem;
    107     /** Alignment padding. */
    108     RTR3PTR                 Alignment;
    109143
    110144    /** The copy of the GVMM statistics. */
     
    118152    GMMSTATS                GMMStats;
    119153} STAMUSERPERVM;
     154#ifdef IN_RING3
    120155AssertCompileMemberAlignment(STAMUSERPERVM, GMMStats, 8);
     156#endif
    121157
    122158/** Pointer to the STAM data kept in the UVM. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette