marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sschaff...@apache.org
Subject marmotta git commit: some debug output
Date Sat, 12 Dec 2015 18:39:53 GMT
Repository: marmotta
Updated Branches:
  refs/heads/develop 134abbb8c -> 89b69179a


some debug output


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/89b69179
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/89b69179
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/89b69179

Branch: refs/heads/develop
Commit: 89b69179aa8bce178f1ff0fac890953e23bbcdac
Parents: 134abbb
Author: Sebastian Schaffert <sschaffert@apache.org>
Authored: Sat Dec 12 19:41:33 2015 +0100
Committer: Sebastian Schaffert <sschaffert@apache.org>
Committed: Sat Dec 12 19:41:33 2015 +0100

----------------------------------------------------------------------
 libraries/ostrich/backend/client/client.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/89b69179/libraries/ostrich/backend/client/client.cc
----------------------------------------------------------------------
diff --git a/libraries/ostrich/backend/client/client.cc b/libraries/ostrich/backend/client/client.cc
index 56f317c..f2ac286 100644
--- a/libraries/ostrich/backend/client/client.cc
+++ b/libraries/ostrich/backend/client/client.cc
@@ -116,6 +116,9 @@ class MarmottaClient {
                       grpc::CreateChannel(server, grpc::InsecureChannelCredentials()))){}
 
     void importDataset(std::istream& in, parser::Format format) {
+        auto start = std::chrono::steady_clock::now();
+        int64_t count = 0;
+
         ClientContext nscontext, stmtcontext;
 
         google::protobuf::Int64Value nsstats;
@@ -127,8 +130,14 @@ class MarmottaClient {
                 stub_->AddStatements(&stmtcontext, &stmtstats));
 
         parser::Parser p("http://www.example.com", format);
-        p.setStatementHandler([&stmtwriter](const rdf::Statement& stmt) {
+        p.setStatementHandler([&stmtwriter, &start, &count](const rdf::Statement&
stmt) {
             stmtwriter->Write(stmt.getMessage());
+            if (++count % 100000 == 0) {
+                double rate = 100000 * 1000 / std::chrono::duration <double, std::milli>
(
+                        std::chrono::steady_clock::now() - start).count();
+                std::cout << "Imported " << count << " statements (" <<
rate << " statements/sec)" << std::endl;
+                start = std::chrono::steady_clock::now();
+            }
         });
         p.setNamespaceHandler([&nswriter](const rdf::Namespace& ns) {
             nswriter->Write(ns.getMessage());


Mime
View raw message