Samchon Framework for CPP
1.0.0
|
A history of an Invoke message. More...
#include <InvokeHistory.hpp>
Public Member Functions | |
InvokeHistory () | |
Default Constructor. More... | |
InvokeHistory (std::shared_ptr< Invoke >) | |
Construct from an Invoke message. More... | |
virtual void | construct (std::shared_ptr< library::XML >) override |
Construct data of the Entity from an XML object. More... | |
virtual void | notifyEnd () |
Notify end of the process. More... | |
virtual auto | key () const -> std::string override |
Get a key that can identify the Entity uniquely. More... | |
auto | getUID () const -> size_t |
Get uid. More... | |
auto | getListener () const -> std::string |
Get listener. More... | |
auto | getStartTime () const -> library::Datetime |
Get start time. More... | |
auto | getEndTime () const -> library::Datetime |
Get end time. More... | |
auto | calcElapsedTime () const -> long long |
Get elapsed time. More... | |
virtual auto | TAG () const -> std::string override |
A tag name when represented by XML. More... | |
virtual auto | toXML () const -> std::shared_ptr< library::XML > override |
Get an XML object represents the Entity. More... | |
auto | toInvoke () const -> std::shared_ptr< Invoke > |
Get an Invoke message. More... | |
![]() | |
Entity () | |
Default Constructor. More... | |
Protected Attributes | |
size_t | uid |
An identifier. More... | |
std::string | listener |
A listener of the Invoke message. More... | |
library::Datetime | startTime |
Start time of the history. More... | |
library::Datetime | endTime |
End time of the history. More... | |
A history of an Invoke message.
InvokeHistory is a class for reporting history log of an Invoke message with elapsed time from a slave to its master.
With the elapsed time, consumed time for a process of handling the Invoke message, InvokeHistory is reported to the master. The master utilizies the elapsed time to estimating performances of each slave system. With the estimated performan index, master retrives the optimal solution of distributing processes.
Definition at line 35 of file InvokeHistory.hpp.
InvokeHistory::InvokeHistory | ( | ) |
Default Constructor.
Definition at line 13 of file InvokeHistory.cpp.
samchon::protocol::InvokeHistory::InvokeHistory | ( | std::shared_ptr< Invoke > | ) |
Construct from an Invoke message.
InvokeHistory does not archive entire Invoke message, only archives its listener.
invoke | A message to archive its history log |
|
overridevirtual |
Construct data of the Entity from an XML object.
Overrides the construct() method and fetch data of member variables from the XML.
By recommended guidance, data representing member variables are contained in properties of the put XML object.
xml | An xml used to construct data of entity |
Implements samchon::protocol::Entity.
Reimplemented in samchon::protocol::master::PRInvokeHistory.
Definition at line 26 of file InvokeHistory.cpp.
References endTime, listener, startTime, and uid.
Referenced by samchon::protocol::master::PRInvokeHistory::construct(), and samchon::protocol::master::ParallelSystem::construct().
|
virtual |
Notify end of the process.
Notifies end of a process handling the matched Invoke message to InvokeHistory.
InvokeHistory archives the end datetime and calculates elapsed time as nanoseconds.
Reimplemented in samchon::protocol::master::PRInvokeHistory, and samchon::protocol::master::PRMasterHistory.
Definition at line 56 of file InvokeHistory.cpp.
References endTime.
Referenced by samchon::protocol::slave::SlaveSystem::_replyData(), and samchon::protocol::slave::ParallelSystem::ParallelSystem().
|
overridevirtual |
Get a key that can identify the Entity uniquely.
If identifier of the Entity is not atomic value, returns a string represents the composite identifier. If identifier of the Entity is not string, converts the identifier to string and returns the string.
Reimplemented from samchon::protocol::Entity.
Definition at line 64 of file InvokeHistory.cpp.
References uid.
auto InvokeHistory::getUID | ( | ) | const -> size_t |
Get uid.
Definition at line 69 of file InvokeHistory.cpp.
References uid.
Referenced by samchon::protocol::master::ParallelSystem::construct().
auto InvokeHistory::getListener | ( | ) | const -> std::string |
auto InvokeHistory::getStartTime | ( | ) | const -> library::Datetime |
auto InvokeHistory::getEndTime | ( | ) | const -> library::Datetime |
auto InvokeHistory::calcElapsedTime | ( | ) | const -> long long |
Get elapsed time.
Calculates elapsed time frrom start, end time and Returns it.
The elapsed time will be reported to a master and the master will utilize the elapsed time to estimating performance of the slave system, the InvokeHistory is belonged to.
Definition at line 86 of file InvokeHistory.cpp.
References endTime, and startTime.
Referenced by samchon::protocol::master::PRInvokeHistory::calcAverageElapsedTime().
|
overridevirtual |
A tag name when represented by XML.
Implements samchon::protocol::Entity.
Definition at line 94 of file InvokeHistory.cpp.
|
overridevirtual |
Get an XML object represents the Entity.
Returns an XML object that can represents the Entity containing member variables into properties.
A member variable (not object, but atomic value like number, string or date) is categorized as a property within the framework of entity side. Thus, when overriding a toXML() method and archiving member variables to an XML object to return, puts each variable to be a property belongs to only an XML object.
Don't archive the member variable of atomic value to XML::value causing enormouse creation of XML objects to number of member variables. An Entity must be represented by only an XML instance (tag).
Standard Usage | Non-standard usage abusing value |
---|---|
<memberList> <member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' /> <member id='master' name='Administartor' birthdate='2011-07-28' /> </memberList> | <member> <id>jhnam88</id> <name>Jeongho+Nam</name> <birthdate>1988-03-11</birthdate> </member> |
Reimplemented from samchon::protocol::Entity.
Reimplemented in samchon::protocol::master::PRInvokeHistory.
Definition at line 99 of file InvokeHistory.cpp.
References endTime, listener, startTime, samchon::protocol::Entity::toXML(), and uid.
Referenced by toInvoke(), and samchon::protocol::master::PRInvokeHistory::toXML().
auto InvokeHistory::toInvoke | ( | ) | const -> std::shared_ptr<Invoke> |
Get an Invoke message.
Returns an Invoke message to report to a master that how much time was elapsed on a process handling the Invoke message. In master, those reports are used to estimate performance of each slave system.
Definition at line 110 of file InvokeHistory.cpp.
References toXML().
Referenced by samchon::protocol::slave::SlaveSystem::_replyData(), samchon::protocol::master::ParallelSystemArrayMediator::notifyEnd(), and samchon::protocol::slave::ParallelSystem::ParallelSystem().
|
protected |
An identifier.
Definition at line 44 of file InvokeHistory.hpp.
Referenced by construct(), getUID(), InvokeHistory(), key(), and toXML().
|
protected |
A listener of the Invoke message.
InvokeHistory does not archive entire data of an Invoke message. InvokeHistory only archives its listener. The first, formal reason is to save space, avoid wasting spaces.
The second, complicate reason is on an aspect of which systems are using the InvokeHistory class. InvokeHistory is designed to let slave reports to master elapsed time of a process used to handling the Invoke message. If you want to archive entire history log of Invoke messages, then the subject should be master, not the slave using InvokeHistory classes.
Definition at line 59 of file InvokeHistory.hpp.
Referenced by construct(), getListener(), InvokeHistory(), and toXML().
|
protected |
Start time of the history.
Means start time of a process handling the Invoke message. The start time not only has ordinary arguments represented Datetime (year to seconds), but also has very precise values under seconds, which is expressed as nano seconds (10^-9).
The precise start time will be used to calculate elapsed time with end time.
Definition at line 71 of file InvokeHistory.hpp.
Referenced by calcElapsedTime(), construct(), getStartTime(), InvokeHistory(), and toXML().
|
protected |
End time of the history.
Means end time of a process handling the Invoke message. The end time not only has ordinary arguments represented Datetime (year to seconds), but also has very precise values under seconds, which is expressed as nano seconds (10^-9).
The precise end time will be used to calculate elapsed time with start time.
Definition at line 83 of file InvokeHistory.hpp.
Referenced by calcElapsedTime(), construct(), getEndTime(), notifyEnd(), and toXML().