/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
staticvoid getTimeDifference(const TimeValue* pTimeStart, const TimeValue* pTimeEnd,
TimeValue* pTimeDifference)
{ // We add 1 second to the nanoseconds to ensure that we get a positive number // We have to normalise anyway so this doesn't cause any harm. // (Seconds/Nanosec are both unsigned)
pTimeDifference->Seconds = pTimeEnd->Seconds - pTimeStart->Seconds - 1;
pTimeDifference->Nanosec = 1000000000 + pTimeEnd->Nanosec - pTimeStart->Nanosec;
normaliseTimeValue(pTimeDifference);
}
/* * The recommended way to run this test is: * 'SAL_LOG="" DBA_PERFTEST=YES make CppunitTest_dbaccess_embeddeddb_performancetest' * This blocks the unnecessary exception output and show only the performance data. * * You also need to create the file dbaccess/qa/unit/data/wordlist, this list cannot * contain any unescaped apostrophes (since the words are used directly to assemble * sql statement), apostrophes are escaped using a double apostrophe, i.e. ''. * one easy way of generating a list is using: * 'for WORD in $(aspell dump master); do echo ${WORD//\'/\'\'}; done > dbaccess/qa/unit/data/wordlist' * * Note that wordlist cannot have more than 220580 lines, this is due to a hard * limit in our hsqldb version. * * Also note that this unit test "fails" when doing performance testing, this is * since by default unit test output is hidden, and thus there is no way of * reading the results.
*/ class EmbeddedDBPerformanceTest
: public DBTestBase
{ private: static constexpr OUString our_sEnableTestEnvVar = u"DBA_PERFTEST"_ustr;
// We store the results and print them at the end due to the amount of warning // noise present which otherwise obscures the results.
OUStringBuffer m_aOutputBuffer;
/** * Use an existing .odb to do performance tests on. The database cannot have * a table of the name PFTESTTABLE.
*/ void EmbeddedDBPerformanceTest::doPerformanceTestOnODB( const OUString& rDriverURL,
std::u16string_view rDBName, constbool bUsePreparedStatement)
{
createDBDocument(rDriverURL);
uno::Reference< XOfficeDatabaseDocument > xDocument(mxComponent, UNO_QUERY_THROW);
// Although not strictly necessary we use quoted identifiers to reflect // the fact that Base always uses quoted identifiers.
xStatement->execute(
u"CREATE TABLE \"PFTESTTABLE\" ( \"ID\" INTEGER NOT NULL PRIMARY KEY " ", \"STRINGCOLUMNA\" VARCHAR (50) " ")"_ustr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.