taskwarrior/performance/load
Felix Schurk 85f52e3630
Update performance scripts (#3532)
* update performance script to work with out-of-source build
* update displayed messages and remove perf.rc file
* remove .gitignore in performance folder
2024-07-04 08:45:42 +02:00

50 lines
1.1 KiB
Perl
Executable file

#! /usr/bin/perl
use strict;
use warnings;
if (open my $fh, '>', 'perf.rc')
{
print $fh "data.location=.\n",
"color=on\n",
"_forcecolor=on\n",
"verbose=label\n",
"hooks=off\n",
"color.debug=\n";
close $fh;
}
my $filename = '${CMAKE_SOURCE_DIR}/performance/sample-text.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
# Read all the data.
my $id = 1;
while (my $line = <$fh>)
{
if ($. % 20 != 19)
{
# Names are both projects and tags.
$line =~ s/([A-Z]{2,})/$1 project:$1 +$1/g;
}
if ($. % 20 == 19)
{
my $anno_id = $id - 1;
qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off $anno_id annotate $line};
print "[$.] task rc:perf.rc rc.gc=off $anno_id annotate $line\n" if $?;
}
elsif ($. % 4 == 1)
{
qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off add $line};
print "[$.] task rc:perf.rc rc.gc=off add $line\n" if $?;
++$id;
}
else
{
qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off log $line};
print "[$.] task rc:perf.rc rc.gc=off log $line\n" if $?;
}
}
exit 0;