incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: svn commit: r832477 - /couchdb/trunk/src/couchdb/couch_stats_aggregator.erl
Date Tue, 03 Nov 2009 17:24:07 GMT
Hmm, I skimmed the timer and erl man pages and did a quick google -- I  
didn't find anything that seemed relevant.  Do you remember the  
option, by chance?

Adam

On Nov 3, 2009, at 12:20 PM, Damien Katz wrote:

> 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}.
>>
>>
>


Mime
View raw message