NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Import.IoStatsImporter Class Reference
Inheritance diagram for Ntp.Analyzer.Import.IoStatsImporter:
Collaboration diagram for Ntp.Analyzer.Import.IoStatsImporter:

Protected Member Functions

override void ReadFromStream ()
 
- Protected Member Functions inherited from Ntp.Analyzer.Import.Importer< IoStatsEntry >
 Importer (LogBase log)
 
virtual void Initialize ()
 

Protected Attributes

override string Arguments => "-c iostats " + address
 
override string Command => ntpq ? "ntpq" : "ntpdc"
 
override string ErrorMessage => LogMessage.ImportIoError
 
- Protected Attributes inherited from Ntp.Analyzer.Import.Importer< IoStatsEntry >
IList< T > Entries
 

Package Functions

 IoStatsImporter (string address, bool ntpq, LogBase log)
 

Private Attributes

readonly string address
 
readonly bool ntpq
 

Additional Inherited Members

- Public Member Functions inherited from Ntp.Analyzer.Import.Importer< IoStatsEntry >
void Execute ()
 
IEnumerator< T > GetEnumerator ()
 
- Properties inherited from Ntp.Analyzer.Import.Importer< IoStatsEntry >
abstract string Arguments [get]
 
abstract string Command [get]
 
abstract string ErrorMessage [get]
 
LogBase Log [get]
 
StreamReader Reader [get, private set]
 

Detailed Description

Definition at line 27 of file IoStatsImporter.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Import.IoStatsImporter.IoStatsImporter ( string  address,
bool  ntpq,
LogBase  log 
)
inlinepackage

Definition at line 29 of file IoStatsImporter.cs.

30  : base(log)
31  {
32  this.address = address;
33  this.ntpq = ntpq;
34  }

Member Function Documentation

override void Ntp.Analyzer.Import.IoStatsImporter.ReadFromStream ( )
inlineprotectedvirtual

Implements Ntp.Analyzer.Import.Importer< IoStatsEntry >.

Definition at line 45 of file IoStatsImporter.cs.

46  {
47  int timeSinceReset = -1;
48  int receiveBuffers = -1;
49  int freeReceiveBuffers = -1;
50  int usedReceiveBuffers = -1;
51  int lowWaterRefills = -1;
52  long droppedPackets = -1;
53  long ignoredPackets = -1;
54  long receivedPackets = -1;
55  long packetsSent = -1;
56  long packetsNotSent = -1;
57  int interruptsHandled = -1;
58  int receivedByInt = -1;
59 
60  while (Reader.Peek() != -1)
61  {
62  string line = Reader.ReadLine();
63 
64  if (string.IsNullOrWhiteSpace(line) || line.Length < 24)
65  continue;
66 
67  string name = line.Substring(0, 22).Replace(":", string.Empty).TrimEnd();
68  string value = line.Substring(22).TrimEnd();
69 
70  long parsedValue;
71 
72  if (!long.TryParse(value, out parsedValue))
73  {
74  parsedValue = -2;
75  }
76 
77  switch (name)
78  {
79  case "time since reset":
80  timeSinceReset = (int) parsedValue;
81  break;
82  case "receive buffers":
83  receiveBuffers = (int) parsedValue;
84  break;
85  case "free receive buffers":
86  freeReceiveBuffers = (int) parsedValue;
87  break;
88  case "used receive buffers":
89  usedReceiveBuffers = (int) parsedValue;
90  break;
91  case "low water refills":
92  lowWaterRefills = (int) parsedValue;
93  break;
94  case "dropped packets":
95  droppedPackets = parsedValue;
96  break;
97  case "ignored packets":
98  ignoredPackets = parsedValue;
99  break;
100  case "received packets":
101  receivedPackets = parsedValue;
102  break;
103  case "packets sent":
104  packetsSent = parsedValue;
105  break;
106  case "packets not sent":
107  case "packet send failures":
108  packetsNotSent = parsedValue;
109  break;
110  case "input wakeups":
111  case "interrupts handled":
112  interruptsHandled = (int) parsedValue;
113  break;
114  case "useful input wakeups":
115  case "received by int":
116  receivedByInt = (int) parsedValue;
117  break;
118  default:
119  Log.NtpValueError(name);
120  break;
121  }
122  }
123 
124  Entries.Add(new IoStatsEntry(
125  timeSinceReset,
126  receiveBuffers,
127  freeReceiveBuffers,
128  usedReceiveBuffers,
129  lowWaterRefills,
130  droppedPackets,
131  ignoredPackets,
132  receivedPackets,
133  packetsSent,
134  packetsNotSent,
135  interruptsHandled,
136  receivedByInt));
137  }

Member Data Documentation

readonly string Ntp.Analyzer.Import.IoStatsImporter.address
private

Definition at line 36 of file IoStatsImporter.cs.

override string Ntp.Analyzer.Import.IoStatsImporter.Arguments => "-c iostats " + address
protected

Definition at line 41 of file IoStatsImporter.cs.

override string Ntp.Analyzer.Import.IoStatsImporter.Command => ntpq ? "ntpq" : "ntpdc"
protected

Definition at line 39 of file IoStatsImporter.cs.

override string Ntp.Analyzer.Import.IoStatsImporter.ErrorMessage => LogMessage.ImportIoError
protected

Definition at line 43 of file IoStatsImporter.cs.

readonly bool Ntp.Analyzer.Import.IoStatsImporter.ntpq
private

Definition at line 37 of file IoStatsImporter.cs.


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