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

Protected Member Functions

override void Initialize ()
 
override void ReadFromStream ()
 
- Protected Member Functions inherited from Ntp.Analyzer.Import.NtpctlImporter< HostReading >
 NtpctlImporter (int hostId, LogBase log)
 
AssociationEntry ParseLines (string peer, string stats)
 

Protected Attributes

override string ErrorMessage => LogMessage.ImportHostError
 
- Protected Attributes inherited from Ntp.Analyzer.Import.NtpctlImporter< HostReading >
override string Arguments
 
override string Command
 

Package Functions

 NtpctlHostImporter (Host host, ReadingBulk bulk, LogBase log)
 

Private Member Functions

void CreateEntry (AssociationEntry entry)
 

Private Attributes

readonly ReadingBulk bulk
 
readonly Host host
 
List< Peerpeers
 

Detailed Description

Definition at line 30 of file NtpctlHostImporter.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Import.NtpctlHostImporter.NtpctlHostImporter ( Host  host,
ReadingBulk  bulk,
LogBase  log 
)
inlinepackage

Definition at line 32 of file NtpctlHostImporter.cs.

33  : base(host.Id, log)
34  {
35  this.host = host;
36  this.bulk = bulk;
37  }

Member Function Documentation

void Ntp.Analyzer.Import.NtpctlHostImporter.CreateEntry ( AssociationEntry  entry)
inlineprivate

Definition at line 78 of file NtpctlHostImporter.cs.

References Ntp.Analyzer.Objects.AssociationEntry.Jitter, Ntp.Analyzer.Objects.NamedObject.Name, Ntp.Analyzer.Objects.AssociationEntry.Offset, and Ntp.Analyzer.Objects.AssociationEntry.Remote.

79  {
80  IEnumerable<Peer> peerList = peers.Where(p => p.Ip == entry.Remote).ToList();
81 
82  Peer peer;
83 
84  switch (peerList.Count())
85  {
86  case 1:
87  peer = peerList.Single();
88  break;
89  case 0:
90  Log.PeerNotFound(host.Name, entry.Remote);
91  return;
92  default:
93  Log.MultiplePeersFound(host.Name, entry.Remote);
94  return;
95  }
96 
97  Log.Syncing(host.Name, peer.Name);
98 
99  var reading = new HostReading(host, peer, bulk, entry.Offset, entry.Jitter);
100  Entries.Add(reading);
101  }
double Jitter
Gets the dispersion of the peer in milliseconds.
double Offset
Gets the offset of the peer in milliseconds.
string Remote
Gets the address of the remote peer.
override void Ntp.Analyzer.Import.NtpctlHostImporter.Initialize ( )
inlineprotected

Definition at line 45 of file NtpctlHostImporter.cs.

References Ntp.Analyzer.Data.DataFace.Instance, and Ntp.Analyzer.Data.DataFace.Peers.

46  {
47  base.Initialize();
48 
49  if (host == null)
50  return;
51 
52  peers = DataFace.Instance.Peers.ToList();
53  }
PeerDatabaseMapper Peers
Gets the peer mapper.
Definition: DataFace.cs:63
Singleton facade class used to access memory persistent data.
Definition: DataFace.cs:30
static DataFace Instance
Gets the Singleton instance.
Definition: DataFace.cs:51
override void Ntp.Analyzer.Import.NtpctlHostImporter.ReadFromStream ( )
inlineprotected

Definition at line 55 of file NtpctlHostImporter.cs.

56  {
57  // Skip header
58  Reader.ReadLine();
59  Reader.ReadLine();
60 
61  // Find SysPeer
62  while (Reader.Peek() != -1)
63  {
64  string peer = Reader.ReadLine();
65  string stat = Reader.ReadLine();
66  var entry = ParseLines(peer, stat);
67 
68  if (entry.TallyCode != TallyCode.SysPeer)
69  continue;
70 
71  CreateEntry(entry);
72  return;
73  }
74 
75  Log.OpenNtpUnsynced();
76  }
void CreateEntry(AssociationEntry entry)
AssociationEntry ParseLines(string peer, string stats)

Member Data Documentation

readonly ReadingBulk Ntp.Analyzer.Import.NtpctlHostImporter.bulk
private

Definition at line 39 of file NtpctlHostImporter.cs.

override string Ntp.Analyzer.Import.NtpctlHostImporter.ErrorMessage => LogMessage.ImportHostError
protected

Definition at line 43 of file NtpctlHostImporter.cs.

readonly Host Ntp.Analyzer.Import.NtpctlHostImporter.host
private

Definition at line 40 of file NtpctlHostImporter.cs.

List<Peer> Ntp.Analyzer.Import.NtpctlHostImporter.peers
private

Definition at line 41 of file NtpctlHostImporter.cs.


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