2 * @brief performance tests for Xapian.
4 /* Copyright 2008 Lemur Consulting Ltd
5 * Copyright 2010 Olly Betts
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 #ifndef XAPIAN_INCLUDED_PERFTEST_H
24 #define XAPIAN_INCLUDED_PERFTEST_H
32 class PerfTestLogger
{
35 int repetition_number
;
37 bool testcase_started
;
39 bool indexing_started
;
40 Xapian::doccount indexing_addcount
;
41 bool indexing_unlogged_changes
;
42 double indexing_timer
;
43 double last_indexlog_timer
;
45 bool searching_started
;
46 double searching_timer
;
48 /** Write a log entry for the current indexing run.
52 void write(const std::string
& text
);
58 /** Open a file to log to.
60 * Returns false if the file can't be opened.
62 bool open(const std::string
& logpath
);
64 /** Flush and close the log file.
68 /** Log the start of an indexing run.
70 void indexing_begin(const std::string
& dbname
,
71 const std::map
<std::string
, std::string
> & params
);
73 /** Log the addition of a document in an indexing run.
77 /** Log the end of an indexing run.
81 /** Log the start of a search run.
83 void searching_start(const std::string
& description
);
85 /** Log the start of a search.
89 /** Log the completion of a search.
91 void search_end(const Xapian::Query
& query
,
92 const Xapian::MSet
& mset
);
94 /** Log the end of a search run.
100 void testcase_begin(const std::string
& testcase
);
106 /** Start a repetition of the tests.
108 void repetition_begin(int num
);
110 /** End a repetition of the tests.
112 void repetition_end();
115 extern PerfTestLogger logger
;
117 #endif // XAPIAN_INCLUDED_PERFTEST_H