diff options
| author | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-30 09:26:37 +0100 |
|---|---|---|
| committer | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-30 12:00:31 +0100 |
| commit | 1965e836ab971e52d1734ec554042c385f75108f (patch) | |
| tree | f7922d18181c0381a1ed2856e7ea2d1ae6a5e00c /src | |
| parent | c0bd3bac9ec8ed7d6dd64c8039bf33758add92cf (diff) | |
| download | rabbitmq-server-git-1965e836ab971e52d1734ec554042c385f75108f.tar.gz | |
Include metrics for the time it takes to obtain a file handle
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_handle_cache.erl | 8 | ||||
| -rw-r--r-- | src/file_handle_cache_stats.erl | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 2b69f39b04..e4af1e8c1a 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -315,7 +315,7 @@ open_with_absolute_path(Path, Mode, Options) -> case IsWriter andalso HasWriter of true -> {error, writer_exists}; false -> {ok, Ref} = new_closed_handle(Path, Mode1, Options), - case get_or_reopen([{Ref, new}]) of + case get_or_reopen_timed([{Ref, new}]) of {ok, [_Handle1]} -> RCount1 = case is_reader(Mode1) of true -> RCount + 1; @@ -674,7 +674,7 @@ with_handles(Refs, Fun) -> with_handles(Refs, reset, Fun). with_handles(Refs, ReadBuffer, Fun) -> - case get_or_reopen([{Ref, reopen} || Ref <- Refs]) of + case get_or_reopen_timed([{Ref, reopen} || Ref <- Refs]) of {ok, Handles0} -> Handles = case ReadBuffer of reset -> [reset_read_buffer(H) || H <- Handles0]; @@ -712,6 +712,10 @@ with_flushed_handles(Refs, ReadBuffer, Fun) -> end end). +get_or_reopen_timed(RefNewOrReopens) -> + file_handle_cache_stats:update( + io_file_handle_open_attempt, fun() -> get_or_reopen(RefNewOrReopens) end). + get_or_reopen(RefNewOrReopens) -> case partition_handles(RefNewOrReopens) of {OpenHdls, []} -> diff --git a/src/file_handle_cache_stats.erl b/src/file_handle_cache_stats.erl index ccf1e49662..12a78f805e 100644 --- a/src/file_handle_cache_stats.erl +++ b/src/file_handle_cache_stats.erl @@ -26,7 +26,7 @@ [io_reopen, mnesia_ram_tx, mnesia_disk_tx, msg_store_read, msg_store_write, queue_index_journal_write, queue_index_write, queue_index_read]). --define(COUNT_TIME, [io_sync, io_seek]). +-define(COUNT_TIME, [io_sync, io_seek, io_file_handle_open_attempt]). -define(COUNT_TIME_BYTES, [io_read, io_write]). init() -> |
