From f596f1356cc523ace9ae6d2f91f08f982bae455b Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sun, 28 Nov 2010 16:21:36 -0800 Subject: [PATCH] More work on request profiling. --- bluesky/cloudlog.c | 8 ++++---- bluesky/file.c | 34 +++++++++------------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index b6ee07f..fb83e02 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -340,6 +340,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 +357,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); diff --git a/bluesky/file.c b/bluesky/file.c index a4a8108..5c4b157 100644 --- a/bluesky/file.c +++ b/bluesky/file.c @@ -166,32 +166,10 @@ void bluesky_file_read(BlueSkyInode *inode, uint64_t offset, g_return_if_fail(offset < inode->size); g_return_if_fail(len <= inode->size - offset); -#if 0 - /* Start fetches on any data blocks that we will need for this read. */ - BlueSkyStoreAsync *barrier = bluesky_store_async_new(inode->fs->store); - barrier->op = STORE_OP_BARRIER; - uint64_t start_block, end_block; - start_block = offset / BLUESKY_BLOCK_SIZE; - end_block = (offset + len - 1) / BLUESKY_BLOCK_SIZE; - if (bluesky_verbose) { - g_log("bluesky/file", G_LOG_LEVEL_DEBUG, - "Start prefetch on blocks %"PRIi64" .. %"PRIi64, - start_block, end_block); - } - for (uint64_t i = start_block; i <= end_block; i++) { - BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, - i); - if (b->type == BLUESKY_BLOCK_REF) - bluesky_block_fetch(inode, b, barrier); - } - bluesky_store_async_submit(barrier); - bluesky_store_async_wait(barrier); - bluesky_store_async_unref(barrier); - if (bluesky_verbose) { - g_log("bluesky/file", G_LOG_LEVEL_DEBUG, "Prefetch complete."); - } -#endif + BlueSkyProfile *profile = bluesky_profile_get(); + bluesky_profile_add_event(profile, + g_strdup_printf("Start file read prefetch")); uint64_t start_block, end_block; start_block = offset / BLUESKY_BLOCK_SIZE; end_block = (offset + len - 1) / BLUESKY_BLOCK_SIZE; @@ -202,6 +180,9 @@ void bluesky_file_read(BlueSkyInode *inode, uint64_t offset, bluesky_cloudlog_prefetch(b->ref); } + bluesky_profile_add_event(profile, + g_strdup_printf("End file read prefetch")); + while (len > 0) { uint64_t block_num = offset / BLUESKY_BLOCK_SIZE; gint block_offset = offset % BLUESKY_BLOCK_SIZE; @@ -226,6 +207,9 @@ void bluesky_file_read(BlueSkyInode *inode, uint64_t offset, buf += bytes; len -= bytes; } + + bluesky_profile_add_event(profile, + g_strdup_printf("BlueSky read complete")); } void bluesky_block_fetch(BlueSkyInode *inode, BlueSkyBlock *block, -- 2.20.1