Forráskód Böngészése

Store doExtraTests variable in statistics database

Stefan Schmidt 6 éve
szülő
commit
cedcc6f582

+ 1 - 1
code_boost/src/cxx/statistics.cpp

@@ -752,7 +752,7 @@ void statistics::writeToDatabase(std::string database_path) {
                                getFormattedTimestamp(timestamp_firstPacket.seconds(), timestamp_firstPacket.microseconds()),
                                getFormattedTimestamp(timestamp_lastPacket.seconds(), timestamp_lastPacket.microseconds()),
                                avgPacketRate, avgPacketSize, avgPacketsSentPerHost, avgBandwidthInKBits,
-                               avgBandwidthOutInKBits);
+                               avgBandwidthOutInKBits, doExtraTests);
         db.writeStatisticsIP(ip_statistics);
         db.writeStatisticsTTL(ttl_distribution);
         db.writeStatisticsIpMac(ip_mac_mapping);

+ 6 - 3
code_boost/src/cxx/statistics_db.cpp

@@ -334,7 +334,8 @@ void statistics_db::writeStatisticsIpMac(const std::unordered_map<std::string, s
  */
 void statistics_db::writeStatisticsFile(int packetCount, float captureDuration, std::string timestampFirstPkt,
                                         std::string timestampLastPkt, float avgPacketRate, float avgPacketSize,
-                                        float avgPacketsSentPerHost, float avgBandwidthIn, float avgBandwidthOut) {
+                                        float avgPacketsSentPerHost, float avgBandwidthIn, float avgBandwidthOut,
+                                        bool doExtraTests) {
     try {
         db->exec("DROP TABLE IF EXISTS file_statistics");
         SQLite::Transaction transaction(*db);
@@ -347,9 +348,10 @@ void statistics_db::writeStatisticsFile(int packetCount, float captureDuration,
                 "avgPacketSize REAL,"
                 "avgPacketsSentPerHost REAL,"
                 "avgBandwidthIn REAL,"
-                "avgBandwidthOut REAL);";
+                "avgBandwidthOut REAL,"
+                "doExtraTests INTEGER);";
         db->exec(createTable);
-        SQLite::Statement query(*db, "INSERT INTO file_statistics VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
+        SQLite::Statement query(*db, "INSERT INTO file_statistics VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
         query.bind(1, packetCount);
         query.bind(2, captureDuration);
         query.bind(3, timestampFirstPkt);
@@ -359,6 +361,7 @@ void statistics_db::writeStatisticsFile(int packetCount, float captureDuration,
         query.bind(7, avgPacketsSentPerHost);
         query.bind(8, avgBandwidthIn);
         query.bind(9, avgBandwidthOut);
+        query.bind(10, doExtraTests);
         query.exec();
         transaction.commit();
     }

+ 3 - 2
code_boost/src/cxx/statistics_db.h

@@ -22,7 +22,7 @@ public:
     /*
      * Database version: Increment number on every change in the C++ code!
      */
-    static const int DB_VERSION = 5;
+    static const int DB_VERSION = 6;
 
     /*
      * Methods for writing values into database
@@ -47,7 +47,8 @@ public:
 
     void writeStatisticsFile(int packetCount, float captureDuration, std::string timestampFirstPkt,
                              std::string timestampLastPkt, float avgPacketRate, float avgPacketSize,
-                             float avgPacketsSentPerHost, float avgBandwidthIn, float avgBandwidthOut);
+                             float avgPacketsSentPerHost, float avgBandwidthIn, float avgBandwidthOut,
+                             bool doExtraTests);
 
     void writeStatisticsConv(std::unordered_map<conv, entry_convStat> &convStatistics);