summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZofia Grzelewska <z.abramowska@samsung.com>2018-02-19 18:51:47 +0100
committerDariusz Michaluk <d.michaluk@samsung.com>2018-08-10 13:01:42 +0000
commit624164e35894c4bcffba8f5f3f2b6a0f189180eb (patch)
tree876ba2597ff1b17ce308071ba2c6e2ddac4f0b68
parenta73a174b9617b0ea9db436fe67ca05be7adbf071 (diff)
downloadsecurity-manager-624164e35894c4bcffba8f5f3f2b6a0f189180eb.tar.gz
security-manager-624164e35894c4bcffba8f5f3f2b6a0f189180eb.tar.bz2
security-manager-624164e35894c4bcffba8f5f3f2b6a0f189180eb.zip
Change way of displaying performance test results
Performance tests didn't show enough info about test parameters. Ratios differ greatly between test cases, it is nice to have more infomation, as to why it might be this way. Added displaying of initial db size and for how many apps app defined privileges were installed. Also changed tests names to better describe test case. Change-Id: Icd1816ec56fd70d15d717231c0b70dc25964741e
-rw-r--r--test/test_performance_db.cpp112
1 files changed, 60 insertions, 52 deletions
diff --git a/test/test_performance_db.cpp b/test/test_performance_db.cpp
index 385adc42..e148cae9 100644
--- a/test/test_performance_db.cpp
+++ b/test/test_performance_db.cpp
@@ -148,15 +148,21 @@ double getRatio(const duration<double> &largeDbAvgTime, const duration<double> &
(duration_cast<microseconds>(smallDbAvgTime).count());
}
-void displayResult(const std::string &msg, const duration<double> &largeDbAvgTime,
- const duration<double> &smallDbAvgTime,
- int fullCount = AVG_LOOPS)
+void displayResult(const duration<double> &avgTime, int count, int dbSize, int privs = 0)
{
- double ratio = getRatio(largeDbAvgTime, smallDbAvgTime);
- BOOST_TEST_MESSAGE("\tAverage time for " << msg << convertDurationToString(smallDbAvgTime)
- << "\n\tAverage time for " << fullCount
- << " apps: " << convertDurationToString(largeDbAvgTime)
- << "\n\tRatio: " << ratio);
+ std::string privsStat = "";
+ if (privs != 0) {
+ privsStat = ", apps with privs : " + std::to_string(privs);
+ }
+ BOOST_TEST_MESSAGE("Average time for " << count << " iterations (initial db size : " << dbSize
+ << privsStat
+ << ") : " << convertDurationToString(avgTime));
+}
+
+void displayRatio(const duration<double> &largeDbAvgTime,
+ const duration<double> &smallDbAvgTime)
+{
+ BOOST_TEST_MESSAGE("Ratio : " << getRatio(largeDbAvgTime, smallDbAvgTime));
}
std::string durationToMicroseconds(const duration <double> &time)
@@ -166,40 +172,41 @@ std::string durationToMicroseconds(const duration <double> &time)
BOOST_AUTO_TEST_SUITE(PERFORMANCE_DB_TEST)
-BOOST_AUTO_TEST_CASE(TXX_db_perf_add)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_apps)
{
duration <double> addAppTimeSmallDb, addAppTimeLargeDb;
{
PrivilegeDBFixture pdf;
addAppTimeSmallDb = measureAddAppTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(addAppTimeSmallDb, FEW_LOOPS, 0);
}
{
PrivilegeDBFixture pdf;
- addAppTimeLargeDb = measureAddAppTime(AVG_LOOPS, pdf);
- displayResult("adding " + std::to_string(FEW_LOOPS) + " apps: ", addAppTimeLargeDb / AVG_LOOPS,
- addAppTimeSmallDb);
+ addAppTimeLargeDb = measureAddAppTime(AVG_LOOPS, pdf) / AVG_LOOPS;
+ displayResult(addAppTimeLargeDb, AVG_LOOPS, 0);
}
+ displayRatio(addAppTimeLargeDb, addAppTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_priv)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_app_defined_priv)
{
duration <double> addPrivTimeSmallDb, addPrivTimeLargeDb;
{
PrivilegeDBFixture pdf;
measureAddAppTime(FEW_LOOPS, pdf);
addPrivTimeSmallDb = measureAddPrivilegeTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(addPrivTimeSmallDb, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(AVG_LOOPS, pdf);
- addPrivTimeLargeDb = measureAddPrivilegeTime(AVG_LOOPS, pdf);
-
- displayResult("adding privileges to " + std::to_string(FEW_LOOPS) + " apps: ",
- addPrivTimeLargeDb / AVG_LOOPS, addPrivTimeSmallDb);
+ addPrivTimeLargeDb = measureAddPrivilegeTime(AVG_LOOPS, pdf) / AVG_LOOPS;
+ displayResult(addPrivTimeLargeDb, AVG_LOOPS, AVG_LOOPS);
}
+ displayRatio(addPrivTimeLargeDb, addPrivTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_remove)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_app)
{
duration <double> rmAppTimeSmallDb, rmAppTimeLargeDb;
{
@@ -207,19 +214,19 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_remove)
measureAddAppTime(FEW_LOOPS, pdf);
measureAddPrivilegeTime(FEW_LOOPS, pdf);
rmAppTimeSmallDb = measureRemoveTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(rmAppTimeSmallDb, FEW_LOOPS, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(AVG_LOOPS, pdf);
measureAddPrivilegeTime(AVG_LOOPS, pdf);
- rmAppTimeLargeDb = measureRemoveTime(AVG_LOOPS, pdf);
-
- displayResult("removing " + std::to_string(FEW_LOOPS) + " apps: ",
- rmAppTimeLargeDb / AVG_LOOPS, rmAppTimeSmallDb);
+ rmAppTimeLargeDb = measureRemoveTime(AVG_LOOPS, pdf) / AVG_LOOPS;
+ displayResult(rmAppTimeLargeDb, AVG_LOOPS, AVG_LOOPS, AVG_LOOPS);
}
+ displayRatio(rmAppTimeLargeDb, rmAppTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_add_custom_author)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_app_same_author)
{
duration <double> addAppTimeSmallDb, addAppTimeLargeDb;
@@ -233,16 +240,17 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_add_custom_author)
{
PrivilegeDBFixture pdf;
addAppTimeSmallDb = measureAddAppTime(FEW_LOOPS, pdf, 0, incrementSetAuthor) / FEW_LOOPS;
+ displayResult(addAppTimeSmallDb, FEW_LOOPS, 0);
}
{
PrivilegeDBFixture pdf;
- addAppTimeLargeDb = measureAddAppTime(AVG_LOOPS, pdf, 0, incrementSetAuthor);
- displayResult("adding " + std::to_string(FEW_LOOPS) + " apps: ",
- addAppTimeLargeDb / AVG_LOOPS, addAppTimeSmallDb);
+ addAppTimeLargeDb = measureAddAppTime(AVG_LOOPS, pdf, 0, incrementSetAuthor) / AVG_LOOPS;
+ displayResult(addAppTimeLargeDb, AVG_LOOPS, 0);
}
+ displayRatio(addAppTimeLargeDb, addAppTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_priv_custom_author)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_app_defined_priv_same_author)
{
duration <double> addPrivTimeSmallDb, addPrivTimeLargeDb;
@@ -257,18 +265,18 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_priv_custom_author)
PrivilegeDBFixture pdf;
measureAddAppTime(FEW_LOOPS, pdf, 0, incrementSetAuthor);
addPrivTimeSmallDb = measureAddPrivilegeTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(addPrivTimeSmallDb, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(AVG_LOOPS, pdf, 0, incrementSetAuthor);
- addPrivTimeLargeDb = measureAddPrivilegeTime(AVG_LOOPS, pdf);
-
- displayResult("adding privileges to " + std::to_string(FEW_LOOPS) + " apps: ",
- addPrivTimeLargeDb / AVG_LOOPS, addPrivTimeSmallDb);
+ addPrivTimeLargeDb = measureAddPrivilegeTime(AVG_LOOPS, pdf) / AVG_LOOPS;
+ displayResult(addPrivTimeLargeDb, AVG_LOOPS, AVG_LOOPS);
}
+ displayRatio(addPrivTimeLargeDb, addPrivTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_custom_author)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_app_same_author)
{
duration <double> rmAppTimeSmallDb, rmAppTimeLargeDb;
@@ -284,19 +292,19 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_custom_author)
measureAddAppTime(FEW_LOOPS, pdf, 0, incrementSetAuthor);
measureAddPrivilegeTime(FEW_LOOPS, pdf);
rmAppTimeSmallDb = measureRemoveTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(rmAppTimeSmallDb, FEW_LOOPS, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(AVG_LOOPS, pdf, 0, incrementSetAuthor);
measureAddPrivilegeTime(AVG_LOOPS, pdf);
- rmAppTimeLargeDb = measureRemoveTime(AVG_LOOPS, pdf);
-
- displayResult("removing " + std::to_string(FEW_LOOPS) + " apps: ",
- rmAppTimeLargeDb / AVG_LOOPS, rmAppTimeSmallDb);
+ rmAppTimeLargeDb = measureRemoveTime(AVG_LOOPS, pdf) / AVG_LOOPS;
+ displayResult(rmAppTimeLargeDb, AVG_LOOPS, AVG_LOOPS, AVG_LOOPS);
}
+ displayRatio(rmAppTimeLargeDb, rmAppTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_add_large)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_app_large_db)
{
//measures average add time of adding 300 apps when there is 2700 apps installed.
duration <double> addAppTimeSmallDb, addAppTimeLargeDb;
@@ -305,18 +313,18 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_add_large)
{
PrivilegeDBFixture pdf;
addAppTimeSmallDb = measureAddAppTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(addAppTimeSmallDb, FEW_LOOPS, 0);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(EXISTING_APP_COUNT, pdf);
- addAppTimeLargeDb = measureAddAppTime(ADD_APP_COUNT, pdf);
-
- displayResult("adding " + std::to_string(FEW_LOOPS) + " apps: ",
- addAppTimeLargeDb / ADD_APP_COUNT, addAppTimeSmallDb, ADD_APP_COUNT);
+ addAppTimeLargeDb = measureAddAppTime(ADD_APP_COUNT, pdf) / ADD_APP_COUNT;
+ displayResult(addAppTimeLargeDb, ADD_APP_COUNT, EXISTING_APP_COUNT);
}
+ displayRatio(addAppTimeLargeDb, addAppTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_priv_large)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_add_app_defined_priv_large_db)
{
//measures average adding privileges time of adding 300 apps privileges when there is 2700 apps with privileges installed.
duration <double> addPrivTimeSmallDb, addPrivTimeLargeDb;
@@ -326,38 +334,38 @@ BOOST_AUTO_TEST_CASE(TXX_db_perf_priv_large)
PrivilegeDBFixture pdf;
measureAddAppTime(FEW_LOOPS, pdf);
addPrivTimeSmallDb = measureAddPrivilegeTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(addPrivTimeSmallDb, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(MANY_LOOPS, pdf);
measureAddPrivilegeTime(EXISTING_PRIV_COUNT, pdf);
- addPrivTimeLargeDb = measureAddPrivilegeTime(ADD_PRIV_COUNT, pdf);
-
- displayResult("adding privileges to " + std::to_string(FEW_LOOPS) + " apps: ",
- addPrivTimeLargeDb / ADD_PRIV_COUNT, addPrivTimeSmallDb, ADD_PRIV_COUNT);
+ addPrivTimeLargeDb = measureAddPrivilegeTime(ADD_PRIV_COUNT, pdf) / ADD_PRIV_COUNT;
+ displayResult(addPrivTimeLargeDb, MANY_LOOPS, EXISTING_PRIV_COUNT, ADD_PRIV_COUNT);
}
+ displayRatio(addPrivTimeLargeDb, addPrivTimeSmallDb);
}
-BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_large)
+BOOST_AUTO_TEST_CASE(TXX_db_perf_remove_app_large_db)
{
//measures average remove time of 10% apps when there is 3000 apps installed.
duration <double> rmAppTimeSmallDb, rmAppTimeLargeDb;
- const int REMOVE_APP_COUNT = MANY_LOOPS * 0.1;
+ const int RM_APP_COUNT = MANY_LOOPS * 0.1;
{
PrivilegeDBFixture pdf;
measureAddAppTime(FEW_LOOPS, pdf);
measureAddPrivilegeTime(FEW_LOOPS, pdf);
rmAppTimeSmallDb = measureRemoveTime(FEW_LOOPS, pdf) / FEW_LOOPS;
+ displayResult(rmAppTimeSmallDb, FEW_LOOPS, FEW_LOOPS, FEW_LOOPS);
}
{
PrivilegeDBFixture pdf;
measureAddAppTime(MANY_LOOPS, pdf);
measureAddPrivilegeTime(MANY_LOOPS, pdf);
- rmAppTimeLargeDb = measureRemoveTime(REMOVE_APP_COUNT, pdf);
-
- displayResult("removing " + std::to_string(FEW_LOOPS) + " apps: ",
- rmAppTimeLargeDb / REMOVE_APP_COUNT, rmAppTimeSmallDb, REMOVE_APP_COUNT);
+ rmAppTimeLargeDb = measureRemoveTime(RM_APP_COUNT, pdf) / RM_APP_COUNT;
+ displayResult(rmAppTimeLargeDb, RM_APP_COUNT, MANY_LOOPS, MANY_LOOPS);
}
+ displayRatio(rmAppTimeLargeDb, rmAppTimeSmallDb);
}
BOOST_AUTO_TEST_SUITE_END()