Index: /trunk/src/VBox/Main/webservice/vboxweb.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 61360)
+++ /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 61361)
@@ -1446,4 +1446,6 @@
     WEBDEBUG(("Watchdog thread started\n"));
 
+    uint32_t tNextStat = 0;
+
     while (g_fKeepRunning)
     {
@@ -1451,6 +1453,5 @@
         RTThreadSleep(g_iWatchdogCheckInterval * 1000);
 
-        time_t                      tNow;
-        time(&tNow);
+        uint32_t tNow = RTTimeProgramSecTS();
 
         // we're messing with websessions, so lock them
@@ -1482,4 +1483,26 @@
                 pSystemProperties->COMSETTER(WebServiceAuthLibrary)(com::Bstr(g_pcszAuthentication).raw());
         }
+
+        // Log some MOR usage statistics every 5 minutes, but only if there's
+        // something worth logging (at least one reference or a transition to
+        // zero references). Avoids useless log spamming in idle webservice.
+        if (tNow >= tNextStat)
+        {
+            size_t cMOR = 0;
+            it = g_mapWebsessions.begin();
+            itEnd = g_mapWebsessions.end();
+            while (it != itEnd)
+            {
+                cMOR += it->second->CountRefs();
+                ++it;
+            }
+            static bool fLastZero = false;
+            if (cMOR || !fLastZero)
+                LogRel(("Statistics: %zu websessions, %zu references\n",
+                        g_mapWebsessions.size(), cMOR));
+            fLastZero = (cMOR == 0);
+            while (tNextStat <= tNow)
+                tNextStat += 5 * 60; /* 5 minutes */
+        }
     }
 
@@ -2012,5 +2035,13 @@
 void WebServiceSession::touch()
 {
-    time(&_tLastObjectLookup);
+    _tLastObjectLookup = RTTimeProgramSecTS();
+}
+
+/**
+ * Counts the number of managed object references in this websession.
+ */
+size_t WebServiceSession::CountRefs()
+{
+    return _pp->_mapManagedObjectsById.size();
 }
 
Index: /trunk/src/VBox/Main/webservice/vboxweb.h
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.h	(revision 61360)
+++ /trunk/src/VBox/Main/webservice/vboxweb.h	(revision 61361)
@@ -3,5 +3,5 @@
  *      header file for "real" web server code.
  *
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -104,5 +104,5 @@
         bool                        _fDestructing;
 
-        time_t                      _tLastObjectLookup;
+        uint32_t                    _tLastObjectLookup;
 
         // hide the copy constructor because we're not copyable
@@ -133,5 +133,5 @@
         void touch();
 
-        time_t getLastObjectLookup() const
+        uint32_t getLastObjectLookup() const
         {
             return _tLastObjectLookup;
@@ -140,5 +140,5 @@
         static WebServiceSession* findWebsessionFromRef(const WSDLT_ID &id);
 
-        void DumpRefs();
+        size_t CountRefs();
 };
 
