Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: components/safe_browsing_db/v4_database.cc

Issue 2441923003: PVer4: Add UMA metrics for time taken to: load DB, do prefix check, (Closed)
Patch Set: git rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/v4_database.cc
diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc
index 4b43498c5abf4bd2139d42ca51ef8528738694ef..b0580304b8009e15ad2bc13c74270ee2e20d442d 100644
--- a/components/safe_browsing_db/v4_database.cc
+++ b/components/safe_browsing_db/v4_database.cc
@@ -8,11 +8,13 @@
#include "base/debug/leak_annotations.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/safe_browsing_db/v4_database.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
+using base::TimeTicks;
namespace safe_browsing {
@@ -31,9 +33,9 @@ void V4Database::Create(
const scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner =
base::ThreadTaskRunnerHandle::Get();
db_task_runner->PostTask(
- FROM_HERE,
- base::Bind(&V4Database::CreateOnTaskRunner, db_task_runner, base_path,
- list_infos, callback_task_runner, new_db_callback));
+ FROM_HERE, base::Bind(&V4Database::CreateOnTaskRunner, db_task_runner,
+ base_path, list_infos, callback_task_runner,
+ new_db_callback, TimeTicks::Now()));
}
// static
@@ -42,7 +44,8 @@ void V4Database::CreateOnTaskRunner(
const base::FilePath& base_path,
const ListInfos& list_infos,
const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner,
- NewDatabaseReadyCallback new_db_callback) {
+ NewDatabaseReadyCallback new_db_callback,
+ const TimeTicks before) {
DCHECK(db_task_runner->RunsTasksOnCurrentThread());
if (!factory_) {
@@ -72,6 +75,10 @@ void V4Database::CreateOnTaskRunner(
// thread. This would unblock resource loads.
callback_task_runner->PostTask(
FROM_HERE, base::Bind(new_db_callback, base::Passed(&v4_database)));
+
+ // TODO(vakh): Consider changing the following histogram name to be
+ // SafeBrowsing.V4DatabaseOpen.Time once PVer3 code is removed.
+ UMA_HISTOGRAM_TIMES("SB2.DatabaseOpen", TimeTicks::Now() - before);
Nathan Parker 2016/10/21 20:21:18 note: This time includes the time to post onto thi
vakh (use Gerrit instead) 2016/10/21 22:54:04 PVer3 has the same.
}
V4Database::V4Database(

Powered by Google App Engine
This is Rietveld 408576698