import-trace: major speedup

Using Database::insert_multiple() instead of prepared statements
speeds up trace import by a factor of 3-4.  While being there, we now
properly deal with nonexistent extended trace values (i.e., put NULLs
into the DB).

Side note: The ElfImporter should switch to insert_multiple(), too.

Change-Id: I96785e9775e3ef4f242fd50720d5c34adb4e88a1
This commit is contained in:
Horst Schirmeier
2014-02-17 11:28:33 +01:00
parent 76bda55c5e
commit 1df43e9726
5 changed files with 66 additions and 100 deletions

View File

@ -3,6 +3,7 @@
#include <mysql/mysql.h>
#include <map>
#include <sstream>
#include "util/ProtoStream.hpp"
#include "util/ElfReader.hpp"
#include "sal/SALConfig.hpp"
@ -85,7 +86,7 @@ protected:
* Will be called back from add_trace_event() to fill in data for the
* columns specified by database_insert_columns().
*/
virtual bool database_insert_data(Trace_Event &ev, MYSQL_BIND *bind, unsigned num_columns, bool is_fake) { return true; }
virtual bool database_insert_data(Trace_Event &ev, std::stringstream& value_sql, unsigned num_columns, bool is_fake) { return true; }
/**
* Use this variant if passing through the IP/MEM event does not make any
* sense for your Importer implementation.