PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/base/Applications/BootCount/BootCount.cs

#
C# | 48 lines | 32 code | 9 blank | 7 comment | 0 complexity | dd9ac9e9c1d3e53b66079729ec6996e3 MD5 | raw file
  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft Research Singularity
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. // Note: print and return the boot count.
  8. using System;
  9. using System.IO;
  10. using Microsoft.Contracts;
  11. using Microsoft.SingSharp.Reflection;
  12. using Microsoft.Singularity.V1.Services;
  13. using Microsoft.Singularity.Applications;
  14. using Microsoft.Singularity.Io;
  15. using Microsoft.Singularity.Configuration;
  16. using Microsoft.Singularity.Channels;
  17. [assembly: Transform(typeof(ApplicationResourceTransform))]
  18. namespace Microsoft.Singularity.Applications
  19. {
  20. [ConsoleCategory(HelpMessage="Display and return the boot count", DefaultAction=true)]
  21. internal class Parameters {
  22. [InputEndpoint("data")]
  23. public readonly TRef<UnicodePipeContract.Exp:READY> Stdin;
  24. [OutputEndpoint("data")]
  25. public readonly TRef<UnicodePipeContract.Imp:READY> Stdout;
  26. reflective internal Parameters();
  27. internal int AppMain() {
  28. return BootCount.AppMain(this);
  29. }
  30. }
  31. class BootCount
  32. {
  33. internal static int AppMain(Parameters! config) {
  34. int boots = (int) ProcessService.GetKernelBootCount();
  35. Console.WriteLine(boots);
  36. return boots;
  37. }
  38. }
  39. }