[Pkg-owncloud-commits] [owncloud-client] 53/333: Update phase: Allow benchmarking / progress update
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:33 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit fcc0e89044c5e5b8584671b62a33a74167189879
Author: Markus Goetz <markus at woboq.com>
Date: Tue Feb 18 21:41:20 2014 +0100
Update phase: Allow benchmarking / progress update
---
csync/src/csync.c | 7 +++++++
csync/src/csync.h | 6 +++++-
src/mirall/csyncthread.cpp | 20 ++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/csync/src/csync.c b/csync/src/csync.c
index 935f96c..2a2a56c 100644
--- a/csync/src/csync.c
+++ b/csync/src/csync.c
@@ -57,6 +57,9 @@
#include "csync_log.h"
#include "csync_rename.h"
+// Breaking the abstraction for fun and profit.
+#include "csync_owncloud.h"
+
static int _key_cmp(const void *key, const void *data) {
uint64_t a;
csync_file_stat_t *b;
@@ -315,6 +318,7 @@ int csync_update(CSYNC *ctx) {
csync_memstat_check();
/* update detection for local replica */
+ oc_notify_progress(NULL, CSYNC_NOTIFY_START_LOCAL_UPDATE, 0, 0);
csync_gettime(&start);
ctx->current = LOCAL_REPLICA;
ctx->replica = ctx->local.type;
@@ -327,6 +331,7 @@ int csync_update(CSYNC *ctx) {
}
csync_gettime(&finish);
+ oc_notify_progress(NULL, CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE, 0, 0);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG,
"Update detection for local replica took %.2f seconds walking %zu files.",
@@ -340,6 +345,7 @@ int csync_update(CSYNC *ctx) {
/* update detection for remote replica */
if( ! ctx->options.local_only_mode ) {
+ oc_notify_progress(NULL, CSYNC_NOTIFY_START_REMOTE_UPDATE, 0, 0);
csync_gettime(&start);
ctx->current = REMOTE_REPLICA;
ctx->replica = ctx->remote.type;
@@ -353,6 +359,7 @@ int csync_update(CSYNC *ctx) {
csync_gettime(&finish);
+ oc_notify_progress(NULL, CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE, 0, 0);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG,
"Update detection for remote replica took %.2f seconds "
diff --git a/csync/src/csync.h b/csync/src/csync.h
index d540795..5b482f8 100644
--- a/csync/src/csync.h
+++ b/csync/src/csync.h
@@ -154,7 +154,11 @@ enum csync_notify_type_e {
CSYNC_NOTIFY_FINISHED_SYNC_SEQUENCE,
CSYNC_NOTIFY_START_DELETE,
CSYNC_NOTIFY_END_DELETE,
- CSYNC_NOTIFY_ERROR
+ CSYNC_NOTIFY_ERROR,
+ CSYNC_NOTIFY_START_LOCAL_UPDATE,
+ CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE,
+ CSYNC_NOTIFY_START_REMOTE_UPDATE,
+ CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE
};
struct csync_progress_s {
diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp
index 02eb746..c20d601 100644
--- a/src/mirall/csyncthread.cpp
+++ b/src/mirall/csyncthread.cpp
@@ -409,6 +409,23 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
thread()->quit();
}
+static void updater_progress_callback(CSYNC_PROGRESS *progress, void *userdata)
+{
+ static QElapsedTimer localTimer;
+ static QElapsedTimer remoteTimer;
+ if (progress->kind == CSYNC_NOTIFY_START_LOCAL_UPDATE) {
+ localTimer.start();
+ } else if (progress->kind == CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE) {
+ // There is also localTimer.nsecsElapsed()
+ qDebug() << "Local Update took" << localTimer.elapsed() << "msec";
+ } else if (progress->kind == CSYNC_NOTIFY_START_REMOTE_UPDATE) {
+ remoteTimer.start();
+ } else if (progress->kind == CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE) {
+ qDebug() << "Remote Update took" << remoteTimer.elapsed() << "msec";
+ }
+
+}
+
void CSyncThread::startSync()
{
if (!_syncMutex.tryLock()) {
@@ -493,6 +510,9 @@ void CSyncThread::startSync()
_syncTime.start();
+ // Only used for the updater progress as we use the new propagator right now which does its own thing
+ csync_set_progress_callback(_csync_ctx, updater_progress_callback);
+
QElapsedTimer updateTime;
updateTime.start();
qDebug() << "#### Update start #################################################### >>";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list