24#ifndef SQL_JOIN_OPTIMIZER_OPTIMIZER_TRACE_H_
25#define SQL_JOIN_OPTIMIZER_OPTIMIZER_TRACE_ 1
52 using Segment = std::array<char, kSegmentSize>;
65 setp(std::to_address(segment.begin()) + 1, std::to_address(segment.end()));
68 return traits_type::not_eof(ch);
72 template <
typename Sink>
75 for (
const char &ch : segment) {
88 template <
typename Sink>
91 assert(pptr() ==
nullptr && pbase() ==
nullptr && epptr() ==
nullptr);
96 setp(
nullptr,
nullptr);
UnstructuredTrace * unstructured_trace()
Definition: opt_trace_context.h:275
bool is_started() const
Returns whether there is a current trace.
Definition: opt_trace_context.h:147
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Opt_trace_context opt_trace
optimizer trace of current statement
Definition: sql_class.h:4064
This class is used for storing unstructured optimizer trace text (as used by the Hypergraph optimizer...
Definition: optimizer_trace.h:45
void ForEach(Sink sink) const
Apply 'sink' to each character in the trace text.
Definition: optimizer_trace.h:73
std::array< char, kSegmentSize > Segment
A consecutive buffer.
Definition: optimizer_trace.h:52
static constexpr size_t kSegmentSize
The size of each consecutive buffer.
Definition: optimizer_trace.h:48
int_type overflow(int_type ch) override
Called by std::ostream if the current segment is full.
Definition: optimizer_trace.h:61
std::deque< Segment > DequeType
The sequence of consecutive buffers.
Definition: optimizer_trace.h:54
std::string ToString() const
Return a copy of the contents as a string.
Definition: optimizer_trace.h:109
void ForEachRemove(Sink sink)
Apply 'sink' to each character in the trace text.
Definition: optimizer_trace.h:89
DequeType m_segments
The sequence of segments.
Definition: optimizer_trace.h:117
Trace in the form of plain text (i.e.
Definition: optimizer_trace.h:124
std::ostream m_stream
The stream that formats text and appends it to m_buffer.
Definition: optimizer_trace.h:139
UnstructuredTrace()
Definition: optimizer_trace.h:126
TraceBuffer m_buffer
The trace text.
Definition: optimizer_trace.h:136
TraceBuffer & contents()
Definition: optimizer_trace.h:131
const TraceBuffer & contents() const
Definition: optimizer_trace.h:132
std::ostream & stream()
Get the stream in which to put the trace text.
Definition: optimizer_trace.h:129
This contains the declaration of class Opt_trace_context, which is needed to declare THD.
std::ostream & Trace(THD *thd)
Fetch the ostream that we write optimizer trace into.
Definition: optimizer_trace.h:145
bool TraceStarted(THD *thd)
Definition: optimizer_trace.h:151
struct result result
Definition: result.h:34