NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Monitor.Server.Billboard Class Reference

Static Public Member Functions

static string Jobs (IEnumerable< Job > jobs)
 
static string Proc (IEnumerable< Job > jobs)
 
static string Running (IEnumerable< Job > jobs)
 
static string Schedule (IEnumerable< ScheduledJob > jobs)
 

Detailed Description

Definition at line 31 of file Billboard.cs.

Member Function Documentation

static string Ntp.Analyzer.Monitor.Server.Billboard.Jobs ( IEnumerable< Job jobs)
inlinestatic

Definition at line 33 of file Billboard.cs.

References Ntp.Common.Process.Job.Description, Ntp.Common.Process.JobScheduleDescription.FixedRun, Ntp.Common.Process.JobScheduleDescription.Frequency, Ntp.Common.Process.JobScheduleDescription.InitialRun, Ntp.Common.Process.Job.JobId, Ntp.Common.Process.JobDescription.JobType, Ntp.Common.Process.JobDescription.Name, Ntp.Common.Process.JobDescription.Priority, Ntp.Common.Process.Job.Queued, Ntp.Common.Process.Job.RunCount, Ntp.Common.Process.Job.Running, and Ntp.Common.Process.Job.Schedule.

Referenced by Ntp.Analyzer.Process.Description.NotifyJob.BuildContent(), and Ntp.Analyzer.Monitor.Server.TextCommand.JobsCommand.ExecuteTextCommand().

34  {
35  var builder = new StringBuilder();
36 
37  builder.Append("ID".PadRight(3));
38  builder.Append("Act".PadRight(4));
39  builder.Append("Job".PadRight(15));
40  builder.Append("Que".PadLeft(5));
41  builder.Append("Ini".PadLeft(5));
42  builder.Append("Fix".PadLeft(5));
43  builder.Append("Freq".PadLeft(6));
44  builder.Append("Prio".PadLeft(5));
45  builder.Append("Runs".PadLeft(6));
46  builder.Append(" ");
47  builder.Append("Description");
48  builder.AppendLine();
49 
50  const int size = 3 + 4 + 15 + 5 + 5 + 5 + 6 + 5 + 6 + 3 + 25;
51 
52  builder.AppendLine(string.Empty.PadLeft(size, '-'));
53 
54  IEnumerable<Job> orderedJobs = jobs.OrderBy(j => j.Description.Priority);
55 
56  foreach (Job job in orderedJobs)
57  {
58  builder.Append(job.JobId.ToString("00").PadRight(3));
59  builder.Append(job.Running ? " * " : " ");
60  builder.Append(
61  string.IsNullOrWhiteSpace(job.Description.Name)
62  ? "Unnamed".PadRight(15)
63  : job.Description.Name.
64  Substring(0, job.Description.Name.Length > 15 ? 15 : job.Description.Name.Length).
65  PadRight(15)
66  );
67  builder.Append((job.Queued ? " 1" : " 0").PadLeft(5));
68  builder.Append((job.Schedule.InitialRun ? " 1" : " 0").PadLeft(5));
69  builder.Append((job.Schedule.FixedRun ? " 1" : " 0").PadLeft(5));
70  builder.Append(job.Schedule.Frequency.ToString(CultureInfo.InvariantCulture).PadLeft(6));
71  builder.Append(job.Description.Priority.ToString(CultureInfo.InvariantCulture).PadLeft(5));
72  builder.Append(job.RunCount.ToString(CultureInfo.InvariantCulture).PadLeft(6));
73  builder.Append(" ");
74  builder.Append(job.Description.JobType);
75  builder.AppendLine();
76  }
77 
78  builder.AppendLine(string.Empty.PadLeft(size, '-'));
79 
80  return builder.ToString();
81  }
bool Queued
Gets or sets a value indicating whether this Job is queued for run.
Definition: Job.cs:77
abstract int Priority
Gets the priority to use when scheduling jobs.
bool InitialRun
Gets a value indicating whether this JobScheduleDescription should do an initial run upon first call...
JobScheduleDescription Schedule
Gets the schedule.
Definition: Job.cs:65
abstract string JobType
Gets the type of the job as text.
int RunCount
Gets the number of times this Job have been executed.
Definition: Job.cs:101
int Frequency
Gets the schedule frequency in minutes.
bool Running
Gets or sets a value indicating whether this Job is running.
Definition: Job.cs:89
bool FixedRun
Gets a value indicating whether this JobScheduleDescription has a fixed schedule frequency, eg. cannot be moved.
int JobId
Gets the job identifier.
Definition: Job.cs:59
JobDescription Description
Gets the description.
Definition: Job.cs:71

