24 #ifndef SRC_XRDAPPS_RECORDPLUGIN_XRDCLACTION_HH_
25 #define SRC_XRDAPPS_RECORDPLUGIN_XRDCLACTION_HH_
47 :
id(reinterpret_cast<uint64_t>(file))
49 ,
start(std::chrono::system_clock::now())
58 stop = std::chrono::system_clock::now();
67 std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> tp)
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;
80 auto now = std::chrono::system_clock::now();
91 ss <<
"\"" <<
id <<
"\"" <<
',';
92 ss <<
"\"" <<
Name() <<
"\"" <<
',';
96 ss <<
"\"" << std::fixed << std::setprecision(9) << tstart <<
"\"" <<
",";
97 std::string argstr =
ArgStr();
100 ss <<
"\"" << argstr <<
timeout <<
"\"" <<
',';
101 ss <<
"\"" << std::fixed << std::setprecision(9) << tstop <<
"\"" <<
",";
103 while (ststr.back() ==
' ')
105 ss <<
"\"" << ststr <<
"\"" <<
',';
118 virtual std::string
Name() = 0;
132 std::chrono::system_clock::time_point
start;
135 std::chrono::system_clock::time_point
stop;
152 std::string
Name() {
return "Open"; }
156 std::stringstream ss;
178 std::string
Name() {
return "Close"; }
194 std::string
Name() {
return "Stat"; }
204 std::stringstream ss;
205 ss << std::to_string(info->
GetSize()) <<
';';
206 ss << std::to_string(info->
GetFlags()) <<
';';
232 std::string
Name() {
return "Read"; }
258 std::string
Name() {
return "PgRead"; }
287 std::string
Name() {
return "Write"; }
304 std::string
Name() {
return "PgWrite"; }
308 std::stringstream ss;
309 ss << std::to_string(
offset) <<
';' << std::to_string(
size);
327 std::string
Name() {
return "Sync"; }
343 std::string
Name() {
return "Truncate"; }
361 std::string
Name() {
return "VectorRead"; }
367 std::stringstream ss;
368 ss <<
req[0].offset <<
";" <<
req[0].length;
369 for (
size_t i = 1; i <
req.size(); ++i)
370 ss <<
";" <<
req[i].offset <<
";" <<
req[i].length;
380 std::stringstream ss;
383 for (
auto& ch : chunks)
384 ss <<
';' << ch.offset <<
';' << ch.length;
402 std::string
Name() {
return "VectorWrite"; }
408 std::stringstream ss;
409 ss <<
req[0].offset <<
";" <<
req[0].length;
410 for (
size_t i = 1; i <
req.size(); ++i)
411 ss <<
";" <<
req[i].offset <<
";" <<
req[i].length;
429 std::string
Name() {
return "Fcntl"; }
void Get(Type &object)
Retrieve the object being held.
Binary blob representation.
uint32_t GetSize() const
Get the size of the message.
uint64_t GetChangeTime() const
Get change time (in seconds since epoch)
uint64_t GetSize() const
Get size (in bytes)
const std::string GetModeAsOctString() const
Get mode.
const std::string & GetOwner() const
Get owner.
uint32_t GetFlags() const
Get flags.
const std::string & GetGroup() const
Get group.
uint64_t GetModTime() const
Get modification time (in seconds since epoch)
uint64_t GetAccessTime() const
Get change time (in seconds since epoch)
const std::string & GetChecksum() const
Get checksum.
uint32_t GetSize() const
Get Size.
ChunkList & GetChunks()
Get chunks.
std::vector< ChunkInfo > ChunkList
List of chunks.
virtual std::string Name()=0
Action name.
virtual std::string ArgStr()=0
Convert operation arguments into a string.
std::chrono::system_clock::time_point start
static double time(std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > tp)
Convert timpoint to unix timestamp with ns.
std::chrono::system_clock::time_point stop
virtual ~Action()
Destructor.
static double timeNow()
Get curretn unix time in ns precision as a double.
virtual void Serialize(AnyObject *response)
Serialize server response.
void RecordResult(XRootDStatus *st, AnyObject *rsp)
Record the server response / error / timeout.
std::string ToString()
Convert the action / response data into csv row.
Action(void *file, uint16_t timeout)
Describe a data chunk for vector read.
uint32_t length
offset in the file
std::string Name()
Action name.
std::string ArgStr()
Convert operation arguments into a string.
CloseAction(void *file, uint16_t timeout)
FcntlAction(void *file, const Buffer &arg, uint16_t timeout)
std::string Name()
Action name.
void Serialize(AnyObject *response)
Serialize server response.
std::string ArgStr()
Convert operation arguments into a string.
OpenAction(void *file, const std::string &url, OpenFlags::Flags flags, Access::Mode mode, uint16_t timeout)
std::string Name()
Action name.
std::string ArgStr()
Convert operation arguments into a string.
Flags
Open flags, may be or'd when appropriate.
size_t GetNbRepair()
Get number of repaired pages.
uint32_t GetLength() const
Get the data length.
std::string ArgStr()
Convert operation arguments into a string.
void Serialize(AnyObject *response)
Serialize server response.
std::string Name()
Action name.
PgReadAction(void *file, uint64_t offset, uint32_t size, uint16_t timeout)
PgWriteAction(void *file, uint64_t offset, uint32_t size, uint16_t timeout)
std::string Name()
Action name.
std::string ArgStr()
Convert operation arguments into a string.
ReadAction(void *file, uint64_t offset, uint32_t size, uint16_t timeout)
std::string Name()
Action name.
void Serialize(AnyObject *response)
Serialize server response.
std::string ArgStr()
Convert operation arguments into a string.
std::string Name()
Action name.
void Serialize(AnyObject *response)
Serialize server response.
std::string ArgStr()
Convert operation arguments into a string.
StatAction(void *file, bool force, uint16_t timeout)
std::string ToString() const
Create a string representation.
std::string Name()
Action name.
std::string ArgStr()
Convert operation arguments into a string.
SyncAction(void *file, uint16_t timeout)
std::string ArgStr()
Convert operation arguments into a string.
TruncateAction(void *file, uint64_t size, uint16_t timeout)
std::string Name()
Action name.
std::string Name()
Action name.
VectorReadAction(void *file, const ChunkList &chunks, uint16_t timeout)
std::string ArgStr()
Convert operation arguments into a string.
void Serialize(AnyObject *response)
Serialize server response.
std::string ArgStr()
Convert operation arguments into a string.
std::string Name()
Action name.
VectorWriteAction(void *file, const ChunkList &chunks, uint16_t timeout)
std::string ArgStr()
Convert operation arguments into a string.
std::string Name()
Action name.
WriteAction(void *file, uint64_t offset, uint32_t size, uint16_t timeout)