From dev-return-7152-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Tue Nov 03 17:20:34 2009 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 30983 invoked from network); 3 Nov 2009 17:20:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Nov 2009 17:20:33 -0000 Received: (qmail 9342 invoked by uid 500); 3 Nov 2009 17:20:33 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 9161 invoked by uid 500); 3 Nov 2009 17:20:32 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 9106 invoked by uid 99); 3 Nov 2009 17:20:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Nov 2009 17:20:32 +0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.68.5.15] (HELO relay01.pair.com) (209.68.5.15) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 03 Nov 2009 17:20:23 +0000 Received: (qmail 89868 invoked from network); 3 Nov 2009 17:20:00 -0000 Received: from 75.143.234.216 (HELO ?192.168.1.6?) (75.143.234.216) by relay01.pair.com with SMTP; 3 Nov 2009 17:20:00 -0000 X-pair-Authenticated: 75.143.234.216 Cc: commits@couchdb.apache.org Message-Id: From: Damien Katz To: dev@couchdb.apache.org In-Reply-To: <20091103171538.6674B2388962@eris.apache.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: svn commit: r832477 - /couchdb/trunk/src/couchdb/couch_stats_aggregator.erl Date: Tue, 3 Nov 2009 12:20:00 -0500 References: <20091103171538.6674B2388962@eris.apache.org> X-Mailer: Apple Mail (2.936) X-Virus-Checked: Checked by ClamAV on apache.org I thought this was fixable with command line options? -Damien On Nov 3, 2009, at 12:15 PM, kocolosk@apache.org wrote: > Author: kocolosk > Date: Tue Nov 3 17:15:37 2009 > New Revision: 832477 > > URL: http://svn.apache.org/viewvc?rev=832477&view=rev > Log: > eliminate new process flood after OS wakes from sleep. COUCHDB-539 > > Modified: > couchdb/trunk/src/couchdb/couch_stats_aggregator.erl > > Modified: couchdb/trunk/src/couchdb/couch_stats_aggregator.erl > URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_stats_aggregator.erl?rev=832477&r1=832476&r2=832477&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- couchdb/trunk/src/couchdb/couch_stats_aggregator.erl (original) > +++ couchdb/trunk/src/couchdb/couch_stats_aggregator.erl Tue Nov 3 > 17:15:37 2009 > @@ -86,7 +86,7 @@ > to_json_term(?MODULE:get(Key, Time)). > > collect_sample() -> > - gen_server:call(?MODULE, collect_sample). > + gen_server:call(?MODULE, collect_sample, infinity). > > > init(StatDescsFileName) -> > @@ -115,13 +115,15 @@ > > Rate = list_to_integer(couch_config:get("stats", "rate", "1000")), > % TODO: Add timer_start to kernel start options. > - timer:apply_interval(Rate, ?MODULE, collect_sample, []). > + {ok, TRef} = timer:apply_after(Rate, ?MODULE, collect_sample, > []), > + {ok, {TRef, Rate}}. > > -terminate(_Reason, TRef) -> > +terminate(_Reason, {TRef, _Rate}) -> > timer:cancel(TRef), > ok. > > -handle_call(collect_sample, _, State) -> > +handle_call(collect_sample, _, {_TRef, SampleInterval}) -> > + {ok, TRef} = timer:apply_after(SampleInterval, ?MODULE, > collect_sample, []), > % Gather new stats values to add. > Incs = lists:map(fun({Key, Value}) -> > {Key, {incremental, Value}} > @@ -151,7 +153,7 @@ > end, > ets:insert(?MODULE, {{Key, Rate}, NewAgg}) > end, ets:tab2list(?MODULE)), > - {reply, ok, State}. > + {reply, ok, {TRef, SampleInterval}}. > > handle_cast(stop, State) -> > {stop, normal, State}. > >