Here is the caller graph for this function:

static string Ntp.Analyzer.Monitor.Server.Billboard.Proc ( IEnumerable< Job jobs)
inlinestatic

Definition at line 83 of file Billboard.cs.

References Ntp.Common.Process.Job.Description, Ntp.Common.Process.JobScheduleDescription.FixedRun, Ntp.Common.Process.JobScheduleDescription.Frequency, Ntp.Common.Process.JobScheduleDescription.InitialRun, Ntp.Common.Process.Job.JobId, Ntp.Common.Process.JobDescription.Name, Ntp.Common.Process.JobDescription.Priority, Ntp.Common.Process.Job.RunCount, Ntp.Common.Process.Job.Schedule, Ntp.Common.Process.Job.State, and Ntp.Common.Process.Job.TotalRuntime.

Referenced by Ntp.Analyzer.Monitor.Server.TextCommand.ProcCommand.ExecuteTextCommand().

84  {
85  var builder = new StringBuilder();
86 
87  builder.Append("ID".PadRight(4));
88  builder.Append("Job".PadRight(16));
89  builder.Append("Ini".PadLeft(5));
90  builder.Append("Fix".PadLeft(5));
91  builder.Append("Freq".PadLeft(7));
92  builder.Append("Prio".PadLeft(6));
93  builder.Append("Runs".PadLeft(5));
94  builder.Append(" ");
95  builder.Append("State".PadRight(12));
96  builder.Append("Time".PadRight(15));
97  builder.AppendLine();
98 
99  const int size = 4 + 16 + 5 + 5 + 7 + 6 + 5 + 3 + 12 + 15 + 2;
100 
101  builder.AppendLine(string.Empty.PadLeft(size, '-'));
102 
103  IEnumerable<Job> orderedJobs = jobs.OrderBy(j => j.JobId);
104 
105  foreach (Job job in orderedJobs)
106  {
107  builder.Append(job.JobId.ToString("00").PadRight(4));
108  builder.Append(
109  job.Description.Name.Substring(0,
110  job.Description.Name.Length > 15 ? 15 : job.Description.Name.Length).PadRight(15));
111  builder.Append((job.Schedule.InitialRun ? " 1" : " 0").PadLeft(5));
112  builder.Append((job.Schedule.FixedRun ? " 1" : " 0").PadLeft(5));
113  builder.Append(job.Schedule.Frequency.ToString(CultureInfo.InvariantCulture).PadLeft(7));
114  builder.Append(job.Description.Priority.ToString(CultureInfo.InvariantCulture).PadLeft(6));
115  builder.Append(job.RunCount.ToString(CultureInfo.InvariantCulture).PadLeft(6));
116  builder.Append(" ");
117  builder.Append(job.State.PadRight(12));
118  builder.Append(job.TotalRuntime.PadLeft(15).Substring(0, 15));
119  builder.AppendLine();
120  }
121 
122  builder.AppendLine(string.Empty.PadLeft(size, '-'));
123 
124  return builder.ToString();
125  }
abstract int Priority
Gets the priority to use when scheduling jobs.
string State
Gets the current state of this Job.
Definition: Job.cs:108
bool InitialRun
Gets a value indicating whether this JobScheduleDescription should do an initial run upon first call...
JobScheduleDescription Schedule
Gets the schedule.
Definition: Job.cs:65
int RunCount
Gets the number of times this Job have been executed.
Definition: Job.cs:101
int Frequency
Gets the schedule frequency in minutes.
string TotalRuntime
Gets the total time this Job have been running.
Definition: Job.cs:130
bool FixedRun
Gets a value indicating whether this JobScheduleDescription has a fixed schedule frequency, eg. cannot be moved.
int JobId
Gets the job identifier.
Definition: Job.cs:59
JobDescription Description
Gets the description.
Definition: Job.cs:71

