This fails currently but the basics are there
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Pretty nice! just some details i've noticed when reading your diff and good to go
lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp | ||
---|---|---|
123–128 | you might be able to do something like // As calculating the size used by error instructions is very difficult, because errors // are dynamic objects, we just discard them from our calculations because errors // are supposed to be rare and not really contribute much to the total memory usage. size_t non_error_instructions = count(m_instructions.begin(), m_instructions.end(), [](const IntelPTInstruction& insn) {!insn.IsError();}); return IntelPTInstruction::GetNonErrorMemoryUsage() * non_error_instructions + GetRawTraceSize(); notice that we need the actual GetRawTraceSize() and not sizeof(m_raw_trace_size), because the latter will always give you 8 bytes on an x86_64 machine, regardless of how much data it is actually consuming. | |
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h | ||
85–95 | I made a mistake. I didn't notice that there's an m_error member, whose size is dynamic, because it might hold a string message. | |
120 | ||
158–162 | We can put all the documentation in the \return section to avoid redundancy. Let's also use the word Calculate instead of Get because Get is supposed to be used for cheap operations and Calculate for maybe not so trivial ones. | |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
113–114 | print this in KB, as it will be readability. You can assume that this number will always be an integer because the raw trace size by definition in the kernel is a multiple of 4KB. | |
115 | better print KB instead of bytes. you can use a double with two digits of precision |
lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp | ||
---|---|---|
123–128 | sorry, it should be return IntelPTInstruction::GetNonErrorMemoryUsage() * non_error_instructions + GetRawTraceSize() + sizeof(DecodedThread); notice the sizeof(DecodedThread) portion that accounts for the the m_thread_sp. The actual storage of the Thread * is somewhere else, and DecodedThread is just keeping a reference to it, so sizeof() is enough for this. | |
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h | ||
162–165 |
just some few remaining nits
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h | ||
---|---|---|
85 | ||
86–88 | move the implementation of this this method to the corresponding cpp file. We try to keep all headers just as declarations to reduce the binary size, unless we try to achieve an optimization | |
119 | ||
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
108–114 | only calculate the memory usage if used, which happens after the early terminated if | |
118 | use double instead of float. double has more precision |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
---|---|---|
118 | But since we're showing only two decimal places, which gets rounded up, the precision eventually gets thrown away... doesn't it? |
lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp | ||
---|---|---|
123–130 | as discussed offline, this should just be |