1
1
mirror of https://github.com/tstack/lnav.git synced 2024-07-14 16:20:24 +03:00

[timeline] rename gantt view to timeline

This commit is contained in:
Tim Stack 2024-05-23 15:04:40 -07:00
parent 5355b6854e
commit 4759a59b23
40 changed files with 203 additions and 196 deletions

View File

@ -7,7 +7,7 @@ Features:
* The `log_opid` column on log vtables can now by `UPDATE`d
so that you can manually set an opid on log messages that
don't have one. Setting an opid allows messages to show
up in the Gantt chart view.
up in the timeline view.
* Add support for GitHub Markdown Alerts.
* Added the `:xopen` command that will open the given paths
using an external opener like `open` or `xdg-open`.
@ -16,7 +16,8 @@ Features:
target with `:xopen`, or copying the link to a clipboard.
Interface Changes:
* In the Gantt chart view, pressing `ENTER` will focus on
* The "Gantt Chart" view has been renamed to "timeline".
* In the timeline view, pressing `ENTER` will focus on
the preview pane, so you can scroll through messages
with the selected Op ID.
* With mouse mode enabled, `CTRL` can be used as an alternate

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -305,19 +305,19 @@ can also press :kbd:`Shift` + :kbd:`i` to toggle the histogram view
while synchronizing the top time. While in the histogram view,
pressing :kbd:`z` / :kbd:`Shift` + :kbd:`z` will zoom in/out.
GANTT
^^^^^
TIMELINE
^^^^^^^^
.. note:: This feature is available in v0.12.0+.
.. figure:: lnav-gantt-1.png
.. figure:: lnav-timeline-1.png
:align: center
Screenshot of the Gantt chart view when viewing logs from the
Screenshot of the timeline view when viewing logs from the
VMWare Update Manager. Most rows show API requests as they
are received and processed.
The Gantt Chart view visualizes operations over time. The operations
The timeline view [#]_ visualizes operations over time. The operations
are identified by the "opid" field defined in the log format. In the
view, there is a header that shows the overall time span, the
narrowed time span around the focused line, and the column headers.
@ -346,7 +346,7 @@ The following hotkeys can be useful in this view:
:code:`opid/subid` property, this will toggle an overlay panel
that displays the sub-operation descriptions.
.. figure:: lnav-gantt-2.png
.. figure:: lnav-timeline-2.png
:align: center
Screenshot showing the same log as above after pressing
@ -354,12 +354,14 @@ The following hotkeys can be useful in this view:
sub-operations performed while processing the main operation.
* :kbd:`Shift` + :kbd:`q` -- Return to the previous view and change
its focused line to match the time that was focused in the gantt
its focused line to match the time that was focused in the timeline
view.
* :kbd:`Shift` + :kbd:`a` -- After leaving the gantt view, pressing
these keys will return to the Gantt view while keeping the focused
* :kbd:`Shift` + :kbd:`a` -- After leaving the timeline view, pressing
these keys will return to the timeline view while keeping the focused
time in sync.
.. [#] Formerly called the "Gantt Chart" view.
PRETTY
^^^^^^
@ -428,7 +430,7 @@ elements will respond to mouse inputs:
* clicking on the main view will move the cursor to the given
row and dragging will scroll the view as needed;
* :bkd:`Shift` (or :kbd:`CTRL`) clicking/dragging in the main
* :kbd:`Shift` (or :kbd:`CTRL`) clicking/dragging in the main
view will highlight lines and then toggle their bookmark
status on release;
* double-clicking in the main view will select the underlying

View File

@ -443,7 +443,6 @@ add_library(
fs-extension-functions.cc
fstat_vtab.cc
fts_fuzzy_match.cc
gantt_source.cc
help_text.cc
help_text_formatter.cc
highlighter.cc
@ -510,6 +509,7 @@ add_library(
textfile_highlighters.cc
textfile_sub_source.cc
textview_curses.cc
timeline_source.cc
top_status_source.cc
time-extension-functions.cc
timer.cc
@ -560,8 +560,6 @@ add_library(
filter_sub_source.hh
fstat_vtab.hh
fts_fuzzy_match.hh
gantt_source.hh
gantt_status_source.hh
grep_highlighter.hh
hasher.hh
help_text.hh
@ -641,6 +639,8 @@ add_library(
textview_curses.hh
textview_curses_fwd.hh
time_T.hh
timeline_source.hh
timeline_status_source.hh
timer.hh
top_status_source.hh
url_handler.cfg.hh

View File

@ -251,8 +251,6 @@ noinst_HEADERS = \
filter_sub_source.hh \
fstat_vtab.hh \
fts_fuzzy_match.hh \
gantt_source.hh \
gantt_status_source.hh \
grep_highlighter.hh \
grep_proc.hh \
hasher.hh \
@ -357,6 +355,8 @@ noinst_HEADERS = \
textview_curses.hh \
textview_curses_fwd.hh \
time_T.hh \
timeline_source.hh \
timeline_status_source.hh \
timer.hh \
top_status_source.hh \
top_status_source.cfg.hh \
@ -446,7 +446,6 @@ libdiag_a_SOURCES = \
fstat_vtab.cc \
fs-extension-functions.cc \
fts_fuzzy_match.cc \
gantt_source.cc \
grep_proc.cc \
help_text.cc \
help_text_formatter.cc \
@ -515,6 +514,7 @@ libdiag_a_SOURCES = \
textfile_highlighters.cc \
textview_curses.cc \
time-extension-functions.cc \
timeline_source.cc \
top_status_source.cc \
unique_path.cc \
view_curses.cc \

View File

@ -90,7 +90,6 @@
#include "file_options.hh"
#include "filter_sub_source.hh"
#include "fstat_vtab.hh"
#include "gantt_source.hh"
#include "hist_source.hh"
#include "init-sql.h"
#include "listview_curses.hh"
@ -127,6 +126,7 @@
#include "termios_guard.hh"
#include "textfile_highlighters.hh"
#include "textview_curses.hh"
#include "timeline_source.hh"
#include "top_status_source.hh"
#include "view_helpers.crumbs.hh"
#include "view_helpers.examples.hh"
@ -1370,17 +1370,17 @@ VALUES ('org.lnav.mouse-support', -1, DATETIME('now', '+1 minute'),
lnav_data.ld_spectro_source->ss_exec_context
= &lnav_data.ld_exec_context;
lnav_data.ld_gantt_details_view.set_title("gantt-details");
lnav_data.ld_gantt_details_view.set_window(lnav_data.ld_window);
lnav_data.ld_gantt_details_view.set_selectable(true);
lnav_data.ld_gantt_details_view.set_show_scrollbar(true);
lnav_data.ld_gantt_details_view.set_height(5_vl);
lnav_data.ld_gantt_details_view.set_supports_marks(true);
lnav_data.ld_gantt_details_view.set_sub_source(
&lnav_data.ld_gantt_details_source);
lnav_data.ld_gantt_details_view.tc_cursor_role
lnav_data.ld_timeline_details_view.set_title("timeline-details");
lnav_data.ld_timeline_details_view.set_window(lnav_data.ld_window);
lnav_data.ld_timeline_details_view.set_selectable(true);
lnav_data.ld_timeline_details_view.set_show_scrollbar(true);
lnav_data.ld_timeline_details_view.set_height(5_vl);
lnav_data.ld_timeline_details_view.set_supports_marks(true);
lnav_data.ld_timeline_details_view.set_sub_source(
&lnav_data.ld_timeline_details_source);
lnav_data.ld_timeline_details_view.tc_cursor_role
= role_t::VCR_CURSOR_LINE;
lnav_data.ld_gantt_details_view.tc_disabled_cursor_role
lnav_data.ld_timeline_details_view.tc_disabled_cursor_role
= role_t::VCR_DISABLED_CURSOR_LINE;
auto top_status_lifetime
@ -1438,9 +1438,9 @@ VALUES ('org.lnav.mouse-support', -1, DATETIME('now', '+1 minute'),
= std::make_unique<spectro_status_source>();
lnav_data.ld_status[LNS_SPECTRO].set_data_source(
lnav_data.ld_spectro_status_source.get());
lnav_data.ld_status[LNS_GANTT].set_enabled(false);
lnav_data.ld_status[LNS_GANTT].set_data_source(
&lnav_data.ld_gantt_status_source);
lnav_data.ld_status[LNS_TIMELINE].set_enabled(false);
lnav_data.ld_status[LNS_TIMELINE].set_data_source(
&lnav_data.ld_timeline_status_source);
lnav_data.ld_match_view.set_show_bottom_border(true);
lnav_data.ld_user_message_view.set_show_bottom_border(true);
@ -1650,7 +1650,7 @@ VALUES ('org.lnav.mouse-support', -1, DATETIME('now', '+1 minute'),
lnav_data.ld_preview_view[0].do_update();
lnav_data.ld_preview_view[1].do_update();
lnav_data.ld_spectro_details_view.do_update();
lnav_data.ld_gantt_details_view.do_update();
lnav_data.ld_timeline_details_view.do_update();
lnav_data.ld_user_message_view.do_update();
if (ui_clock::now() >= next_status_update_time) {
echo_views_stmt.execute();
@ -2851,26 +2851,26 @@ SELECT tbl_name FROM sqlite_master WHERE sql LIKE 'CREATE VIRTUAL TABLE%'
.add_input_delegate(*lnav_data.ld_spectro_source)
.set_tail_space(4_vl);
lnav_data.ld_views[LNV_SPECTRO].set_selectable(true);
auto gantt_view_source
= std::make_shared<gantt_source>(lnav_data.ld_views[LNV_LOG],
lnav_data.ld_log_source,
lnav_data.ld_gantt_details_view,
lnav_data.ld_gantt_details_source,
lnav_data.ld_status[LNS_GANTT],
lnav_data.ld_gantt_status_source);
gantt_view_source->gs_exec_context = &lnav_data.ld_exec_context;
auto gantt_header_source
= std::make_shared<gantt_header_overlay>(gantt_view_source);
lnav_data.ld_views[LNV_GANTT]
.set_sub_source(gantt_view_source.get())
.set_overlay_source(gantt_header_source.get())
.add_input_delegate(*gantt_view_source)
auto timeline_view_source = std::make_shared<timeline_source>(
lnav_data.ld_views[LNV_LOG],
lnav_data.ld_log_source,
lnav_data.ld_timeline_details_view,
lnav_data.ld_timeline_details_source,
lnav_data.ld_status[LNS_TIMELINE],
lnav_data.ld_timeline_status_source);
timeline_view_source->gs_exec_context = &lnav_data.ld_exec_context;
auto timeline_header_source
= std::make_shared<timeline_header_overlay>(timeline_view_source);
lnav_data.ld_views[LNV_TIMELINE]
.set_sub_source(timeline_view_source.get())
.set_overlay_source(timeline_header_source.get())
.add_input_delegate(*timeline_view_source)
.set_tail_space(4_vl);
lnav_data.ld_views[LNV_GANTT].set_selectable(true);
lnav_data.ld_views[LNV_TIMELINE].set_selectable(true);
auto _gantt_cleanup = finally([] {
lnav_data.ld_views[LNV_GANTT].set_sub_source(nullptr);
lnav_data.ld_views[LNV_GANTT].set_overlay_source(nullptr);
auto _timeline_cleanup = finally([] {
lnav_data.ld_views[LNV_TIMELINE].set_sub_source(nullptr);
lnav_data.ld_views[LNV_TIMELINE].set_overlay_source(nullptr);
});
lnav_data.ld_doc_view.set_sub_source(&lnav_data.ld_doc_source);

View File

@ -49,7 +49,6 @@
#include "file_collection.hh"
#include "files_sub_source.hh"
#include "filter_status_source.hh"
#include "gantt_status_source.hh"
#include "hist_source.hh"
#include "input_dispatcher.hh"
#include "log_vtab_impl.hh"
@ -59,6 +58,7 @@
#include "sqlitepp.hh"
#include "statusview_curses.hh"
#include "textfile_sub_source.hh"
#include "timeline_status_source.hh"
#include "view_helpers.hh"
class spectrogram_source;
@ -76,7 +76,7 @@ typedef enum {
LNS_PREVIEW0,
LNS_PREVIEW1,
LNS_SPECTRO,
LNS_GANTT,
LNS_TIMELINE,
LNS__MAX
} lnav_status_t;
@ -185,7 +185,7 @@ struct lnav_data_t {
doc_status_source ld_doc_status_source;
preview_status_source ld_preview_status_source[2];
std::unique_ptr<spectro_status_source> ld_spectro_status_source;
gantt_status_source ld_gantt_status_source;
timeline_status_source ld_timeline_status_source;
bool ld_preview_hidden;
int64_t ld_preview_generation{0};
action_broadcaster<listview_curses> ld_scroll_broadcaster;
@ -211,8 +211,8 @@ struct lnav_data_t {
ld_user_message_expiration;
textview_curses ld_spectro_details_view;
plain_text_source ld_spectro_no_details_source;
textview_curses ld_gantt_details_view;
plain_text_source ld_gantt_details_source;
textview_curses ld_timeline_details_view;
plain_text_source ld_timeline_details_source;
view_stack<textview_curses> ld_view_stack;
textview_curses* ld_last_view;

View File

@ -373,10 +373,11 @@ rebuild_indexes(std::optional<ui_clock::time_point> deadline)
}
lnav_data.ld_view_stack.top() | [&closed_files, &retval](auto tc) {
if (!closed_files.empty() && tc == &lnav_data.ld_views[LNV_GANTT]) {
auto* gantt_source = lnav_data.ld_views[LNV_GANTT].get_sub_source();
if (gantt_source != nullptr) {
gantt_source->text_filters_changed();
if (!closed_files.empty() && tc == &lnav_data.ld_views[LNV_TIMELINE]) {
auto* timeline_source
= lnav_data.ld_views[LNV_TIMELINE].get_sub_source();
if (timeline_source != nullptr) {
timeline_source->text_filters_changed();
}
}

View File

@ -3770,8 +3770,8 @@ com_file_visibility(exec_context& ec,
lnav_data.ld_views[LNV_LOG]
.get_sub_source()
->text_filters_changed();
if (top_tc == &lnav_data.ld_views[LNV_GANTT]) {
lnav_data.ld_views[LNV_GANTT]
if (top_tc == &lnav_data.ld_views[LNV_TIMELINE]) {
lnav_data.ld_views[LNV_TIMELINE]
.get_sub_source()
->text_filters_changed();
}

View File

@ -1891,7 +1891,7 @@ lnav::session::restore_view_states()
lnav_data.ld_view_stack.pop_back();
lnav_data.ld_view_stack.top() | [](auto* tc) {
// XXX
if (tc == &lnav_data.ld_views[LNV_GANTT]) {
if (tc == &lnav_data.ld_views[LNV_TIMELINE]) {
auto tss = tc->get_sub_source();
tss->text_filters_changed();
tc->reload_data();

View File

@ -29,7 +29,7 @@
#include <chrono>
#include "gantt_source.hh"
#include "timeline_source.hh"
#include <time.h>
@ -118,8 +118,8 @@ abbrev_ftime(char* datebuf,
}
std::vector<attr_line_t>
gantt_preview_overlay::list_overlay_menu(const listview_curses& lv,
vis_line_t line)
timeline_preview_overlay::list_overlay_menu(const listview_curses& lv,
vis_line_t line)
{
static constexpr auto MENU_WIDTH = 25;
@ -174,17 +174,17 @@ gantt_preview_overlay::list_overlay_menu(const listview_curses& lv,
return retval;
}
gantt_header_overlay::
gantt_header_overlay(std::shared_ptr<gantt_source> src)
timeline_header_overlay::
timeline_header_overlay(std::shared_ptr<timeline_source> src)
: gho_src(src)
{
}
bool
gantt_header_overlay::list_static_overlay(const listview_curses& lv,
int y,
int bottom,
attr_line_t& value_out)
timeline_header_overlay::list_static_overlay(const listview_curses& lv,
int y,
int bottom,
attr_line_t& value_out)
{
if (y >= 3) {
return false;
@ -297,7 +297,7 @@ gantt_header_overlay::list_static_overlay(const listview_curses& lv,
return true;
}
void
gantt_header_overlay::list_value_for_overlay(
timeline_header_overlay::list_value_for_overlay(
const listview_curses& lv,
vis_line_t line,
std::vector<attr_line_t>& value_out)
@ -384,8 +384,8 @@ gantt_header_overlay::list_value_for_overlay(
}
}
std::optional<attr_line_t>
gantt_header_overlay::list_header_for_overlay(const listview_curses& lv,
vis_line_t line)
timeline_header_overlay::list_header_for_overlay(const listview_curses& lv,
vis_line_t line)
{
if (lv.get_overlay_selection()) {
return attr_line_t("\u258C Sub-operations: Press ")
@ -397,13 +397,13 @@ gantt_header_overlay::list_header_for_overlay(const listview_curses& lv,
.append(" to focus on this panel");
}
gantt_source::
gantt_source(textview_curses& log_view,
logfile_sub_source& lss,
textview_curses& preview_view,
plain_text_source& preview_source,
statusview_curses& preview_status_view,
gantt_status_source& preview_status_source)
timeline_source::
timeline_source(textview_curses& log_view,
logfile_sub_source& lss,
textview_curses& preview_view,
plain_text_source& preview_source,
statusview_curses& preview_status_view,
timeline_status_source& preview_status_source)
: gs_log_view(log_view), gs_lss(lss), gs_preview_view(preview_view),
gs_preview_source(preview_source),
gs_preview_status_view(preview_status_view),
@ -414,7 +414,7 @@ gantt_source(textview_curses& log_view,
}
bool
gantt_source::list_input_handle_key(listview_curses& lv, int ch)
timeline_source::list_input_handle_key(listview_curses& lv, int ch)
{
log_debug("list input %x", ch);
switch (ch) {
@ -462,9 +462,10 @@ gantt_source::list_input_handle_key(listview_curses& lv, int ch)
}
bool
gantt_source::text_handle_mouse(textview_curses& tc,
const listview_curses::display_line_content_t&,
mouse_event& me)
timeline_source::text_handle_mouse(
textview_curses& tc,
const listview_curses::display_line_content_t&,
mouse_event& me)
{
if (me.is_double_click_in(mouse_button_t::BUTTON_LEFT, line_range{0, -1})) {
this->list_input_handle_key(tc, '\r');
@ -474,7 +475,7 @@ gantt_source::text_handle_mouse(textview_curses& tc,
}
std::pair<timeval, timeval>
gantt_source::get_time_bounds_for(int line)
timeline_source::get_time_bounds_for(int line)
{
auto low_index = this->tss_view->get_top();
auto high_index
@ -517,16 +518,16 @@ gantt_source::get_time_bounds_for(int line)
}
size_t
gantt_source::text_line_count()
timeline_source::text_line_count()
{
return this->gs_time_order.size();
}
void
gantt_source::text_value_for_line(textview_curses& tc,
int line,
std::string& value_out,
text_sub_source::line_flags_t flags)
timeline_source::text_value_for_line(textview_curses& tc,
int line,
std::string& value_out,
text_sub_source::line_flags_t flags)
{
if (line < this->gs_time_order.size()) {
const auto& row = this->gs_time_order[line].get();
@ -563,9 +564,9 @@ gantt_source::text_value_for_line(textview_curses& tc,
}
void
gantt_source::text_attrs_for_line(textview_curses& tc,
int line,
string_attrs_t& value_out)
timeline_source::text_attrs_for_line(textview_curses& tc,
int line,
string_attrs_t& value_out)
{
if (line < this->gs_time_order.size()) {
const auto& row = this->gs_time_order[line].get();
@ -623,15 +624,15 @@ gantt_source::text_attrs_for_line(textview_curses& tc,
}
size_t
gantt_source::text_size_for_line(textview_curses& tc,
int line,
text_sub_source::line_flags_t raw)
timeline_source::text_size_for_line(textview_curses& tc,
int line,
text_sub_source::line_flags_t raw)
{
return this->gs_total_width;
}
void
gantt_source::rebuild_indexes()
timeline_source::rebuild_indexes()
{
auto& bm = this->tss_view->get_bookmarks();
auto& bm_errs = bm[&logfile_sub_source::BM_ERRORS];
@ -861,7 +862,7 @@ gantt_source::rebuild_indexes()
}
std::optional<vis_line_t>
gantt_source::row_for_time(struct timeval time_bucket)
timeline_source::row_for_time(struct timeval time_bucket)
{
auto iter = this->gs_time_order.begin();
while (true) {
@ -908,7 +909,7 @@ gantt_source::row_for_time(struct timeval time_bucket)
}
std::optional<text_time_translator::row_info>
gantt_source::time_for_row(vis_line_t row)
timeline_source::time_for_row(vis_line_t row)
{
if (row >= this->gs_time_order.size()) {
return std::nullopt;
@ -939,13 +940,13 @@ gantt_source::time_for_row(vis_line_t row)
}
size_t
gantt_source::text_line_width(textview_curses& curses)
timeline_source::text_line_width(textview_curses& curses)
{
return this->gs_total_width;
}
void
gantt_source::text_selection_changed(textview_curses& tc)
timeline_source::text_selection_changed(textview_curses& tc)
{
static const size_t MAX_PREVIEW_LINES = 200;
@ -1021,24 +1022,24 @@ gantt_source::text_selection_changed(textview_curses& tc)
auto err_count = level_stats.lls_error_count;
if (err_count == 0) {
this->gs_preview_status_source
.statusview_value_for_field(gantt_status_source::TSF_ERRORS)
.statusview_value_for_field(timeline_status_source::TSF_ERRORS)
.set_value("");
} else if (err_count > 1) {
this->gs_preview_status_source
.statusview_value_for_field(gantt_status_source::TSF_ERRORS)
.statusview_value_for_field(timeline_status_source::TSF_ERRORS)
.set_value("%'d errors", err_count);
} else {
this->gs_preview_status_source
.statusview_value_for_field(gantt_status_source::TSF_ERRORS)
.statusview_value_for_field(timeline_status_source::TSF_ERRORS)
.set_value("%'d error", err_count);
}
this->gs_preview_status_source
.statusview_value_for_field(gantt_status_source::TSF_TOTAL)
.statusview_value_for_field(timeline_status_source::TSF_TOTAL)
.set_value("%'d messages ", level_stats.lls_total_count);
}
void
gantt_source::text_filters_changed()
timeline_source::text_filters_changed()
{
this->rebuild_indexes();
@ -1049,13 +1050,13 @@ gantt_source::text_filters_changed()
}
int
gantt_source::get_filtered_count() const
timeline_source::get_filtered_count() const
{
return this->gs_filtered_count;
}
int
gantt_source::get_filtered_count_for(size_t filter_index) const
timeline_source::get_filtered_count_for(size_t filter_index) const
{
return this->gs_filter_hits[filter_index];
}
@ -1082,8 +1083,8 @@ timestamp_poss()
}
void
gantt_source::text_crumbs_for_line(int line,
std::vector<breadcrumb::crumb>& crumbs)
timeline_source::text_crumbs_for_line(int line,
std::vector<breadcrumb::crumb>& crumbs)
{
text_sub_source::text_crumbs_for_line(line, crumbs);

View File

@ -27,34 +27,34 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lnav_gantt_source_hh
#define lnav_gantt_source_hh
#ifndef lnav_timeline_source_hh
#define lnav_timeline_source_hh
#include "base/map_util.hh"
#include "gantt_status_source.hh"
#include "logfile_sub_source.hh"
#include "plain_text_source.hh"
#include "text_overlay_menu.hh"
#include "textview_curses.hh"
#include "timeline_status_source.hh"
class gantt_preview_overlay : public list_overlay_source {
class timeline_preview_overlay : public list_overlay_source {
public:
std::vector<attr_line_t> list_overlay_menu(const listview_curses& lv,
vis_line_t line) override;
};
class gantt_source
class timeline_source
: public text_sub_source
, public list_input_delegate
, public text_time_translator
, public text_delegate {
public:
explicit gantt_source(textview_curses& log_view,
logfile_sub_source& lss,
textview_curses& preview_view,
plain_text_source& preview_source,
statusview_curses& preview_status_view,
gantt_status_source& preview_status_source);
explicit timeline_source(textview_curses& log_view,
logfile_sub_source& lss,
textview_curses& preview_view,
plain_text_source& preview_source,
statusview_curses& preview_status_view,
timeline_status_source& preview_status_source);
bool list_input_handle_key(listview_curses& lv, int ch) override;
@ -100,7 +100,7 @@ public:
textview_curses& gs_preview_view;
plain_text_source& gs_preview_source;
statusview_curses& gs_preview_status_view;
gantt_status_source& gs_preview_status_source;
timeline_status_source& gs_preview_status_source;
ArenaAlloc::Alloc<char> gs_allocator{64 * 1024};
struct opid_description_def_key {
@ -125,13 +125,13 @@ public:
odd_defs;
};
using gantt_subid_map
using timeline_subid_map
= robin_hood::unordered_map<string_fragment,
bool,
frag_hasher,
std::equal_to<string_fragment>>;
gantt_subid_map gs_subid_map;
timeline_subid_map gs_subid_map;
struct opid_row {
string_fragment or_name;
@ -159,22 +159,22 @@ public:
}
};
using gantt_opid_row_map
using timeline_opid_row_map
= robin_hood::unordered_map<string_fragment,
opid_row,
frag_hasher,
std::equal_to<string_fragment>>;
using gantt_desc_map
using timeline_desc_map
= robin_hood::unordered_set<string_fragment,
frag_hasher,
std::equal_to<string_fragment>>;
gantt_preview_overlay gs_preview_overlay;
timeline_preview_overlay gs_preview_overlay;
attr_line_t gs_rendered_line;
size_t gs_opid_width{0};
size_t gs_total_width{0};
gantt_opid_row_map gs_active_opids;
gantt_desc_map gs_descriptions;
timeline_opid_row_map gs_active_opids;
timeline_desc_map gs_descriptions;
std::vector<std::reference_wrapper<opid_row>> gs_time_order;
struct timeval gs_lower_bound {};
struct timeval gs_upper_bound {};
@ -185,9 +185,9 @@ public:
std::vector<text_time_translator::row_info> gs_preview_rows;
};
class gantt_header_overlay : public text_overlay_menu {
class timeline_header_overlay : public text_overlay_menu {
public:
explicit gantt_header_overlay(std::shared_ptr<gantt_source> src);
explicit timeline_header_overlay(std::shared_ptr<timeline_source> src);
bool list_static_overlay(const listview_curses& lv,
int y,
@ -213,7 +213,7 @@ public:
private:
bool gho_show_details{false};
std::shared_ptr<gantt_source> gho_src;
std::shared_ptr<timeline_source> gho_src;
};
#endif

View File

@ -27,14 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lnav_gantt_status_source_hh
#define lnav_gantt_status_source_hh
#ifndef lnav_timeline_status_source_hh
#define lnav_timeline_status_source_hh
#include <string>
#include "statusview_curses.hh"
class gantt_status_source : public status_data_source {
class timeline_status_source : public status_data_source {
public:
typedef enum {
TSF_TITLE,
@ -46,7 +46,7 @@ public:
TSF__MAX
} field_t;
gantt_status_source()
timeline_status_source()
{
this->tss_fields[TSF_TITLE].set_width(16);
this->tss_fields[TSF_TITLE].set_role(role_t::VCR_STATUS_TITLE);

View File

@ -35,7 +35,6 @@
#include "document.sections.hh"
#include "environ_vtab.hh"
#include "filter_sub_source.hh"
#include "gantt_source.hh"
#include "help-md.h"
#include "intervaltree/IntervalTree.h"
#include "lnav.hh"
@ -47,6 +46,7 @@
#include "sql_help.hh"
#include "sql_util.hh"
#include "static_file_vtab.hh"
#include "timeline_source.hh"
#include "view_helpers.crumbs.hh"
#include "view_helpers.examples.hh"
#include "view_helpers.hist.hh"
@ -64,7 +64,7 @@ const char* lnav_view_strings[LNV__MAX + 1] = {
"schema",
"pretty",
"spectro",
"gantt",
"timeline",
nullptr,
};
@ -78,7 +78,7 @@ const char* lnav_view_titles[LNV__MAX] = {
"SCHEMA",
"PRETTY",
"SPECTRO",
"GANTT",
"TIMELINE",
};
std::optional<lnav_view_t>
@ -128,14 +128,15 @@ open_schema_view()
}
static void
open_gantt_view()
open_timeline_view()
{
auto* gantt_tc = &lnav_data.ld_views[LNV_GANTT];
auto* gantt_src = dynamic_cast<gantt_source*>(gantt_tc->get_sub_source());
auto* timeline_tc = &lnav_data.ld_views[LNV_TIMELINE];
auto* timeline_src
= dynamic_cast<timeline_source*>(timeline_tc->get_sub_source());
gantt_src->rebuild_indexes();
gantt_tc->reload_data();
gantt_tc->redo_search();
timeline_src->rebuild_indexes();
timeline_tc->reload_data();
timeline_tc->redo_search();
}
class pretty_sub_source : public plain_text_source {
@ -617,7 +618,7 @@ handle_winch()
lnav_data.ld_filter_view.set_needs_update();
lnav_data.ld_files_view.set_needs_update();
lnav_data.ld_spectro_details_view.set_needs_update();
lnav_data.ld_gantt_details_view.set_needs_update();
lnav_data.ld_timeline_details_view.set_needs_update();
lnav_data.ld_user_message_view.set_needs_update();
return true;
@ -638,11 +639,11 @@ layout_views()
= !lnav_data.ld_preview_status_source[1].get_description().empty();
bool filters_supported = false;
auto is_spectro = false;
auto is_gantt = false;
auto is_timeline = false;
lnav_data.ld_view_stack.top() | [&](auto tc) {
is_spectro = (tc == &lnav_data.ld_views[LNV_SPECTRO]);
is_gantt = (tc == &lnav_data.ld_views[LNV_GANTT]);
is_timeline = (tc == &lnav_data.ld_views[LNV_TIMELINE]);
auto* tss = tc->get_sub_source();
@ -785,19 +786,19 @@ layout_views()
lnav_data.ld_status[LNS_DOC].set_width(width);
lnav_data.ld_status[LNS_DOC].set_visible(has_doc && vis);
if (is_gantt) {
vis = bottom.try_consume(lnav_data.ld_gantt_details_view.get_height()
if (is_timeline) {
vis = bottom.try_consume(lnav_data.ld_timeline_details_view.get_height()
+ 1);
} else {
vis = false;
}
lnav_data.ld_gantt_details_view.set_y(bottom + 1);
lnav_data.ld_gantt_details_view.set_width(width);
lnav_data.ld_gantt_details_view.set_visible(vis);
lnav_data.ld_timeline_details_view.set_y(bottom + 1);
lnav_data.ld_timeline_details_view.set_width(width);
lnav_data.ld_timeline_details_view.set_visible(vis);
lnav_data.ld_status[LNS_GANTT].set_y(bottom);
lnav_data.ld_status[LNS_GANTT].set_width(width);
lnav_data.ld_status[LNS_GANTT].set_visible(vis);
lnav_data.ld_status[LNS_TIMELINE].set_y(bottom);
lnav_data.ld_status[LNS_TIMELINE].set_width(width);
lnav_data.ld_status[LNS_TIMELINE].set_visible(vis);
vis = bottom.try_consume(filter_height + (config_panel_open ? 1 : 0)
+ (filters_supported ? 1 : 0));
@ -1091,7 +1092,7 @@ toggle_view(textview_curses* toggle_tc)
lnav_data.ld_view_stack.pop_back();
lnav_data.ld_view_stack.top() | [](auto* tc) {
// XXX
if (tc == &lnav_data.ld_views[LNV_GANTT]) {
if (tc == &lnav_data.ld_views[LNV_TIMELINE]) {
auto tss = tc->get_sub_source();
tss->text_filters_changed();
tc->reload_data();
@ -1107,8 +1108,8 @@ toggle_view(textview_curses* toggle_tc)
open_schema_view();
} else if (toggle_tc == &lnav_data.ld_views[LNV_PRETTY]) {
open_pretty_view();
} else if (toggle_tc == &lnav_data.ld_views[LNV_GANTT]) {
open_gantt_view();
} else if (toggle_tc == &lnav_data.ld_views[LNV_TIMELINE]) {
open_timeline_view();
} else if (toggle_tc == &lnav_data.ld_views[LNV_HISTOGRAM]) {
// Rebuild to reflect changes in marks.
rebuild_hist();
@ -1272,7 +1273,8 @@ get_textview_for_mode(ln_mode_t mode)
}
}
hist_index_delegate::hist_index_delegate(hist_source2& hs, textview_curses& tc)
hist_index_delegate::
hist_index_delegate(hist_source2& hs, textview_curses& tc)
: hid_source(hs), hid_view(tc)
{
}
@ -1466,7 +1468,7 @@ all_views()
retval.push_back(&lnav_data.ld_filter_view);
retval.push_back(&lnav_data.ld_user_message_view);
retval.push_back(&lnav_data.ld_spectro_details_view);
retval.push_back(&lnav_data.ld_gantt_details_view);
retval.push_back(&lnav_data.ld_timeline_details_view);
retval.push_back(lnav_data.ld_rl_view);
return retval;

View File

@ -53,7 +53,7 @@ typedef enum {
LNV_SCHEMA,
LNV_PRETTY,
LNV_SPECTRO,
LNV_GANTT,
LNV_TIMELINE,
LNV__MAX
} lnav_view_t;

View File

@ -207,7 +207,7 @@ dist_noinst_SCRIPTS = \
test_events.sh \
test_format_installer.sh \
test_format_loader.sh \
test_gantt.sh \
test_timeline.sh \
test_grep_proc.sh \
test_json_format.sh \
test_line_buffer.sh \
@ -490,7 +490,7 @@ TESTS = \
test_listview.sh \
test_meta.sh \
test_mvwattrline.sh \
test_gantt.sh \
test_timeline.sh \
test_grep_proc.sh \
test_grep_proc2 \
test_json_format.sh \

View File

@ -306,26 +306,6 @@ EXPECTED_FILES = \
$(srcdir)/%reldir%/test_format_loader.sh_5992e2695b7e6cf1f3520dbb87af8fc2b8f27088.out \
$(srcdir)/%reldir%/test_format_loader.sh_fca6c1fb9f3aaa69b3ffb2d1a8a86434b2f4a247.err \
$(srcdir)/%reldir%/test_format_loader.sh_fca6c1fb9f3aaa69b3ffb2d1a8a86434b2f4a247.out \
$(srcdir)/%reldir%/test_gantt.sh_3af11588ee36bab7e2caea0f7a24d3c9cafd2310.err \
$(srcdir)/%reldir%/test_gantt.sh_3af11588ee36bab7e2caea0f7a24d3c9cafd2310.out \
$(srcdir)/%reldir%/test_gantt.sh_3c2669075d0636fab98e2a67a72613420f22c322.err \
$(srcdir)/%reldir%/test_gantt.sh_3c2669075d0636fab98e2a67a72613420f22c322.out \
$(srcdir)/%reldir%/test_gantt.sh_63500be50fc6743d8312133e2030cbbc39ca15ff.err \
$(srcdir)/%reldir%/test_gantt.sh_63500be50fc6743d8312133e2030cbbc39ca15ff.out \
$(srcdir)/%reldir%/test_gantt.sh_740f22814c5d856234c2450168dae22989c85d1e.err \
$(srcdir)/%reldir%/test_gantt.sh_740f22814c5d856234c2450168dae22989c85d1e.out \
$(srcdir)/%reldir%/test_gantt.sh_74a94ee9103eac5e8e78ca57bccf49efa3827a9d.err \
$(srcdir)/%reldir%/test_gantt.sh_74a94ee9103eac5e8e78ca57bccf49efa3827a9d.out \
$(srcdir)/%reldir%/test_gantt.sh_83db753dd2669f801810f311e2d7d74397e10f26.err \
$(srcdir)/%reldir%/test_gantt.sh_83db753dd2669f801810f311e2d7d74397e10f26.out \
$(srcdir)/%reldir%/test_gantt.sh_8fed8a7400042814ba13e50be5e3bd1741d82119.err \
$(srcdir)/%reldir%/test_gantt.sh_8fed8a7400042814ba13e50be5e3bd1741d82119.out \
$(srcdir)/%reldir%/test_gantt.sh_b013ab41c3cca76cf05a01ca1ba65888be247ada.err \
$(srcdir)/%reldir%/test_gantt.sh_b013ab41c3cca76cf05a01ca1ba65888be247ada.out \
$(srcdir)/%reldir%/test_gantt.sh_cde7947f361e5f3d4cd1bbc3f7458f426b6a8eb4.err \
$(srcdir)/%reldir%/test_gantt.sh_cde7947f361e5f3d4cd1bbc3f7458f426b6a8eb4.out \
$(srcdir)/%reldir%/test_gantt.sh_e6a4681a5a671c84c020dc91d7ce03c9d17fde07.err \
$(srcdir)/%reldir%/test_gantt.sh_e6a4681a5a671c84c020dc91d7ce03c9d17fde07.out \
$(srcdir)/%reldir%/test_json_format.sh_168cac40c27f547044c89d39eb0ff2ef81da4b21.err \
$(srcdir)/%reldir%/test_json_format.sh_168cac40c27f547044c89d39eb0ff2ef81da4b21.out \
$(srcdir)/%reldir%/test_json_format.sh_1bb0fd243e916546aea22029245ac590dae17a86.err \
@ -1330,4 +1310,24 @@ EXPECTED_FILES = \
$(srcdir)/%reldir%/test_text_file.sh_f586ef080a86dfe1f981b345bcf8d7a279b2b247.out \
$(srcdir)/%reldir%/test_text_file.sh_f7522b0a99550a3ff91aae6582eb861547c535e1.err \
$(srcdir)/%reldir%/test_text_file.sh_f7522b0a99550a3ff91aae6582eb861547c535e1.out \
$(srcdir)/%reldir%/test_timeline.sh_1a611c8752ca85361f436768a9982051530a5d2a.err \
$(srcdir)/%reldir%/test_timeline.sh_1a611c8752ca85361f436768a9982051530a5d2a.out \
$(srcdir)/%reldir%/test_timeline.sh_3c2669075d0636fab98e2a67a72613420f22c322.err \
$(srcdir)/%reldir%/test_timeline.sh_3c2669075d0636fab98e2a67a72613420f22c322.out \
$(srcdir)/%reldir%/test_timeline.sh_3fb943420cd43a6540bcac4702e257dcbbf00cc6.err \
$(srcdir)/%reldir%/test_timeline.sh_3fb943420cd43a6540bcac4702e257dcbbf00cc6.out \
$(srcdir)/%reldir%/test_timeline.sh_403bc375071bc26f955b317d751a7d65fb433bc7.err \
$(srcdir)/%reldir%/test_timeline.sh_403bc375071bc26f955b317d751a7d65fb433bc7.out \
$(srcdir)/%reldir%/test_timeline.sh_7f300bf5f67f7ac2b0929990ed2670eea74062d1.err \
$(srcdir)/%reldir%/test_timeline.sh_7f300bf5f67f7ac2b0929990ed2670eea74062d1.out \
$(srcdir)/%reldir%/test_timeline.sh_92bccfbb9fb45d7ab03934d662cc99ce50c77d8b.err \
$(srcdir)/%reldir%/test_timeline.sh_92bccfbb9fb45d7ab03934d662cc99ce50c77d8b.out \
$(srcdir)/%reldir%/test_timeline.sh_a3af66b778018a11f912ce81bf8b4437b0ffddd0.err \
$(srcdir)/%reldir%/test_timeline.sh_a3af66b778018a11f912ce81bf8b4437b0ffddd0.out \
$(srcdir)/%reldir%/test_timeline.sh_c54de09ae2633ee461ff92fdede81e2b36623c27.err \
$(srcdir)/%reldir%/test_timeline.sh_c54de09ae2633ee461ff92fdede81e2b36623c27.out \
$(srcdir)/%reldir%/test_timeline.sh_c59a35537a919d78245edf21b83f9c0f3e0693dc.err \
$(srcdir)/%reldir%/test_timeline.sh_c59a35537a919d78245edf21b83f9c0f3e0693dc.out \
$(srcdir)/%reldir%/test_timeline.sh_ced7291b2185772065e32d1add9ce5d4894482a0.err \
$(srcdir)/%reldir%/test_timeline.sh_ced7291b2185772065e32d1add9ce5d4894482a0.out \
$()

View File

@ -9,4 +9,4 @@ db
schema
pretty
spectro
gantt
timeline

View File

@ -11,43 +11,43 @@ run_cap_test ${lnav_test} -n \
run_cap_test ${lnav_test} -n \
-c ";UPDATE all_logs set log_opid = 'test1' where log_line in (1, 3, 6)" \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
${test_dir}/logfile_glog.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
${test_dir}/logfile_generic.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':filter-in CdysLK1XpcrXOpVDuh' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':filter-out CdysLK1XpcrXOpVDuh' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':hide-file *' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':close *' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':hide-lines-before 2011-11-03 00:19:37' \
${test_dir}/logfile_bro_http.log.0
run_cap_test ${lnav_test} -n \
-c ':switch-to-view gantt' \
-c ':switch-to-view timeline' \
-c ':hide-lines-after 2011-11-03 00:20:30' \
${test_dir}/logfile_bro_http.log.0