Here is the caller graph for this function:

static string Ntp.Analyzer.Monitor.Server.Billboard.Running ( IEnumerable< Job jobs)
inlinestatic

Definition at line 127 of file Billboard.cs.

References Ntp.Common.Process.Job.Description, Ntp.Common.Process.JobScheduleDescription.FixedRun, Ntp.Common.Process.JobScheduleDescription.Frequency, Ntp.Common.Process.JobScheduleDescription.InitialRun, Ntp.Common.Process.Job.JobId, Ntp.Common.Process.JobDescription.Name, Ntp.Common.Process.JobDescription.Priority, Ntp.Common.Process.Job.RunCount, Ntp.Common.Process.Job.Runtime, Ntp.Common.Process.Job.Schedule, and Ntp.Common.Process.Job.State.

Referenced by Ntp.Analyzer.Monitor.Server.TextCommand.RunningCommand.ExecuteTextCommand().

128  {
129  var list = jobs.ToList();
130  if (list.Count(j => j.Running) == 0)
131  {
132  return "No jobs are currently running.";
133  }
134 
135  var builder = new StringBuilder();
136 
137  builder.Append("ID".PadRight(4));
138  builder.Append("Job".PadRight(16));
139  builder.Append("Ini".PadLeft(5));
140  builder.Append("Fix".PadLeft(5));
141  builder.Append("Freq".PadLeft(7));
142  builder.Append("Prio".PadLeft(6));
143  builder.Append("Runs".PadLeft(5));
144  builder.Append(" ");
145  builder.Append("State".PadRight(12));
146  builder.Append("Time".PadRight(15));
147  builder.AppendLine();
148 
149  const int size = 4 + 16 + 5 + 5 + 7 + 6 + 5 + 3 + 12 + 15 + 2;
150 
151  builder.AppendLine(string.Empty.PadLeft(size, '-'));
152 
153  IEnumerable<Job> orderedJobs = list.Where(j => j.Running).OrderBy(j => j.JobId);
154 
155  foreach (Job job in orderedJobs)
156  {
157  builder.Append(job.JobId.ToString("00").PadRight(4));
158  builder.Append(
159  job.Description.Name.Substring(0,
160  job.Description.Name.Length > 15 ? 15 : job.Description.Name.Length).PadRight(15));
161  builder.Append((job.Schedule.InitialRun ? " 1" : " 0").PadLeft(5));
162  builder.Append((job.Schedule.FixedRun ? " 1" : " 0").PadLeft(5));
163  builder.Append(job.Schedule.Frequency.ToString(CultureInfo.InvariantCulture).PadLeft(7));
164  builder.Append(job.Description.Priority.ToString(CultureInfo.InvariantCulture).PadLeft(6));
165  builder.Append(job.RunCount.ToString(CultureInfo.InvariantCulture).PadLeft(6));
166  builder.Append(" ");
167  builder.Append(job.State.PadRight(12));
168  builder.Append(job.Runtime.PadLeft(15).Substring(0, 15));
169  builder.AppendLine();
170  }
171 
172  builder.AppendLine(string.Empty.PadLeft(size, '-'));
173 
174  return builder.ToString();
175  }
abstract int Priority
Gets the priority to use when scheduling jobs.
string State
Gets the current state of this Job.
Definition: Job.cs:108
bool InitialRun
Gets a value indicating whether this JobScheduleDescription should do an initial run upon first call...
JobScheduleDescription Schedule
Gets the schedule.
Definition: Job.cs:65
int RunCount
Gets the number of times this Job have been executed.
Definition: Job.cs:101
string Runtime
Gets the time this Job have currently been running.
Definition: Job.cs:124
int Frequency
Gets the schedule frequency in minutes.
bool FixedRun
Gets a value indicating whether this JobScheduleDescription has a fixed schedule frequency, eg. cannot be moved.
int JobId
Gets the job identifier.
Definition: Job.cs:59
JobDescription Description
Gets the description.
Definition: Job.cs:71

