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

Side by Side Diff: third_party/leveldatabase/env_chromium.cc

Issue 13838003: Histogram failure reasons for 3 more LevelDB env methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move line around Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 1 // Copyright (c) 2011 The LevelDB 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. See the AUTHORS file for names of contributors. 3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 result = Status::IOError(filename_, strerror(errno)); 333 result = Status::IOError(filename_, strerror(errno));
334 uma_logger_->RecordErrorAt(kWritableFileClose); 334 uma_logger_->RecordErrorAt(kWritableFileClose);
335 } 335 }
336 file_ = NULL; 336 file_ = NULL;
337 return result; 337 return result;
338 } 338 }
339 339
340 virtual Status Flush() { 340 virtual Status Flush() {
341 Status result; 341 Status result;
342 if (HANDLE_EINTR(fflush_unlocked(file_))) { 342 if (HANDLE_EINTR(fflush_unlocked(file_))) {
343 result = Status::IOError(filename_, strerror(errno)); 343 int saved_errno = errno;
344 uma_logger_->RecordErrorAt(kWritableFileFlush); 344 result = Status::IOError(filename_, strerror(saved_errno));
345 uma_logger_->RecordSpecificError(kWritableFileFlush, saved_errno);
345 } 346 }
346 return result; 347 return result;
347 } 348 }
348 349
349 virtual Status Sync() { 350 virtual Status Sync() {
350 Status result; 351 Status result;
351 int error = 0; 352 int error = 0;
352 353
353 if (HANDLE_EINTR(fflush_unlocked(file_))) 354 if (HANDLE_EINTR(fflush_unlocked(file_)))
354 error = errno; 355 error = errno;
(...skipping 20 matching lines...) Expand all
375 ChromiumEnv(); 376 ChromiumEnv();
376 virtual ~ChromiumEnv() { 377 virtual ~ChromiumEnv() {
377 NOTREACHED(); 378 NOTREACHED();
378 } 379 }
379 380
380 virtual Status NewSequentialFile(const std::string& fname, 381 virtual Status NewSequentialFile(const std::string& fname,
381 SequentialFile** result) { 382 SequentialFile** result) {
382 FILE* f = fopen_internal(fname.c_str(), "rb"); 383 FILE* f = fopen_internal(fname.c_str(), "rb");
383 if (f == NULL) { 384 if (f == NULL) {
384 *result = NULL; 385 *result = NULL;
385 RecordErrorAt(kNewSequentialFile); 386 int saved_errno = errno;
386 return Status::IOError(fname, strerror(errno)); 387 RecordSpecificError(kNewSequentialFile, saved_errno);
388 return Status::IOError(fname, strerror(saved_errno));
387 } else { 389 } else {
388 *result = new ChromiumSequentialFile(fname, f, this); 390 *result = new ChromiumSequentialFile(fname, f, this);
389 return Status::OK(); 391 return Status::OK();
390 } 392 }
391 } 393 }
392 394
393 virtual Status NewRandomAccessFile(const std::string& fname, 395 virtual Status NewRandomAccessFile(const std::string& fname,
394 RandomAccessFile** result) { 396 RandomAccessFile** result) {
395 int flags = ::base::PLATFORM_FILE_READ | ::base::PLATFORM_FILE_OPEN; 397 int flags = ::base::PLATFORM_FILE_READ | ::base::PLATFORM_FILE_OPEN;
396 bool created; 398 bool created;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 609 }
608 *path = FilePathToString(test_directory_); 610 *path = FilePathToString(test_directory_);
609 mu_.Release(); 611 mu_.Release();
610 return Status::OK(); 612 return Status::OK();
611 } 613 }
612 614
613 virtual Status NewLogger(const std::string& fname, Logger** result) { 615 virtual Status NewLogger(const std::string& fname, Logger** result) {
614 FILE* f = fopen_internal(fname.c_str(), "w"); 616 FILE* f = fopen_internal(fname.c_str(), "w");
615 if (f == NULL) { 617 if (f == NULL) {
616 *result = NULL; 618 *result = NULL;
617 RecordErrorAt(kNewLogger); 619 int saved_errno = errno;
618 return Status::IOError(fname, strerror(errno)); 620 RecordSpecificError(kNewLogger, saved_errno);
621 return Status::IOError(fname, strerror(saved_errno));
619 } else { 622 } else {
620 if (!sync_parent(fname)) { 623 if (!sync_parent(fname)) {
621 fclose(f); 624 fclose(f);
622 return Status::IOError(fname, strerror(errno)); 625 return Status::IOError(fname, strerror(errno));
623 } 626 }
624 *result = new ChromiumLogger(f); 627 *result = new ChromiumLogger(f);
625 return Status::OK(); 628 return Status::OK();
626 } 629 }
627 } 630 }
628 631
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 726 }
724 727
725 void ChromiumEnv::InitHistograms(const std::string& uma_title) { 728 void ChromiumEnv::InitHistograms(const std::string& uma_title) {
726 std::string uma_name(uma_title); 729 std::string uma_name(uma_title);
727 uma_name.append(".IOError"); 730 uma_name.append(".IOError");
728 io_error_histogram_ = base::LinearHistogram::FactoryGet(uma_name, 1, 731 io_error_histogram_ = base::LinearHistogram::FactoryGet(uma_name, 1,
729 kNumEntries, kNumEntries + 1, base::Histogram::kUmaTargetedHistogramFlag); 732 kNumEntries, kNumEntries + 1, base::Histogram::kUmaTargetedHistogramFlag);
730 733
731 uma_name.append("."); 734 uma_name.append(".");
732 MakeErrnoHistogram(uma_name, kWritableFileAppend); 735 MakeErrnoHistogram(uma_name, kWritableFileAppend);
736 MakeErrnoHistogram(uma_name, kNewSequentialFile);
737 MakeErrnoHistogram(uma_name, kWritableFileFlush);
738 MakeErrnoHistogram(uma_name, kNewLogger);
733 MakePlatformFileErrorHistogram(uma_name, kNewRandomAccessFile); 739 MakePlatformFileErrorHistogram(uma_name, kNewRandomAccessFile);
734 MakePlatformFileErrorHistogram(uma_name, kLockFile); 740 MakePlatformFileErrorHistogram(uma_name, kLockFile);
735 741
736 const int kBucketSizeMillis = 25; 742 const int kBucketSizeMillis = 25;
737 // Add 2, 1 for each of the buckets <1 and >max. 743 // Add 2, 1 for each of the buckets <1 and >max.
738 const int kNumBuckets = kMaxRenameTimeMillis / kBucketSizeMillis + 2; 744 const int kNumBuckets = kMaxRenameTimeMillis / kBucketSizeMillis + 2;
739 745
740 std::string retry_name(uma_title); 746 std::string retry_name(uma_title);
741 retry_name.append(".TimeToRename"); 747 retry_name.append(".TimeToRename");
742 rename_time_histogram_ = base::LinearHistogram::FactoryTimeGet( 748 rename_time_histogram_ = base::LinearHistogram::FactoryTimeGet(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 840
835 Env* IDBEnv() { 841 Env* IDBEnv() {
836 return idb_env.Pointer(); 842 return idb_env.Pointer();
837 } 843 }
838 844
839 Env* Env::Default() { 845 Env* Env::Default() {
840 return default_env.Pointer(); 846 return default_env.Pointer();
841 } 847 }
842 848
843 } 849 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698