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

Side by Side Diff: net/tools/epoll_server/epoll_server.h

Issue 82913011: LOG(INFO) tidying in net/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert dns_fuzz_stub changes Created 7 years 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 | « net/tools/dump_cache/simple_cache_dumper.cc ('k') | net/tools/epoll_server/epoll_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ 5 #ifndef NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_
6 #define NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ 6 #define NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_
7 7
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/queue.h> 9 #include <sys/queue.h>
10 #include <map> 10 #include <map>
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 struct EventRecorder { 713 struct EventRecorder {
714 public: 714 public:
715 EventRecorder() : num_records_(0), record_threshold_(10000) {} 715 EventRecorder() : num_records_(0), record_threshold_(10000) {}
716 716
717 ~EventRecorder() { 717 ~EventRecorder() {
718 Clear(); 718 Clear();
719 } 719 }
720 720
721 // When a number of events equals the record threshold, 721 // When a number of events equals the record threshold,
722 // the collected data summary for all FDs will be written 722 // the collected data summary for all FDs will be written
723 // to LOG(INFO). Note that this does not include the 723 // to VLOG(0). Note that this does not include the
724 // individual events (if you'reinterested in those, you'll 724 // individual events (if you'reinterested in those, you'll
725 // have to get at them programmatically). 725 // have to get at them programmatically).
726 // After any such flushing to LOG(INFO) all events will 726 // After any such flushing to VLOG(0) all events will
727 // be cleared. 727 // be cleared.
728 // Note that the definition of an 'event' is a bit 'hazy', 728 // Note that the definition of an 'event' is a bit 'hazy',
729 // as it includes the 'Unregistration' event, and perhaps 729 // as it includes the 'Unregistration' event, and perhaps
730 // others. 730 // others.
731 void set_record_threshold(int64 new_threshold) { 731 void set_record_threshold(int64 new_threshold) {
732 record_threshold_ = new_threshold; 732 record_threshold_ = new_threshold;
733 } 733 }
734 734
735 void Clear() { 735 void Clear() {
736 for (int i = 0; i < debug_events_.size(); ++i) { 736 for (int i = 0; i < debug_events_.size(); ++i) {
737 delete debug_events_[i]; 737 delete debug_events_[i];
738 } 738 }
739 debug_events_.clear(); 739 debug_events_.clear();
740 unregistered_fds_.clear(); 740 unregistered_fds_.clear();
741 event_counts_.clear(); 741 event_counts_.clear();
742 } 742 }
743 743
744 void MaybeRecordAndClear() { 744 void MaybeRecordAndClear() {
745 ++num_records_; 745 ++num_records_;
746 if ((num_records_ > record_threshold_) && 746 if ((num_records_ > record_threshold_) &&
747 (record_threshold_ > 0)) { 747 (record_threshold_ > 0)) {
748 LOG(INFO) << "\n" << *this; 748 VLOG(0) << "\n" << *this;
749 num_records_ = 0; 749 num_records_ = 0;
750 Clear(); 750 Clear();
751 } 751 }
752 } 752 }
753 753
754 void RecordFDMaskEvent(int fd, int mask, const char* function) { 754 void RecordFDMaskEvent(int fd, int mask, const char* function) {
755 FDMaskOutput* fdmo = new FDMaskOutput(fd, mask, function); 755 FDMaskOutput* fdmo = new FDMaskOutput(fd, mask, function);
756 debug_events_.push_back(fdmo); 756 debug_events_.push_back(fdmo);
757 MaybeRecordAndClear(); 757 MaybeRecordAndClear();
758 } 758 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1044
1045 private: 1045 private:
1046 EpollServer::AlarmRegToken token_; 1046 EpollServer::AlarmRegToken token_;
1047 EpollServer* eps_; 1047 EpollServer* eps_;
1048 bool registered_; 1048 bool registered_;
1049 }; 1049 };
1050 1050
1051 } // namespace net 1051 } // namespace net
1052 1052
1053 #endif // NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_ 1053 #endif // NET_TOOLS_EPOLL_SERVER_EPOLL_SERVER_H_
OLDNEW
« no previous file with comments | « net/tools/dump_cache/simple_cache_dumper.cc ('k') | net/tools/epoll_server/epoll_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698