iilyak commented on code in PR #5491:
URL: https://github.com/apache/couchdb/pull/5491#discussion_r2152788429


##########
src/couch_stats/src/csrt_logger.erl:
##########
@@ -407,6 +414,40 @@ matcher_on_ioq_calls(Threshold) when
 ->
     ets:fun2ms(fun(#rctx{ioq_calls = IOQCalls} = R) when IOQCalls >= Threshold 
-> R end).
 
+%%-spec matcher_for_rctx_field(Field :: rctx_field()) -> ets:match_spec().
+%%matcher_for_rctx_field() ->
+%%    #{size := Size0, fields := Fields} = csrt_util:rctx_record_info(),
+%%    %% Subtract 1 as record_info size includes tuple record name
+%%    %% erlang:list_to_tuple([rctx | lists:duplicate(maps:get(size, 
csrt_util:rctx_record_info()), '_')])
+%%    Size = Size - 1,
+
+pid_ref_matchspec(AttrName) ->
+    #{size := Size, field_idx := FieldIdx} = csrt_util:rctx_record_info(),
+    RctxMatch0 = list_to_tuple([rctx | lists:duplicate(Size - 1, '_')]),

Review Comment:
   The 
   
   ```
   RctxMatch0 = list_to_tuple([rctx | lists:duplicate(Size - 1, '_')]),
   ```
   
   is equivalent to 
   
   ```
   [{RctxMatch0, _, _}] = ets:fun2ms(fun(#rctx{pid_ref = PR}) -> PR end).
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to