[erlang-questions] cover.erl issues

Siri Hansen erlangsiri@REDACTED
Thu Mar 28 12:26:44 CET 2013


2013/3/26 Manuel A. Rubio "Bombadil" <bombadil@REDACTED>

> Hi Sri,
>
> El 2013-03-26 16:53, Siri Hansen escribió:
>
>  This is a bug in cover. To confirm it you could call ets:delete(Table)
>> for each ets table just before
>>
>> unregister(?SERVER)
>>
>> in cover:main_process_loop/1.
>>
>
> I use covertool[1] for export tests to jenkins and did a fork and add it
> cover.erl[2] modified to overload the original code with the workaround:
>
> line 561:
> ------------------------------**------------------------------**
> ----------------
> init_main(Starter) ->
>     %% Having write concurrancy here gives a 40% performance boost
>     %% when collect/1 is called.
>     case ets:info(?COVER_TABLE) of
>         undefined ->
>             register(?SERVER,self()),
>             ets:new(?COVER_TABLE, [set, public, named_table
>                            ,{write_concurrency, true}
>                           ]),
>             ets:new(?COVER_CLAUSE_TABLE, [set, public, named_table]),
>             ets:new(?BINARY_TABLE, [set, named_table]),
>             ets:new(?COLLECTION_TABLE, [set, public, named_table]),
>             ets:new(?COLLECTION_CLAUSE_**TABLE, [set, public,
> named_table]),
>             process_flag(trap_exit,true),
>             Starter ! {?SERVER,started},
>             main_process_loop(#main_state{**});
>         _ ->
>             catch ets:delete(?COVER_TABLE),
>             catch ets:delete(?COVER_CLAUSE_**TABLE),
>             catch ets:delete(?BINARY_TABLE),
>             catch ets:delete(?COLLECTION_TABLE),
>             catch ets:delete(?COLLECTION_CLAUSE_**TABLE),
>             init_main(Starter)
>     end.
> ------------------------------**------------------------------**
> ----------------
>
> It works well, but I supose I can move the ets:delete block to main_loop,
> when call to stop.


Yes, I think that would be cleaner. It would ensure that cover is
completely stopped when cover:stop/0 returns.
/siri


> [1] https://github.com/**bosqueviejo/covertool/<https://github.com/bosqueviejo/covertool/>
> [2] https://github.com/**bosqueviejo/covertool/blob/**master/src/cover.erl<https://github.com/bosqueviejo/covertool/blob/master/src/cover.erl>
>
> Regards.
> Manuel Rubio.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130328/a57958ff/attachment.htm>


More information about the erlang-questions mailing list