VirtualBox

Changeset 47973 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Aug 21, 2013 2:25:52 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88291
Message:

VBoxService/VBoxTray: User idle detection: Lower last input time granularity from milliseconds to seconds in order to also support periods > 49 days in a row.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp

    r47962 r47973  
    835835                                           NULL /* Exact read */);
    836836            if (   RT_SUCCESS(rc)
    837                 /* If uLastInputMs is set to UINT32_MAX VBoxTray was not able to retrieve the
     837                /* If uLastInput is set to UINT32_MAX VBoxTray was not able to retrieve the
    838838                 * user's last input time. This might happen when running on Windows NT4 or older. */
    839                 && ipcRes.uLastInputMs != UINT32_MAX)
     839                && ipcRes.uLastInput != UINT32_MAX)
    840840            {
    841                 VBoxGuestUserState userState = ipcRes.uLastInputMs < g_uVMInfoUserIdleThreshold
     841                VBoxGuestUserState userState = (ipcRes.uLastInput * 1000) < g_uVMInfoUserIdleThresholdMS
    842842                                             ? VBoxGuestUserState_InUse
    843843                                             : VBoxGuestUserState_Idle;
     
    854854                if (rc == VINF_SUCCESS)
    855855                {
    856                     VBoxServiceVerbose(4, "User \"%s\" (domain \"%s\") is idle for %RU32ms\n",
    857                                        pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInputMs);
     856                    VBoxServiceVerbose(4, "User \"%s\" (domain \"%s\") is idle for %RU32s\n",
     857                                       pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInput);
    858858
    859859#if 0 /* Do we want to write the idle time as well? */
     
    873873            }
    874874#ifdef DEBUG
    875             else if (ipcRes.uLastInputMs == UINT32_MAX)
     875            else if (ipcRes.uLastInput == UINT32_MAX)
    876876                VBoxServiceVerbose(4, "Last input for user \"%s\" is not available, skipping\n",
    877877                                   pszUser, rc);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r47449 r47973  
    111111/** The current LA client info. */
    112112static VBOXSERVICELACLIENTINFO  g_LAClientInfo;
    113 /** User idle threshold. This specifies the minimum time a user is considered
    114  *  being idle and then will be reported to the host. Default is 5s. */
    115 uint32_t                        g_uVMInfoUserIdleThreshold = 5 * 1000;
     113/** User idle threshold (in ms). This specifies the minimum time a user is considered
     114 *  as being idle and then will be reported to the host. Default is 5s. */
     115uint32_t                        g_uVMInfoUserIdleThresholdMS = 5 * 1000;
    116116
    117117
     
    172172    else if (!strcmp(argv[*pi], "--vminfo-user-idle-threshold"))
    173173        rc = VBoxServiceArgUInt32(argc, argv, "", pi,
    174                                   &g_uVMInfoUserIdleThreshold, 1, UINT32_MAX - 1);
     174                                  &g_uVMInfoUserIdleThresholdMS, 1, UINT32_MAX - 1);
    175175    return rc;
    176176}
     
    256256        {
    257257            AssertPtr(pszValue);
    258             g_uVMInfoUserIdleThreshold = RT_CLAMP(RTStrToUInt32(pszValue), 1000, UINT32_MAX - 1);
     258            g_uVMInfoUserIdleThresholdMS = RT_CLAMP(RTStrToUInt32(pszValue), 1000, UINT32_MAX - 1);
    259259            RTStrFree(pszValue);
    260260        }
     
    14871487    "    --vminfo-user-idle-threshold <ms>\n"
    14881488    "                            Specifies the user idle threshold (in ms) for\n"
    1489     "                            considering a guest user being as idle. The default\n"
     1489    "                            considering a guest user as being idle. The default\n"
    14901490    "                            is 5000 (5 seconds).\n"
    14911491    ,
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.h

    r47335 r47973  
    2626//RT_C_DECLS_END
    2727
    28 extern uint32_t g_uVMInfoUserIdleThreshold;
     28extern uint32_t g_uVMInfoUserIdleThresholdMS;
    2929
    3030#endif /* ___VBoxServiceVMInfo_h */
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