Allow profile results to be written to a file.
[bluesky.git] / bluesky / cloudlog.c
index b6ee07f..4c94c49 100644 (file)
@@ -316,7 +316,8 @@ void bluesky_cloudlog_prefetch(BlueSkyCloudLog *item)
             map->prefetches = bluesky_rangeset_new();
 
         gchar *id = bluesky_cloudlog_id_to_string(item->id);
-        g_print("Need to prefetch %s\n", id);
+        if (bluesky_verbose)
+            g_print("Need to prefetch %s\n", id);
         g_free(id);
 
         bluesky_rangeset_insert(map->prefetches,
@@ -325,7 +326,9 @@ void bluesky_cloudlog_prefetch(BlueSkyCloudLog *item)
 
         uint64_t start, length;
         bluesky_rangeset_get_extents(map->prefetches, &start, &length);
-        g_print("Range to prefetch: %"PRIu64" + %"PRIu64"\n", start, length);
+        if (bluesky_verbose)
+            g_print("Range to prefetch: %"PRIu64" + %"PRIu64"\n",
+                    start, length);
     }
 
     bluesky_cachefile_unref(map);
@@ -340,6 +343,10 @@ void bluesky_cloudlog_fetch(BlueSkyCloudLog *log)
     if (log->data != NULL)
         return;
 
+    BlueSkyProfile *profile = bluesky_profile_get();
+    if (profile != NULL)
+        bluesky_profile_add_event(profile, g_strdup_printf("Fetch log entry"));
+
     /* There are actually two cases: a full deserialization if we have not ever
      * read the object before, and a partial deserialization where the metadata
      * is already in memory and we just need to remap the data.  If the object
@@ -353,10 +360,6 @@ void bluesky_cloudlog_fetch(BlueSkyCloudLog *log)
         bluesky_string_unref(raw);
     }
 
-    BlueSkyProfile *profile = bluesky_profile_get();
-    if (profile != NULL)
-        bluesky_profile_add_event(profile, g_strdup_printf("Fetch log entry"));
-
     /* At this point all metadata should be available and we need only remap
      * the object data. */
     log->data = bluesky_log_map_object(log, TRUE);
@@ -573,7 +576,8 @@ void bluesky_cloudlog_decrypt(char *segment, size_t len,
             break;
         if (bluesky_crypt_block_decrypt(data, item_size, keys)) {
             if (items != NULL) {
-                g_print("  data item at %zx\n", offset);
+                if (bluesky_verbose)
+                    g_print("  data item at %zx\n", offset);
                 bluesky_rangeset_insert(items, offset, item_size,
                                         GINT_TO_POINTER(TRUE));
             }