xapian-core  2.0.0
perftest.h
Go to the documentation of this file.
1 
4 /* Copyright 2008 Lemur Consulting Ltd
5  * Copyright 2010 Olly Betts
6  *
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.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_PERFTEST_H
23 #define XAPIAN_INCLUDED_PERFTEST_H
24 
25 #include <xapian.h>
26 
27 #include <fstream>
28 #include <map>
29 #include <string>
30 
32  std::ofstream out;
33 
35 
37 
43 
46 
49 
52  void indexing_log();
53 
54  void write(const std::string & text);
55 
56  public:
59 
64  bool open(const std::string & logpath);
65 
68  void close();
69 
72  void indexing_begin(const std::string & dbname,
73  const std::map<std::string, std::string> & params);
74 
77  void indexing_add();
78 
81  void indexing_end();
82 
85  void searching_start(const std::string & description);
86 
89  void search_start();
90 
93  void search_end(const Xapian::Query & query,
94  const Xapian::MSet & mset);
95 
98  void searching_end();
99 
102  void diversifying_start(const std::string & description);
103 
106  void diversify_start();
107 
112  const Xapian::MSet& dset);
113 
116  void diversifying_end();
117 
120  void testcase_begin(const std::string & testcase);
121 
124  void testcase_end();
125 
128  void repetition_begin(int num);
129 
132  void repetition_end();
133 };
134 
135 extern PerfTestLogger logger;
136 
137 #endif // XAPIAN_INCLUDED_PERFTEST_H
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
Definition: api_anydb.cc:62
double searching_timer
Definition: perftest.h:45
void repetition_end()
End a repetition of the tests.
Definition: perftest.cc:480
Xapian::doccount indexing_addcount
Definition: perftest.h:39
void indexing_begin(const std::string &dbname, const std::map< std::string, std::string > &params)
Log the start of an indexing run.
Definition: perftest.cc:293
bool diversifying_started
Definition: perftest.h:47
int repetition_number
Definition: perftest.h:34
double indexing_timer
Definition: perftest.h:41
bool indexing_unlogged_changes
Definition: perftest.h:40
void diversify_start()
Log the start of diversification.
Definition: perftest.cc:420
void testcase_end()
End a testcase.
Definition: perftest.cc:463
void search_end(const Xapian::Query &query, const Xapian::MSet &mset)
Log the completion of a search.
Definition: perftest.cc:381
bool indexing_started
Definition: perftest.h:38
void close()
Flush and close the log file.
Definition: perftest.cc:283
void diversifying_start(const std::string &description)
Log the start of a diversification run.
Definition: perftest.cc:409
void searching_end()
Log the end of a search run.
Definition: perftest.cc:400
std::ofstream out
Definition: perftest.h:32
void search_start()
Log the start of a search.
Definition: perftest.cc:375
void repetition_begin(int num)
Start a repetition of the tests.
Definition: perftest.cc:473
void diversify_end(Xapian::doccount k, Xapian::doccount r, const Xapian::MSet &dset)
Log the completion of diversification.
Definition: perftest.cc:426
bool searching_started
Definition: perftest.h:44
double diversifying_timer
Definition: perftest.h:48
void indexing_log()
Write a log entry for the current indexing run.
Definition: perftest.cc:325
void indexing_end()
Log the end of an indexing run.
Definition: perftest.cc:354
bool testcase_started
Definition: perftest.h:36
void searching_start(const std::string &description)
Log the start of a search run.
Definition: perftest.cc:364
double last_indexlog_timer
Definition: perftest.h:42
void diversifying_end()
Log the end of a diversification run.
Definition: perftest.cc:444
bool open(const std::string &logpath)
Open a file to log to.
Definition: perftest.cc:237
void write(const std::string &text)
Definition: perftest.cc:276
void testcase_begin(const std::string &testcase)
Start a testcase.
Definition: perftest.cc:453
void indexing_add()
Log the addition of a document in an indexing run.
Definition: perftest.cc:338
Class representing a list of search results.
Definition: mset.h:46
Class representing a query.
Definition: query.h:45
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
PerfTestLogger logger
Definition: perftest.cc:51
Public interfaces for the Xapian library.