| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 DLOG(INFO) << "Read from db in " << time_ms << " ms."; | 461 DLOG(INFO) << "Read from db in " << time_ms << " ms."; |
| 462 | 462 |
| 463 db_ms += time_ms; | 463 db_ms += time_ms; |
| 464 keys_from_db++; | 464 keys_from_db++; |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 | 467 |
| 468 int64 total_ms = total_timer.Elapsed().InMilliseconds(); | 468 int64 total_ms = total_timer.Elapsed().InMilliseconds(); |
| 469 | 469 |
| 470 DLOG(INFO) << path_.BaseName().value() << " read " << keys_to_read << | 470 DLOG(INFO) << path_.BaseName() << " read " << keys_to_read << |
| 471 " entries in " << total_ms << " ms. " << keys_from_db << | 471 " entries in " << total_ms << " ms. " << keys_from_db << |
| 472 " keys were read from the db, with average read taking " << | 472 " keys were read from the db, with average read taking " << |
| 473 db_ms / keys_from_db << " ms"; | 473 db_ms / keys_from_db << " ms"; |
| 474 } | 474 } |
| 475 | 475 |
| 476 void BuildBloomFilter() { | 476 void BuildBloomFilter() { |
| 477 file_util::EvictFileFromSystemCache(path_); | 477 file_util::EvictFileFromSystemCache(path_); |
| 478 file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename( | 478 file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename( |
| 479 path_.ToWStringHack()), false); | 479 path_.ToWStringHack()), false); |
| 480 | 480 |
| 481 PerfTimer total_timer; | 481 PerfTimer total_timer; |
| 482 | 482 |
| 483 scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); | 483 scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); |
| 484 database->SetSynchronous(); | 484 database->SetSynchronous(); |
| 485 EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); | 485 EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); |
| 486 | 486 |
| 487 int64 total_ms = total_timer.Elapsed().InMilliseconds(); | 487 int64 total_ms = total_timer.Elapsed().InMilliseconds(); |
| 488 | 488 |
| 489 DLOG(INFO) << path_.BaseName().value() << | 489 DLOG(INFO) << path_.BaseName() << |
| 490 " built bloom filter in " << total_ms << " ms."; | 490 " built bloom filter in " << total_ms << " ms."; |
| 491 } | 491 } |
| 492 | 492 |
| 493 private: | 493 private: |
| 494 FilePath path_; | 494 FilePath path_; |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 // Adds 100K host records. | 497 // Adds 100K host records. |
| 498 TEST(SafeBrowsingDatabase, DISABLED_FillUp100K) { | 498 TEST(SafeBrowsingDatabase, DISABLED_FillUp100K) { |
| 499 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing100K"))); | 499 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing100K"))); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // Test how long bloom filter creation takes. | 537 // Test how long bloom filter creation takes. |
| 538 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter250K) { | 538 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter250K) { |
| 539 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); | 539 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); |
| 540 db.BuildBloomFilter(); | 540 db.BuildBloomFilter(); |
| 541 } | 541 } |
| 542 | 542 |
| 543 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter500K) { | 543 TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter500K) { |
| 544 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); | 544 SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); |
| 545 db.BuildBloomFilter(); | 545 db.BuildBloomFilter(); |
| 546 } | 546 } |
| OLD | NEW |