VirtualBox

Changeset 64300 in vbox


Ignore:
Timestamp:
Oct 17, 2016 2:20:08 PM (8 years ago)
Author:
vboxsync
Message:

VBoxServiceTimeSync.cpp: Correct verbose debug message.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp

    r62679 r64300  
    7171 *
    7272 * It now boils down to these three (configuration) factors:
    73  *  -# g_TimeSyncMinAdjust - The minimum drift we will ever bother with.
     73 *  -# g_cMsTimeSyncMinAdjust - The minimum drift we will ever bother with.
    7474 *  -# g_TimeSyncLatencyFactor - The factor we multiply the latency by to
    7575 *     calculate the dynamic minimum adjust factor.
    76  *  -# g_TimeSyncMaxLatency - When to start discarding the data as utterly
     76 *  -# g_cMsTimeSyncMaxLatency - When to start discarding the data as utterly
    7777 *     useless and take a rest (someone is too busy to give us good data).
    7878 *  -# g_TimeSyncSetThreshold - The threshold at which we will just set the time
     
    109109static uint32_t         g_TimeSyncInterval = 0;
    110110/**
    111  * @see pg_vboxservice_timesync
     111 * @see pg_vgsvc_timesync
    112112 *
    113113 * @remark  OS/2: There is either a 1 second resolution on the DosSetDateTime
     
    116116 */
    117117#ifdef RT_OS_OS2
    118 static uint32_t         g_TimeSyncMinAdjust = 1000;
     118static uint32_t         g_cMsTimeSyncMinAdjust = 1000;
    119119#else
    120 static uint32_t         g_TimeSyncMinAdjust = 100;
     120static uint32_t         g_cMsTimeSyncMinAdjust = 100;
    121121#endif
    122 /** @see pg_vboxservice_timesync */
     122/** @see pg_vgsvc_timesync */
    123123static uint32_t         g_TimeSyncLatencyFactor = 8;
    124 /** @see pg_vboxservice_timesync */
    125 static uint32_t         g_TimeSyncMaxLatency = 250;
    126 /** @see pg_vboxservice_timesync */
     124/** @see pg_vgsvc_timesync */
     125static uint32_t         g_cMsTimeSyncMaxLatency = 250;
     126/** @see pg_vgsvc_timesync */
    127127static uint32_t         g_TimeSyncSetThreshold = 20*60*1000;
    128128/** Whether the next adjustment should just set the time instead of trying to
     
    185185            || rc == VERR_NOT_FOUND)
    186186            rc = VGSvcReadPropUInt32(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust",
    187                                      &g_TimeSyncMinAdjust, 0, 3600000);
     187                                     &g_cMsTimeSyncMinAdjust, 0, 3600000);
    188188        if (   RT_SUCCESS(rc)
    189189            || rc == VERR_NOT_FOUND)
     
    193193            || rc == VERR_NOT_FOUND)
    194194            rc = VGSvcReadPropUInt32(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/VBoxService/--timesync-max-latency",
    195                                      &g_TimeSyncMaxLatency, 1, 3600000);
     195                                     &g_cMsTimeSyncMaxLatency, 1, 3600000);
    196196        if (   RT_SUCCESS(rc)
    197197            || rc == VERR_NOT_FOUND)
     
    245245        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncInterval, 50, UINT32_MAX - 1);
    246246    else if (!strcmp(argv[*pi], "--timesync-min-adjust"))
    247         rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncMinAdjust, 0, 3600000);
     247        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_cMsTimeSyncMinAdjust, 0, 3600000);
    248248    else if (!strcmp(argv[*pi], "--timesync-latency-factor"))
    249249        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncLatencyFactor, 1, 1024);
    250250    else if (!strcmp(argv[*pi], "--timesync-max-latency"))
    251         rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncMaxLatency, 1, 3600000);
     251        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_cMsTimeSyncMaxLatency, 1, 3600000);
    252252    else if (!strcmp(argv[*pi], "--timesync-set-threshold"))
    253253        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncSetThreshold, 0, 7*24*60*60*1000); /* a week */
     
    528528            RTTIMESPEC GuestElapsed = GuestNow;
    529529            RTTimeSpecSub(&GuestElapsed, &GuestNow0);
    530             if ((uint32_t)RTTimeSpecGetMilli(&GuestElapsed) < g_TimeSyncMaxLatency)
     530            if ((uint32_t)RTTimeSpecGetMilli(&GuestElapsed) < g_cMsTimeSyncMaxLatency)
    531531            {
    532532                /*
     
    551551                 */
    552552                uint32_t MinAdjust = RTTimeSpecGetMilli(&GuestElapsed) * g_TimeSyncLatencyFactor;
    553                 if (MinAdjust < g_TimeSyncMinAdjust)
    554                     MinAdjust = g_TimeSyncMinAdjust;
     553                if (MinAdjust < g_cMsTimeSyncMinAdjust)
     554                    MinAdjust = g_cMsTimeSyncMinAdjust;
    555555
    556556                RTTIMESPEC Drift = HostNow;
    557557                RTTimeSpecSub(&Drift, &GuestNow);
    558558                if (RTTimeSpecGetMilli(&Drift) < 0)
    559                     MinAdjust += g_TimeSyncMinAdjust; /* extra buffer against moving time backwards. */
     559                    MinAdjust += g_cMsTimeSyncMinAdjust; /* extra buffer against moving time backwards. */
    560560
    561561                RTTIMESPEC AbsDrift = Drift;
     
    591591                break;
    592592            }
    593             VGSvcVerbose(3, "vgsvcTimeSyncWorker: %RDtimespec: latency too high (%RDtimespec) sleeping 1s\n", GuestElapsed);
     593            VGSvcVerbose(3, "vgsvcTimeSyncWorker: %RDtimespec: latency too high (%RDtimespec, max %ums) sleeping 1s\n",
     594                         &GuestNow, &GuestElapsed, g_cMsTimeSyncMaxLatency);
    594595            RTThreadSleep(1000);
    595596        } while (--cTries > 0);
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