From acc7c5ea04fe15539b4f47d81ed8bf608c061713 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 5 Sep 2019 14:16:54 +0900 Subject: [PATCH] Added code for recording measurements Change-Id: I130492b153683c2700adaf1a79611f6740b99400 Signed-off-by: Minje Ahn --- src/mediadb-update.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mediadb-update.c b/src/mediadb-update.c index 5ae346b..ef10140 100755 --- a/src/mediadb-update.c +++ b/src/mediadb-update.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "media-util.h" @@ -31,14 +32,20 @@ #define PATH_PLUGIN_LIB PATH_LIBDIR"/libmedia-content-plugin.so" GMainLoop * mainloop = NULL; +struct timeval start_time, end_time; int (*svc_check_db) (sqlite3 * handle, uid_t uid); int (*svc_get_storage_id) (sqlite3 * handle, const char *path, char *storage_id, uid_t uid); void callback(media_request_result_s * result, void *user_data) { + long long ms_time = 0; + if (result->result != MEDIA_REQUEST_SCAN_PARTIAL) { - printf("db updating done\n"); + gettimeofday(&end_time, NULL); + ms_time = (end_time.tv_sec * 1000LL + end_time.tv_usec / 1000) - (start_time.tv_sec * 1000LL + start_time.tv_usec/ 1000); + + printf("db updating done. Time [%lld]\n", ms_time); g_main_loop_quit(mainloop); } } @@ -138,6 +145,7 @@ int dir_scan(const char *path, bool is_recursive) if (ret < 0) return -1; + gettimeofday(&start_time, NULL); return media_directory_scanning_async(path, storage_id, is_recursive, callback, NULL, tzplatform_getuid(TZ_USER_NAME)); } -- 2.7.4