mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Instrumentation
- Added timing measurement for table sorting. - Added timing measurement for table composition.
This commit is contained in:
parent
43266a825f
commit
031c4c484d
1 changed files with 11 additions and 7 deletions
|
@ -818,14 +818,17 @@ const std::string Table::render (int maxrows /* = 0 */, int maxlines /* = 0 */)
|
||||||
|
|
||||||
// Determine row order, according to sort options.
|
// Determine row order, according to sort options.
|
||||||
std::vector <int> order;
|
std::vector <int> order;
|
||||||
for (int row = 0; row < mRows; ++row)
|
|
||||||
order.push_back (row);
|
|
||||||
|
|
||||||
// Only sort if necessary.
|
|
||||||
if (mSortColumns.size ())
|
|
||||||
{
|
{
|
||||||
table = this; // Substitute for 'this' in the static 'sort_compare'.
|
Timer t ("Table::render/sort");
|
||||||
std::sort (order.begin (), order.end (), sort_compare);
|
for (int row = 0; row < mRows; ++row)
|
||||||
|
order.push_back (row);
|
||||||
|
|
||||||
|
// Only sort if necessary.
|
||||||
|
if (mSortColumns.size ())
|
||||||
|
{
|
||||||
|
table = this; // Substitute for 'this' in the static 'sort_compare'.
|
||||||
|
std::sort (order.begin (), order.end (), sort_compare);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a non-zero maxrows is specified, then it limits the number of rows of
|
// If a non-zero maxrows is specified, then it limits the number of rows of
|
||||||
|
@ -838,6 +841,7 @@ const std::string Table::render (int maxrows /* = 0 */, int maxlines /* = 0 */)
|
||||||
// of output from the table that are rendered.
|
// of output from the table that are rendered.
|
||||||
|
|
||||||
// Print all rows.
|
// Print all rows.
|
||||||
|
Timer t2 ("Table::render/compose");
|
||||||
for (int row = 0; row < limitrows; ++row)
|
for (int row = 0; row < limitrows; ++row)
|
||||||
{
|
{
|
||||||
std::vector <std::vector <std::string> > columns;
|
std::vector <std::vector <std::string> > columns;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue