private void ExecThread() { Thread.Sleep(WARMUP_DELAY_MS); while (true) { try { InstrumentationLogger.LogInfo("VersionInfo", GetVersionString()); InstrumentationLogger.FORCE_LogInfo("Heartbeat-Uptime-s", DateTime.Now.Subtract(startTime) .TotalSeconds.ToString(CultureInfo.InvariantCulture)); String usage = PackFrequencyDict(ComputeNodeFrequencies()); String errors = PackFrequencyDict(ComputeErrorFrequencies()); InstrumentationLogger.LogInfo("Node-usage", usage); InstrumentationLogger.LogInfo("Nodes-with-errors", errors); } catch (Exception e) { Debug.WriteLine("Exception in Heartbeat " + e); } Thread.Sleep(HEARTBEAT_INTERVAL_MS); } }
private void ExecThread() { Thread.Sleep(WARMUP_DELAY_MS); while (true) { try { InstrumentationLogger.LogInfo("VersionInfo", GetVersionString()); var difference = DateTime.Now.Subtract(startTime).TotalSeconds; InstrumentationLogger.FORCE_LogInfo("Heartbeat-Uptime-s", difference.ToString(CultureInfo.InvariantCulture)); String usage = PackFrequencyDict(ComputeNodeFrequencies()); String errors = PackFrequencyDict(ComputeErrorFrequencies()); InstrumentationLogger.LogInfo("Node-usage", usage); InstrumentationLogger.LogInfo("Nodes-with-errors", errors); } catch (Exception e) { Debug.WriteLine("Exception in Heartbeat " + e); } // The following call will return "true" if the event is // signaled, which can only happen when "DestroyInternal" // is called as the application is shutting down. Otherwise, // when the wait time ellapsed, the loop continues to log // the next set of information. // if (shutdownEvent.WaitOne(HEARTBEAT_INTERVAL_MS)) { break; } } }