Here is the caller graph for this function:

static string Ntp.Analyzer.Monitor.Server.Billboard.Schedule ( IEnumerable< ScheduledJob jobs)
inlinestatic

Definition at line 177 of file Billboard.cs.

References Ntp.Common.Process.Job.Description, Ntp.Common.Process.JobScheduleDescription.FixedRun, Ntp.Common.Process.JobScheduleDescription.Frequency, Ntp.Common.Process.JobScheduleDescription.InitialRun, Ntp.Common.Process.ScheduledJob.Job, Ntp.Common.Process.Job.JobId, Ntp.Common.Process.JobDescription.Name, Ntp.Common.Process.JobDescription.Priority, Ntp.Common.Process.ScheduledJob.Run, Ntp.Common.Process.Job.RunCount, and Ntp.Common.Process.Job.Schedule.

Referenced by Ntp.Analyzer.Monitor.Server.TextCommand.ScheduleCommand.ExecuteTextCommand().

178  {
179  var builder = new StringBuilder();
180 
181  builder.AppendLine("Server time: " + DateTime.Now.ToLongTimeString());
182  builder.AppendLine();
183 
184  builder.Append("ID".PadRight(4));
185  builder.Append("Job".PadRight(15));
186  builder.Append("Ini".PadLeft(4));
187  builder.Append("Fix".PadLeft(5));
188  builder.Append("Freq".PadLeft(6));
189  builder.Append("Prio".PadLeft(5));
190  builder.Append("Runs".PadLeft(6));
191  builder.Append(" ");
192  builder.Append("Next".PadRight(8));
193  builder.AppendLine();
194 
195  const int size = 4 + 15 + 4 + 5 + 6 + 5 + 6 + 3 + 8 + 2;
196 
197  builder.AppendLine(string.Empty.PadLeft(size, '-'));
198 
199  IEnumerable<ScheduledJob> orderedJobs = jobs.OrderBy(j => j.Run);
200 
201  foreach (ScheduledJob job in orderedJobs)
202  {
203  builder.Append(job.Job.JobId.ToString("00").PadRight(4));
204  builder.Append(
205  job.Job.Description.Name.Substring(0,
206  job.Job.Description.Name.Length > 15 ? 15 : job.Job.Description.Name.Length).PadRight(15));
207  builder.Append((job.Job.Schedule.InitialRun ? " 1" : " 0").PadLeft(4));
208  builder.Append((job.Job.Schedule.FixedRun ? " 1" : " 0").PadLeft(5));
209  builder.Append(job.Job.Schedule.Frequency.ToString(CultureInfo.InvariantCulture).PadLeft(6));
210  builder.Append(job.Job.Description.Priority.ToString(CultureInfo.InvariantCulture).PadLeft(5));
211  builder.Append(job.Job.RunCount.ToString(CultureInfo.InvariantCulture).PadLeft(6));
212  builder.Append(" ");
213  builder.Append(job.Run.ToLongTimeString().PadLeft(8));
214  builder.AppendLine();
215  }
216 
217  builder.AppendLine(string.Empty.PadLeft(size, '-'));
218 
219  return builder.ToString();
220  }
abstract int Priority
Gets the priority to use when scheduling jobs.
DateTime Run
Gets the time of planned execution.
Definition: ScheduledJob.cs:52
Job Job
Gets the job to execute.
Definition: ScheduledJob.cs:46
bool InitialRun
Gets a value indicating whether this JobScheduleDescription should do an initial run upon first call...
JobScheduleDescription Schedule
Gets the schedule.
Definition: Job.cs:65
int RunCount
Gets the number of times this Job have been executed.
Definition: Job.cs:101
A job which have been scheduled for execution.
Definition: ScheduledJob.cs:29
int Frequency
Gets the schedule frequency in minutes.
bool FixedRun
Gets a value indicating whether this JobScheduleDescription has a fixed schedule frequency, eg. cannot be moved.
int JobId
Gets the job identifier.
Definition: Job.cs:59
JobDescription Description
Gets the description.
Definition: Job.cs:71

Here is the caller graph for this function:


The documentation for this class was generated from the following file: