VirtualBox

Changeset 12678 in vbox for trunk/src


Ignore:
Timestamp:
Sep 24, 2008 7:28:21 AM (16 years ago)
Author:
vboxsync
Message:

PerfAPI: Handling of trailing colon in filter patterns

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Performance.cpp

    r12400 r12678  
    463463}
    464464
    465 /* The following method was borrowed from VMM/STAM.cpp */
    466 bool Filter::patternMatch(const char *pszPat, const char *pszName)
    467 {
     465/* The following method was borrowed from VMM/STAM.cpp and modified to handle
     466 * the special case of trailing colon in the pattern.
     467 */
     468bool Filter::patternMatch(const char *pszPat, const char *pszName,
     469                          bool fSeenColon)
     470{
     471    bool seenColon = fSeenColon;
    468472    /* ASSUMES ASCII */
    469473    for (;;)
     
    473477        {
    474478            default:
     479                /* Handle a special case, the mask terminating with a colon */
     480                if (chPat == ':')
     481                {
     482                    if (!seenColon && !*(pszPat + 1))
     483                        return !*pszName;
     484                    seenColon = true;
     485                }
    475486                if (*pszName != chPat)
    476487                    return false;
     
    482493                    /* nothing */;
    483494
     495                /* Handle a special case, the mask terminating with a colon */
     496                if (chPat == ':')
     497                {
     498                    if (!seenColon && !*(pszPat + 1))
     499                        return !strchr(pszName, ':');
     500                    seenColon = true;
     501                }
    484502                for (;;)
    485503                {
     
    487505                    if (    ch == chPat
    488506                        &&  (   !chPat
    489                              || patternMatch(pszPat + 1, pszName)))
     507                             || patternMatch(pszPat + 1, pszName, seenColon)))
    490508                        return true;
    491509                    if (!ch)
  • trunk/src/VBox/Main/darwin/PerformanceDarwin.cpp

    r12400 r12678  
    149149        return RTErrConvertFromDarwin(rc);
    150150    }
    151     else if (nb < sizeof(*tinfo))
     151    else if ((unsigned int)nb < sizeof(*tinfo))
    152152    {
    153153        Log(("proc_pidinfo() -> too few bytes %d", nb));
  • trunk/src/VBox/Main/include/Performance.h

    r12546 r12678  
    376376        Filter(ComSafeArrayIn(INPTR BSTR, metricNames),
    377377               ComSafeArrayIn(IUnknown * , objects));
    378         static bool patternMatch(const char *pszPat, const char *pszName);
     378        static bool patternMatch(const char *pszPat, const char *pszName,
     379                                 bool fSeenColon = false);
    379380        bool match(const ComPtr<IUnknown> object, const std::string &name) const;
    380381    private:
Note: See TracChangeset for help on using the changeset viewer.

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