mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
dbms: tiny improvement [#METR-10240].
This commit is contained in:
parent
b04e4ccf08
commit
cd2e6663a5
@ -3,6 +3,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define DBMS_STACK_TRACE_MAX_DEPTH 32
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -19,8 +21,8 @@ public:
|
||||
|
||||
private:
|
||||
typedef void* Frame;
|
||||
typedef std::vector<Frame> Frames;
|
||||
Frames frames;
|
||||
Frame frames[DBMS_STACK_TRACE_MAX_DEPTH];
|
||||
size_t frames_size;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -16,13 +16,12 @@ namespace DB
|
||||
|
||||
StackTrace::StackTrace()
|
||||
{
|
||||
frames.resize(DBMS_STACK_TRACE_MAX_DEPTH);
|
||||
frames.resize(backtrace(&frames[0], frames.size()));
|
||||
frames_size = backtrace(frames, DBMS_STACK_TRACE_MAX_DEPTH);
|
||||
}
|
||||
|
||||
std::string StackTrace::toString() const
|
||||
{
|
||||
char ** symbols = backtrace_symbols(&frames[0], frames.size());
|
||||
char ** symbols = backtrace_symbols(frames, frames_size);
|
||||
std::stringstream res;
|
||||
|
||||
if (!symbols)
|
||||
@ -30,7 +29,7 @@ std::string StackTrace::toString() const
|
||||
|
||||
try
|
||||
{
|
||||
for (size_t i = 0, size = frames.size(); i < size; ++i)
|
||||
for (size_t i = 0, size = frames_size; i < size; ++i)
|
||||
{
|
||||
/// Делаем demangling имён. Имя находится в скобках, до символа '+'.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user