Bug 716146 - Telemetry - close disk cache output stream

This commit is contained in:
Michal Novotny 2012-01-07 02:45:46 +01:00
Родитель afcb8f3ff9
Коммит 9ae8731187
2 изменённых файлов: 29 добавлений и 0 удалений

25
netwerk/cache/nsDiskCacheStreams.cpp поставляемый
Просмотреть файл

@ -45,6 +45,9 @@
#include "nsCacheService.h"
#include "mozilla/FileUtils.h"
#include "nsIDiskCacheStreamInternal.h"
#include "nsThreadUtils.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
@ -231,22 +234,44 @@ nsDiskCacheOutputStream::~nsDiskCacheOutputStream()
NS_IMETHODIMP
nsDiskCacheOutputStream::Close()
{
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
if (!mClosed) {
mClosed = true;
// tell parent streamIO we are closing
mStreamIO->CloseOutputStream(this);
}
mozilla::Telemetry::ID id;
if (NS_IsMainThread())
id = mozilla::Telemetry::NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_MAIN_THREAD;
else
id = mozilla::Telemetry::NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE;
mozilla::Telemetry::AccumulateTimeDelta(id, start);
return NS_OK;
}
NS_IMETHODIMP
nsDiskCacheOutputStream::CloseInternal()
{
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
if (!mClosed) {
mClosed = true;
// tell parent streamIO we are closing
mStreamIO->CloseOutputStreamInternal(this);
}
mozilla::Telemetry::ID id;
if (NS_IsMainThread())
id = mozilla::Telemetry::NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_INTERNAL_MAIN_THREAD;
else
id = mozilla::Telemetry::NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_INTERNAL;
mozilla::Telemetry::AccumulateTimeDelta(id, start);
return NS_OK;
}

Просмотреть файл

@ -253,6 +253,10 @@ HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent d
HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR_SHUTDOWN, 1, 10000, 10, EXPONENTIAL, "Time spent during showdown stopping thread deleting old disk cache (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_SHUTDOWN, 1, 10000, 10, EXPONENTIAL, "Total Time spent (ms) during disk cache showdown")
HISTOGRAM(NETWORK_DISK_CACHE_SHUTDOWN_CLEAR_PRIVATE, 1, 10000, 10, EXPONENTIAL, "Time spent (ms) during showdown deleting disk cache for 'clear private data' option")
HISTOGRAM(NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE, 1, 10000, 10, EXPONENTIAL, "Time spent in nsDiskCacheOutputStream::Close() on non-main thread (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_MAIN_THREAD, 1, 10000, 10, EXPONENTIAL, "Time spent in nsDiskCacheOutputStream::Close() on the main thread (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_INTERNAL, 1, 10000, 10, EXPONENTIAL, "Time spent in nsDiskCacheOutputStream::CloseInternal() on non-main thread (ms)")
HISTOGRAM(NETWORK_DISK_CACHE_OUTPUT_STREAM_CLOSE_INTERNAL_MAIN_THREAD, 1, 10000, 10, EXPONENTIAL, "Time spent in nsDiskCacheOutputStream::CloseInternal on the main thread (ms)")
/**
* Url-Classifier telemetry