VirtualBox

Ignore:
Timestamp:
Nov 16, 2018 12:03:41 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126655
Message:

HGCM,Main,SharedFolder,SharedClipboard,GuestProperties: Added HGCM service helpers for statistics and dbg info registration/deregistration. A PUVM is passed to HGCMService (where the helpers are implemented) when the service is loaded. Since this drags in both dbg.h and stam.h, LOG_GROUP defines now have to be at the top of the include list as everywhere else (i.e. hgcmsvc.h will define LOG_GROUP default by dragging in log.h). Added generic statistics of HGCM message processing and function level statistics to the shared folder service. [missing files, ++]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestProperties/service.cpp

    r73511 r75498  
    394394    }
    395395
    396 #ifdef ASYNC_HOST_NOTIFY
    397396    int initialize();
    398 #endif
    399397
    400398private:
     
    422420    int hostCall(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    423421    int uninit();
    424     void dbgInfoShow(PCDBGFINFOHLP pHlp);
    425422    static DECLCALLBACK(void) dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
    426423
     
    14391436static DECLCALLBACK(int) dbgInfoCallback(PRTSTRSPACECORE pStr, void *pvUser)
    14401437{
    1441     Property *pProp = (Property *)pStr;
    1442     PCDBGFINFOHLP pHlp = ((ENUMDBGINFO*)pvUser)->pHlp;
     1438    Property     *pProp = (Property *)pStr;
     1439    PCDBGFINFOHLP pHlp  = ((ENUMDBGINFO *)pvUser)->pHlp;
    14431440
    14441441    char szFlags[GUEST_PROP_MAX_FLAGS_LEN];
     
    14471444        RTStrPrintf(szFlags, sizeof(szFlags), "???");
    14481445
    1449     pHlp->pfnPrintf(pHlp, "%s: '%s', %RU64",
    1450                     pProp->mName.c_str(), pProp->mValue.c_str(), pProp->mTimestamp);
     1446    pHlp->pfnPrintf(pHlp, "%s: '%s', %RU64", pProp->mName.c_str(), pProp->mValue.c_str(), pProp->mTimestamp);
    14511447    if (strlen(szFlags))
    14521448        pHlp->pfnPrintf(pHlp, " (%s)", szFlags);
     
    14551451}
    14561452
    1457 void Service::dbgInfoShow(PCDBGFINFOHLP pHlp)
    1458 {
    1459     ENUMDBGINFO EnumData = { pHlp };
    1460     RTStrSpaceEnumerate(&mhProperties, dbgInfoCallback, &EnumData);
    1461 }
    14621453
    14631454/**
     
    14681459 * @param   pszArgs     Arguments, ignored.
    14691460 */
    1470 void Service::dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs)
     1461DECLCALLBACK(void) Service::dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs)
    14711462{
    14721463    RT_NOREF1(pszArgs);
    14731464    SELF *pSelf = reinterpret_cast<SELF *>(pvUser);
    1474     pSelf->dbgInfoShow(pHlp);
     1465
     1466    ENUMDBGINFO EnumData = { pHlp };
     1467    RTStrSpaceEnumerate(&pSelf->mhProperties, dbgInfoCallback, &EnumData);
    14751468}
    14761469
     
    15421535                break;
    15431536
    1544             case GUEST_PROP_FN_HOST_GET_DBGF_INFO:
    1545                 if (cParms != 2)
    1546                     return VERR_INVALID_PARAMETER;
    1547                 paParms[0].u.pointer.addr = (void*)(uintptr_t)dbgInfo;
    1548                 paParms[1].u.pointer.addr = (void*)this;
    1549                 break;
    1550 
    15511537            default:
    15521538                rc = VERR_NOT_SUPPORTED;
     
    15641550
    15651551#ifdef ASYNC_HOST_NOTIFY
     1552
    15661553/* static */
    15671554DECLCALLBACK(int) Service::threadNotifyHost(RTTHREAD hThreadSelf, void *pvUser)
     
    15961583}
    15971584
     1585#endif /* ASYNC_HOST_NOTIFY */
     1586
    15981587int Service::initialize()
    15991588{
     1589#ifdef ASYNC_HOST_NOTIFY
    16001590    /* The host notification thread and queue. */
    16011591    int rc = RTReqQueueCreate(&mhReqQNotifyHost);
     
    16191609        }
    16201610    }
     1611#else  /* !ASYNC_HOST_NOTIFY */
     1612    int rc = VINF_SUCCESS;
     1613#endif /* !ASYNC_HOST_NOTIFY */
     1614
     1615    /* Finally debug stuff (ignore failures): */
     1616    if (RT_SUCCESS(rc))
     1617        HGCMSvcHlpInfoRegister(mpHelpers, "guestprops", "Display the guest properties", Service::dbgInfo, this);
    16211618
    16221619    return rc;
    16231620}
    16241621
     1622#ifdef ASYNC_HOST_NOTIFY
    16251623/**
    16261624 * @callback_method_impl{FNRTSTRSPACECALLBACK, Destroys Property.}
     
    16381636int Service::uninit()
    16391637{
     1638    if (mpHelpers)
     1639        HGCMSvcHlpInfoDeregister(mpHelpers, "guestprops");
     1640
    16401641#ifdef ASYNC_HOST_NOTIFY
    16411642    if (mhReqQNotifyHost != NIL_RTREQQUEUE)
     
    16561657    }
    16571658#endif
    1658 
    16591659    return VINF_SUCCESS;
    16601660}
     
    16671667 * @copydoc VBOXHGCMSVCLOAD
    16681668 */
    1669 extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable)
     1669extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad(VBOXHGCMSVCFNTABLE *ptable)
    16701670{
    16711671    int rc = VERR_IPE_UNINITIALIZED_STATUS;
     
    17131713                ptable->pfnLoadState          = NULL;  /* construction done before restoring suffices */
    17141714                ptable->pfnRegisterExtension  = Service::svcRegisterExtension;
     1715                ptable->pvService             = pService;
    17151716
    17161717                /* Service specific initialization. */
    1717                 ptable->pvService = pService;
    1718 
    1719 #ifdef ASYNC_HOST_NOTIFY
    17201718                rc = pService->initialize();
    17211719                if (RT_FAILURE(rc))
     
    17241722                    pService = NULL;
    17251723                }
    1726 #endif
    17271724            }
    17281725            else
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