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 bool diversifying_started
;
49 double diversifying_timer
;
51 /** Write a log entry for the current indexing run.
55 void write(const std::string
& text
);
61 /** Open a file to log to.
63 * Returns false if the file can't be opened.
65 bool open(const std::string
& logpath
);
67 /** Flush and close the log file.
71 /** Log the start of an indexing run.
73 void indexing_begin(const std::string
& dbname
,
74 const std::map
<std::string
, std::string
> & params
);
76 /** Log the addition of a document in an indexing run.
80 /** Log the end of an indexing run.
84 /** Log the start of a search run.
86 void searching_start(const std::string
& description
);
88 /** Log the start of a search.
92 /** Log the completion of a search.
94 void search_end(const Xapian::Query
& query
,
95 const Xapian::MSet
& mset
);
97 /** Log the end of a search run.
101 /** Log the start of a diversification run.
103 void diversifying_start(const std::string
& description
);
105 /** Log the start of diversification.
107 void diversify_start();
109 /** Log the completion of diversification.
111 void diversify_end(Xapian::doccount k
,
113 const Xapian::DocumentSet
& dset
);
115 /** Log the end of a diversification run.
117 void diversifying_end();
119 /** Start a testcase.
121 void testcase_begin(const std::string
& testcase
);
127 /** Start a repetition of the tests.
129 void repetition_begin(int num
);
131 /** End a repetition of the tests.
133 void repetition_end();
136 extern PerfTestLogger logger
;
138 #endif // XAPIAN_INCLUDED_PERFTEST_H