Samchon Framework for CPP  1.0.0
samchon::protocol::InvokeHistory Class Reference

A history of an Invoke message. More...

#include <InvokeHistory.hpp>

Collaboration diagram for samchon::protocol::InvokeHistory:

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...
 
- Public Member Functions inherited from samchon::protocol::Entity
 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...
 

Detailed Description

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.

protocol_invoke.png
See also
samchon::protocol
samchon::protocol::master
samchon::protocol::slave
Author
Jeongho Nam http://samchon.org

Definition at line 35 of file InvokeHistory.hpp.

Constructor & Destructor Documentation

InvokeHistory::InvokeHistory ( )

Default Constructor.

Definition at line 13 of file InvokeHistory.cpp.

References listener, startTime, and uid.

samchon::protocol::InvokeHistory::InvokeHistory ( std::shared_ptr< Invoke )

Construct from an Invoke message.

InvokeHistory does not archive entire Invoke message, only archives its listener.

Parameters
invokeA message to archive its history log

Member Function Documentation

void InvokeHistory::construct ( std::shared_ptr< library::XML )
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.

Parameters
xmlAn 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().

Here is the caller graph for this function:

void InvokeHistory::notifyEnd ( )
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().

Here is the caller graph for this function:

auto InvokeHistory::key ( ) const -> std::string
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.

Returns
An identifier

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().

Here is the caller graph for this function:

auto InvokeHistory::getListener ( ) const -> std::string

Get listener.

Definition at line 73 of file InvokeHistory.cpp.

References listener.

auto InvokeHistory::getStartTime ( ) const -> library::Datetime

Get start time.

Definition at line 77 of file InvokeHistory.cpp.

References startTime.

auto InvokeHistory::getEndTime ( ) const -> library::Datetime

Get end time.

Definition at line 81 of file InvokeHistory.cpp.

References endTime.

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.

Returns
An elapsed time expressed as nano seconds.

Definition at line 86 of file InvokeHistory.cpp.

References endTime, and startTime.

Referenced by samchon::protocol::master::PRInvokeHistory::calcAverageElapsedTime().

Here is the caller graph for this function:

auto InvokeHistory::TAG ( ) const -> std::string
overridevirtual

A tag name when represented by XML.

Returns
A tag name

Implements samchon::protocol::Entity.

Definition at line 94 of file InvokeHistory.cpp.

auto InvokeHistory::toXML ( ) const -> std::shared_ptr<library::XML>
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>
Returns
An XML object representing the Entity.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns
An Invoke message to report master.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

size_t samchon::protocol::InvokeHistory::uid
protected

An identifier.

Definition at line 44 of file InvokeHistory.hpp.

Referenced by construct(), getUID(), InvokeHistory(), key(), and toXML().

std::string samchon::protocol::InvokeHistory::listener
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().

library::Datetime samchon::protocol::InvokeHistory::startTime
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().

library::Datetime samchon::protocol::InvokeHistory::endTime
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().


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