Actions
Feature #15963
closedAdd *_start and *_running methods to VM_COLLECT_USAGE_DETAILS API
Description
I want to count how many VM instructions get executed for an arbitrary block of ruby code with VM_COLLECT_USAGE_DETAILS
enabled. However, the current API enables VM usage detail collection immediately and only exposes methods to turn collection off.
I've issued a PR to add more methods to the VM usage details API and to disable collection by default: https://github.com/ruby/ruby/pull/2258
Updated by ko1 (Koichi Sasada) over 4 years ago
- Assignee set to ko1 (Koichi Sasada)
Please list new methods to discuss.
existing:
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_INSN_STOP", usage_analysis_insn_stop, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_OPERAND_STOP", usage_analysis_operand_stop, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_REGISTER_STOP", usage_analysis_register_stop, 0);
proposal:
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_INSN_START", usage_analysis_insn_start, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_OPERAND_START", usage_analysis_operand_start, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_REGISTER_START", usage_analysis_register_start, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_INSN_RUNNING", usage_analysis_insn_running, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_OPERAND_RUNNING", usage_analysis_operand_running, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_REGISTER_RUNNING", usage_analysis_register_running, 0);
do you need clear
methods?
Updated by gmcgibbon (Gannon McGibbon) over 4 years ago
I have been using Hash#clear
to clear the constants, but that's because a clear
method doesn't exist. I will add the following to the PR:
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_INSN_CLEAR", usage_analysis_insn_clear, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_OPERAND_CLEAR", usage_analysis_operand_clear, 0);
rb_define_singleton_method(rb_cRubyVM, "USAGE_ANALYSIS_REGISTER_CLEAR", usage_analysis_register_clear, 0);
Updated by ko1 (Koichi Sasada) over 4 years ago
- Status changed from Open to Closed
Thank you, committed!
1ad0f4e593563d460e3015fc4a2542ce1bb80d6e
Actions
Like0
Like0Like0Like0