Skip to content

Commit 848d486

Browse files
committed
[timeline] add files and threads
1 parent 62d1379 commit 848d486

36 files changed

+840
-573
lines changed

NEWS.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,17 @@ Interface changes:
185185
close the completion popup, it was too easy to
186186
cancel the prompt. Pressing `CTRL+]` will still
187187
close the prompt immediately.
188-
* The TIMELINE view header has been redesigned to be
189-
one line that shows the time increments at the
190-
current scale. This approach should more clearly
191-
convey the spans of time shown in the main part of the
192-
view. The previous design tried to show the overall
193-
time and the current time frame. But, the multi-line
194-
header was hard to interpret and didn't make it clear
195-
how large the time increments were.
188+
* The TIMELINE view has a few updates:
189+
- The header has been redesigned to be one line that
190+
shows the time increments at the current scale.
191+
This approach should more clearly convey the spans
192+
of time shown in the main part of the view. The
193+
previous design tried to show the overall time and
194+
the current time frame. But, the multi-line header
195+
was hard to interpret and didn't make it clear how
196+
large the time increments were.
197+
- Log files and threads are now shown in the view
198+
in addition to operations.
196199
* The HIST view now shows the year and inserts a spacer
197200
row in-between gaps in time. The spacer row shows
198201
bullet points on a log scale to represent the amount

docs/schemas/config-v1.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,16 @@
522522
"description": "Icon for a 'edit' button",
523523
"title": "/ui/theme-defs/<theme_name>/icons/edit",
524524
"$ref": "#/definitions/icon"
525+
},
526+
"file": {
527+
"description": "Icon for files",
528+
"title": "/ui/theme-defs/<theme_name>/icons/file",
529+
"$ref": "#/definitions/icon"
530+
},
531+
"thread": {
532+
"description": "Icon for threads",
533+
"title": "/ui/theme-defs/<theme_name>/icons/thread",
534+
"$ref": "#/definitions/icon"
525535
}
526536
},
527537
"additionalProperties": false

docs/source/ui.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ TIMELINE
424424
VMWare Update Manager. Most rows show API requests as they
425425
are received and processed.
426426

427-
The timeline view [#]_ visualizes operations over time. The operations
428-
are ordered top-to-bottom by their start time. So, scrolling down will
429-
move forward in time. An operation is identified by an ID that can come
427+
The timeline view [#]_ visualizes log files, threads, and operations over time.
428+
The items are ordered top-to-bottom by their start time. So, scrolling down
429+
will move forward in time. An operation is identified by an ID that can come
430430
from multiple sources:
431431

432432
* If the ID is in the log message, the log format can set the

src/base/attr_line.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@ attr_line_t::with_ansi_string(const string_fragment& str)
272272
return *this;
273273
}
274274

275+
attr_line_t&
276+
attr_line_t::append(ui_icon_t value)
277+
{
278+
size_t start_len = this->al_string.length();
279+
280+
this->al_string.append(" ");
281+
line_range lr{(int) start_len, (int) this->al_string.length()};
282+
283+
this->al_attrs.emplace_back(lr, VC_ICON.value(value));
284+
285+
return *this;
286+
}
287+
275288
namespace text_stream {
276289
struct word {
277290
string_fragment w_word;

src/base/attr_line.hh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ public:
292292
return *this;
293293
}
294294

295+
attr_line_t& append(ui_icon_t value);
296+
295297
template<typename S>
296298
attr_line_t& append(S str, const string_attr_pair& value)
297299
{
@@ -343,6 +345,16 @@ public:
343345
return *this;
344346
}
345347

348+
template<typename T>
349+
attr_line_t& append(const std::optional<T> &value)
350+
{
351+
if (value) {
352+
this->append(*value);
353+
}
354+
355+
return *this;
356+
}
357+
346358
template<typename S>
347359
attr_line_t& append_quoted(const std::pair<S, string_attr_pair>& value)
348360
{

src/base/lnav.console.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ wchar_for_icon(ui_icon_t ic)
514514
return {U'\u25b6', role_t::VCR_TEXT};
515515
case ui_icon_t::edit:
516516
return {U'\u270f', role_t::VCR_TEXT};
517+
case ui_icon_t::file:
518+
return {U'\U0001f4c4', role_t::VCR_TEXT};
519+
case ui_icon_t::thread:
520+
return {U'\U0001F9F5', role_t::VCR_TEXT};
517521
}
518522

519523
ensure(false);

src/base/string_attr_type.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ enum class ui_icon_t : int32_t {
6767

6868
play,
6969
edit,
70+
file,
71+
thread,
7072
};
7173

72-
constexpr auto ui_icon_count = lnav::enums::to_underlying(ui_icon_t::edit) + 1;
74+
constexpr auto ui_icon_count = lnav::enums::to_underlying(ui_icon_t::thread) + 1;
7375

7476
/** Roles that can be mapped to curses attributes using attrs_for_role() */
7577
enum class role_t : int32_t {

src/file_vtab.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "log_format.hh"
4444
#include "logfile.hh"
4545
#include "session_data.hh"
46+
#include "text_format.hh"
4647
#include "vtab_module.hh"
4748
#include "vtab_module_json.hh"
4849

src/line_buffer.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,12 @@ line_buffer::load_next_buffer()
633633
ssize_t rc = 0;
634634
safe::WriteAccess<safe_gz_indexed> gi(this->lb_gz_file);
635635

636+
#if 0
636637
log_debug("BEGIN fd(%d) preload read of %zu at %lld",
637638
this->lb_fd.get(),
638639
this->lb_alt_buffer.value().available(),
639640
start + this->lb_alt_buffer->size());
641+
#endif
640642
/* ... read in the new data. */
641643
if (!this->lb_cached_fd && *gi) {
642644
if (this->lb_file_size != (ssize_t) -1 && this->in_range(start)
@@ -781,7 +783,6 @@ line_buffer::load_next_buffer()
781783
retval = true;
782784
break;
783785
}
784-
// log_debug("END preload read");
785786

786787
if (start > this->lb_last_line_offset) {
787788
const auto* line_start = this->lb_alt_buffer.value().begin();
@@ -808,7 +809,7 @@ line_buffer::load_next_buffer()
808809
} while (line_start != nullptr
809810
&& line_start < this->lb_alt_buffer->end());
810811
}
811-
log_debug("END preload read");
812+
// log_debug("END preload read");
812813

813814
return retval;
814815
}

src/lnav_config.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,14 @@ static const json_path_container theme_icons_handlers = {
715715
.with_description("Icon for a 'edit' button")
716716
.for_child(&lnav_theme::lt_icon_edit)
717717
.with_children(icon_config_handlers),
718+
yajlpp::property_handler("file")
719+
.with_description("Icon for files")
720+
.for_child(&lnav_theme::lt_icon_file)
721+
.with_children(icon_config_handlers),
722+
yajlpp::property_handler("thread")
723+
.with_description("Icon for threads")
724+
.for_child(&lnav_theme::lt_icon_thread)
725+
.with_children(icon_config_handlers),
718726
};
719727

720728
static const struct json_path_container theme_styles_handlers = {

0 commit comments

Comments
 (0)