]> git.proxmox.com Git - ceph.git/blame - ceph/src/crimson/common/operation.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crimson / common / operation.cc
CommitLineData
20effc67
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#include "operation.h"
20effc67
TL
5
6namespace crimson {
7
8void Operation::dump(ceph::Formatter* f) const
9{
10 f->open_object_section("operation");
11 f->dump_string("type", get_type_name());
12 f->dump_unsigned("id", id);
13 {
14 f->open_object_section("detail");
15 dump_detail(f);
16 f->close_section();
17 }
20effc67
TL
18 f->close_section();
19}
20
21void Operation::dump_brief(ceph::Formatter* f) const
22{
23 f->open_object_section("operation");
24 f->dump_string("type", get_type_name());
25 f->dump_unsigned("id", id);
26 f->close_section();
27}
28
29std::ostream &operator<<(std::ostream &lhs, const Operation &rhs) {
30 lhs << rhs.get_type_name() << "(id=" << rhs.get_id() << ", detail=";
31 rhs.print(lhs);
32 lhs << ")";
33 return lhs;
34}
35
36void Blocker::dump(ceph::Formatter* f) const
37{
38 f->open_object_section("blocker");
39 f->dump_string("op_type", get_type_name());
40 {
41 f->open_object_section("detail");
42 dump_detail(f);
43 f->close_section();
44 }
45 f->close_section();
46}
47
1e59de90
TL
48namespace detail {
49void dump_time_event(const char* name,
50 const utime_t& timestamp,
51 ceph::Formatter* f)
20effc67 52{
1e59de90
TL
53 assert(f);
54 f->open_object_section("time_event");
55 f->dump_string("name", name);
56 f->dump_stream("initiated_at") << timestamp;
20effc67
TL
57 f->close_section();
58}
59
1e59de90
TL
60void dump_blocking_event(const char* name,
61 const utime_t& timestamp,
62 const Blocker* const blocker,
63 ceph::Formatter* f)
20effc67 64{
1e59de90
TL
65 assert(f);
66 f->open_object_section("blocking_event");
67 f->dump_string("name", name);
68 f->dump_stream("initiated_at") << timestamp;
69 if (blocker) {
70 blocker->dump(f);
71 }
72 f->close_section();
20effc67 73}
1e59de90
TL
74} // namespace detail
75} // namespace crimson