File indexing completed on 2024-05-12 05:21:41

0001 # Copyright (c) 2019 Alexander Potashev <aspotashev@gmail.com>
0002 #
0003 # This program is free software; you can redistribute it and/or
0004 # modify it under the terms of the GNU General Public License as
0005 # published by the Free Software Foundation; either version 2 of
0006 # the License or (at your option) version 3 or any later version
0007 # accepted by the membership of KDE e.V. (or its successor approved
0008 # by the membership of KDE e.V.), which shall act as a proxy
0009 # defined in Section 14 of version 3 of the license.
0010 #
0011 # This program is distributed in the hope that it will be useful,
0012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 # GNU General Public License for more details.
0015 #
0016 # You should have received a copy of the GNU General Public License
0017 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 
0019 
0020 # Old comments from Bash-based benchmark:
0021 #   This is a bash script for a ktimetracker benchmark - how fast is ktimetracker on your system ?
0022 #   example: my 2.4GHz Quad-core X64 computer with 4GB RAM needs 50 seconds
0023 def run(app):
0024     for n in range(2):
0025         # add 300 tasks
0026         for i in range(300):
0027             name = 'task%d-%03d' % (n, i)
0028             app.addTask(name)
0029 
0030             ids = app.taskIdsFromName(name)
0031             assert len(ids) == 1
0032 
0033             app.startTimerFor(ids[0])
0034 
0035         app.saveAll()
0036         app.stopAllTimersDBUS()
0037 
0038 
0039 def test_benchmark(benchmark, app_testfile):
0040     benchmark.pedantic(run, args=(app_testfile,))