VirtualBox

Changeset 12818 in vbox for trunk/src


Ignore:
Timestamp:
Sep 30, 2008 1:33:38 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37173
Message:

STAM,IOM: force sort order compatability with file system hierarchy to fix some assumptions in the qt4 stats viewer.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/IOM.cpp

    r12772 r12818  
    409409            rc = STAMR3RegisterF(pVM, &pPort->InRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-RZ", Port); AssertRC(rc);
    410410            rc = STAMR3RegisterF(pVM, &pPort->OutRZ,    STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-RZ", Port); AssertRC(rc);
    411             rc = STAMR3RegisterF(pVM, &pPort->InRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-RZ-2-R3", Port); AssertRC(rc);
    412             rc = STAMR3RegisterF(pVM, &pPort->OutRZToR3,STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-RZ-2-R3", Port); AssertRC(rc);
     411            rc = STAMR3RegisterF(pVM, &pPort->InRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-In-RZtoR3", Port); AssertRC(rc);
     412            rc = STAMR3RegisterF(pVM, &pPort->OutRZToR3,STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc,    "/IOM/Ports/%04x-Out-RZtoR3", Port); AssertRC(rc);
    413413
    414414            /* Profiling */
     
    460460            rc = STAMR3RegisterF(pVM, &pStats->ReadRZ,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZ", GCPhys); AssertRC(rc);
    461461            rc = STAMR3RegisterF(pVM, &pStats->WriteRZ,     STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZ", GCPhys); AssertRC(rc);
    462             rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZ-2-R3", GCPhys); AssertRC(rc);
    463             rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZ-2-R3", GCPhys); AssertRC(rc);
     462            rc = STAMR3RegisterF(pVM, &pStats->ReadRZToR3,  STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Read-RZtoR3", GCPhys); AssertRC(rc);
     463            rc = STAMR3RegisterF(pVM, &pStats->WriteRZToR3, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, pszDesc, "/IOM/MMIO/%RGp-Write-RZtoR3", GCPhys); AssertRC(rc);
    464464
    465465            /* Profiling */
  • trunk/src/VBox/VMM/STAM.cpp

    r11311 r12818  
    474474
    475475/**
     476 * Divide the strings into sub-strings using '/' as delimiter
     477 * and then compare them in strcmp fashion.
     478 *
     479 * @returns Difference.
     480 * @retval  0 if equal.
     481 * @retval  < 0 if psz1 is less than psz2.
     482 * @retval  > 0 if psz1 greater than psz2.
     483 *
     484 * @param   psz1        The first string.
     485 * @param   psz2        The second string.
     486 */
     487static int stamR3SlashCompare(const char *psz1, const char *psz2)
     488{
     489    for (;;)
     490    {
     491        unsigned int ch1 = *psz1++;
     492        unsigned int ch2 = *psz2++;
     493        if (ch1 != ch2)
     494        {
     495            /* slash is end-of-sub-string, so it trumps everything but '\0'. */
     496            if (ch1 == '/')
     497                return ch2 ? -1 : 1;
     498            if (ch2 == '/')
     499                return ch1 ? 1 : -1;
     500            return ch1 - ch2;
     501        }
     502
     503        /* done? */
     504        if (ch1 == '\0')
     505            return 0;
     506    }
     507}
     508
     509
     510/**
    476511 * Internal worker for the different register calls.
    477512 *
     
    517552        pCur = pCur->pNext;
    518553    }
     554
     555    /*
     556     * Check that the name doesn't screw up sorting order when taking
     557     * slashes into account. The QT4 GUI makes some assumptions.
     558     * Problematic chars are: !"#$%&'()*+,-.
     559     */
     560    Assert(pszName[0] == '/');
     561    if (pPrev)
     562        Assert(stamR3SlashCompare(pPrev->pszName, pszName) < 0);
     563    if (pCur)
     564        Assert(stamR3SlashCompare(pCur->pszName, pszName) > 0);
    519565
    520566    /*
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