XRootD
Loading...
Searching...
No Matches
XrdCl::Action Struct Referenceabstract

Action. More...

#include <XrdClAction.hh>

+ Inheritance diagram for XrdCl::Action:
+ Collaboration diagram for XrdCl::Action:

Public Member Functions

 Action (void *file, uint16_t timeout)
 
virtual ~Action ()
 Destructor.
 
virtual std::string ArgStr ()=0
 Convert operation arguments into a string.
 
virtual std::string Name ()=0
 Action name.
 
void RecordResult (XRootDStatus *st, AnyObject *rsp)
 Record the server response / error / timeout.
 
virtual void Serialize (AnyObject *response)
 Serialize server response.
 
std::string ToString ()
 Convert the action / response data into csv row.
 

Static Public Member Functions

static double time (std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > tp)
 Convert timpoint to unix timestamp with ns.
 
static double timeNow ()
 Get curretn unix time in ns precision as a double.
 

Public Attributes

uint64_t id
 
std::string serialrsp
 
std::chrono::system_clock::time_point start
 
XRootDStatus status
 
std::chrono::system_clock::time_point stop
 
uint16_t timeout
 

Detailed Description

Action.

Definition at line 38 of file XrdClAction.hh.

Constructor & Destructor Documentation

◆ Action()

XrdCl::Action::Action ( void * file,
uint16_t timeout )
inline

Definition at line 46 of file XrdClAction.hh.

47 : id(reinterpret_cast<uint64_t>(file))
49 , start(std::chrono::system_clock::now()) // register the action start time
50 {
51 }
uint16_t timeout
std::chrono::system_clock::time_point start

◆ ~Action()

virtual XrdCl::Action::~Action ( )
inlinevirtual

Destructor.

Definition at line 113 of file XrdClAction.hh.

113{}

Member Function Documentation

◆ ArgStr()

virtual std::string XrdCl::Action::ArgStr ( )
pure virtual

Convert operation arguments into a string.

Implemented in XrdCl::OpenAction, XrdCl::CloseAction, XrdCl::StatAction, XrdCl::ReadAction, XrdCl::PgReadAction, XrdCl::WriteAction, XrdCl::PgWriteAction, XrdCl::SyncAction, XrdCl::TruncateAction, XrdCl::VectorReadAction, XrdCl::VectorWriteAction, and XrdCl::FcntlAction.

Referenced by ToString().

+ Here is the caller graph for this function:

◆ Name()

virtual std::string XrdCl::Action::Name ( )
pure virtual

Action name.

Implemented in XrdCl::OpenAction, XrdCl::CloseAction, XrdCl::StatAction, XrdCl::ReadAction, XrdCl::PgReadAction, XrdCl::WriteAction, XrdCl::PgWriteAction, XrdCl::SyncAction, XrdCl::TruncateAction, XrdCl::VectorReadAction, XrdCl::VectorWriteAction, and XrdCl::FcntlAction.

Referenced by ToString().

+ Here is the caller graph for this function:

◆ RecordResult()

void XrdCl::Action::RecordResult ( XRootDStatus * st,
AnyObject * rsp )
inline

Record the server response / error / timeout.

Definition at line 56 of file XrdClAction.hh.

57 {
58 stop = std::chrono::system_clock::now(); // register the response time
59 status = *st;
60 Serialize(rsp);
61 }
XRootDStatus status
std::chrono::system_clock::time_point stop
virtual void Serialize(AnyObject *response)
Serialize server response.

References Serialize(), status, and stop.

+ Here is the call graph for this function:

◆ Serialize()

virtual void XrdCl::Action::Serialize ( AnyObject * response)
inlinevirtual

Serialize server response.

Reimplemented in XrdCl::StatAction, XrdCl::ReadAction, XrdCl::PgReadAction, XrdCl::VectorReadAction, and XrdCl::FcntlAction.

Definition at line 128 of file XrdClAction.hh.

128{}

Referenced by RecordResult().

+ Here is the caller graph for this function:

◆ time()

static double XrdCl::Action::time ( std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > tp)
inlinestatic

Convert timpoint to unix timestamp with ns.

Definition at line 66 of file XrdClAction.hh.

68 {
69 auto secs = std::chrono::time_point_cast<std::chrono::seconds>(tp);
70 auto ns = std::chrono::time_point_cast<std::chrono::nanoseconds>(tp)
71 - std::chrono::time_point_cast<std::chrono::nanoseconds>(secs);
72 return secs.time_since_epoch().count() + ns.count() / 1000000000.0;
73 }

Referenced by timeNow(), and ToString().

+ Here is the caller graph for this function:

◆ timeNow()

static double XrdCl::Action::timeNow ( )
inlinestatic

Get curretn unix time in ns precision as a double.

Definition at line 78 of file XrdClAction.hh.

79 {
80 auto now = std::chrono::system_clock::now();
81 return time(now);
82 }
static double time(std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > tp)
Convert timpoint to unix timestamp with ns.

References time().

Referenced by XrdCl::ExecuteActions(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToString()

std::string XrdCl::Action::ToString ( )
inline

Convert the action / response data into csv row.

Definition at line 88 of file XrdClAction.hh.

89 {
90 std::stringstream ss;
91 ss << "\"" << id << "\"" << ',';
92 ss << "\"" << Name() << "\"" << ',';
93
94 double tstart = time(start);
95 double tstop = time(stop);
96 ss << "\"" << std::fixed << std::setprecision(9) << tstart << "\"" << ",";
97 std::string argstr = ArgStr();
98 if (!argstr.empty())
99 argstr += ';';
100 ss << "\"" << argstr << timeout << "\"" << ',';
101 ss << "\"" << std::fixed << std::setprecision(9) << tstop << "\"" << ",";
102 auto ststr = status.ToString();
103 while (ststr.back() == ' ')
104 ststr.pop_back();
105 ss << "\"" << ststr << "\"" << ',';
106 ss << "\"" << serialrsp << "\"" << '\n';
107 return ss.str();
108 }
std::string serialrsp
virtual std::string Name()=0
Action name.
virtual std::string ArgStr()=0
Convert operation arguments into a string.
std::string ToString() const
Create a string representation.

References ArgStr(), Name(), serialrsp, start, status, stop, time(), timeout, and XrdCl::Status::ToString().

+ Here is the call graph for this function:

Member Data Documentation

◆ id

uint64_t XrdCl::Action::id

Definition at line 130 of file XrdClAction.hh.

◆ serialrsp

◆ start

std::chrono::system_clock::time_point XrdCl::Action::start

Definition at line 132 of file XrdClAction.hh.

Referenced by ToString().

◆ status

XRootDStatus XrdCl::Action::status

Definition at line 133 of file XrdClAction.hh.

Referenced by RecordResult(), and ToString().

◆ stop

std::chrono::system_clock::time_point XrdCl::Action::stop

Definition at line 135 of file XrdClAction.hh.

Referenced by RecordResult(), and ToString().

◆ timeout

uint16_t XrdCl::Action::timeout

Definition at line 131 of file XrdClAction.hh.

Referenced by ToString().


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