Added code for recording measurements 11/213411/4 accepted/tizen/unified/20190909.010908 submit/tizen/20190905.232826
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 5 Sep 2019 05:16:54 +0000 (14:16 +0900)
committerMinje ahn <minje.ahn@samsung.com>
Thu, 5 Sep 2019 08:02:46 +0000 (08:02 +0000)
Change-Id: I130492b153683c2700adaf1a79611f6740b99400
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/mediadb-update.c

index 5ae346b..ef10140 100755 (executable)
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <dlfcn.h>
 #include <glib.h>
+#include <sys/time.h>
 #include <tzplatform_config.h>
 
 #include "media-util.h"
 #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));
 }