MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / writeProfileEvents

Method writeProfileEvents

src/Client/InternalTextLogs.cpp:102–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void InternalTextLogs::writeProfileEvents(const Block & block)
103{
104 const auto & column_host_name = typeid_cast<const ColumnString &>(*block.getByName("host_name").column);
105 const auto & array_current_time = typeid_cast<const ColumnUInt32 &>(*block.getByName("current_time").column).getData();
106 const auto & array_thread_id = typeid_cast<const ColumnUInt64 &>(*block.getByName("thread_id").column).getData();
107 const auto & array_type = typeid_cast<const ColumnInt8 &>(*block.getByName("type").column).getData();
108 const auto & column_name = typeid_cast<const ColumnString &>(*block.getByName("name").column);
109 const auto & array_value = typeid_cast<const ColumnInt64 &>(*block.getByName("value").column).getData();
110
111 for (size_t row_num = 0; row_num < block.rows(); ++row_num)
112 {
113 /// host_name
114 auto host_name = column_host_name.getDataAt(row_num);
115 if (!host_name.empty())
116 {
117 writeCString("[", wb);
118 if (color)
119 writeString(setColor(StringViewHash()(host_name)), wb);
120 writeString(host_name, wb);
121 if (color)
122 writeCString(resetColor(), wb);
123 writeCString("] ", wb);
124 }
125
126 /// current_time
127 auto current_time = array_current_time[row_num];
128 writeDateTimeText<'.', ':'>(current_time, wb);
129
130 /// thread_id
131 UInt64 thread_id = array_thread_id[row_num];
132 writeCString(" [ ", wb);
133 if (color)
134 writeString(setColor(intHash64(thread_id)), wb);
135 writeIntText(thread_id, wb);
136 if (color)
137 writeCString(resetColor(), wb);
138 writeCString(" ] ", wb);
139
140 /// name
141 auto name = column_name.getDataAt(row_num);
142 if (color)
143 writeString(setColor(StringViewHash()(name)), wb);
144 DB::writeString(name, wb);
145 if (color)
146 writeCString(resetColor(), wb);
147 writeCString(": ", wb);
148
149 /// value
150 Int64 value = array_value[row_num];
151 writeIntText(value, wb);
152
153 //// type
154 Int8 type = array_type[row_num];
155 writeCString(" (", wb);
156 if (color)
157 writeString(setColor(intHash64(type)), wb);
158 writeString(fieldToString(ProfileEvents::TypeEnum->castToName(type)), wb);
159 if (color)

Callers 2

onProfileEventsMethod · 0.80

Calls 14

setColorFunction · 0.85
StringViewHashClass · 0.85
resetColorFunction · 0.85
intHash64Function · 0.85
writeIntTextFunction · 0.85
fieldToStringFunction · 0.85
writeCharFunction · 0.85
getByNameMethod · 0.80
castToNameMethod · 0.80
writeStringFunction · 0.50
getDataMethod · 0.45
rowsMethod · 0.45

Tested by

no test coverage detected