Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add *_start and *_running methods to VM_COLLECT_USAGE_DETAILS API #2258

Closed
wants to merge 2 commits into from

Conversation

@gmcgibbon
Copy link
Contributor

commented Jun 27, 2019

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.

This commit exposes additional methods to start usage detail collection and check if usage details are being collected. Subsequently, this changes behaviour to not collect VM usage details by default.

https://bugs.ruby-lang.org/issues/15963

vm.c Show resolved Hide resolved
Add *_start and *_running methods to VM_COLLECT_USAGE_DETAILS API
Add RubyVM::USAGE_ANALYSIS_INSN_START, RubyVM::USAGE_ANALYSIS_OPERAND_START,
and RubyVM::USAGE_ANALYSIS_REGISTER_START to begin collecting VM instructions.

Add RubyVM::USAGE_ANALYSIS_INSN_RUNNING, RubyVM::USAGE_ANALYSIS_OPERAND_RUNNING,
and RubyVM::USAGE_ANALYSIS_REGISTER_RUNNING to check if VM instructions
are being collected.

@gmcgibbon gmcgibbon force-pushed the gmcgibbon:vm_insn_collection_toggle branch from 524cb0e to c654744 Jun 27, 2019

Add *_clear methods to VM_COLLECT_USAGE_DETAILS API
Add RubyVM::USAGE_ANALYSIS_INSN_CLEAR, RubyVM::USAGE_ANALYSIS_OPERAND_CLEAR,
and RubyVM::USAGE_ANALYSIS_REGISTER_CLEAR to clear VM instruction hash constants.

@matzbot matzbot closed this in 1c7d3a1 Aug 8, 2019

matzbot pushed a commit that referenced this pull request Aug 8, 2019
Add *_clear methods to VM_COLLECT_USAGE_DETAILS API
Add RubyVM::USAGE_ANALYSIS_INSN_CLEAR, RubyVM::USAGE_ANALYSIS_OPERAND_CLEAR,
and RubyVM::USAGE_ANALYSIS_REGISTER_CLEAR to clear VM instruction hash constants.

Closes: #2258

@gmcgibbon gmcgibbon deleted the gmcgibbon:vm_insn_collection_toggle branch Aug 8, 2019

gmcgibbon added a commit to Shopify/ruby that referenced this pull request Aug 8, 2019
Add *_start and *_running methods to VM_COLLECT_USAGE_DETAILS API
Add RubyVM::USAGE_ANALYSIS_INSN_START, RubyVM::USAGE_ANALYSIS_OPERAND_START,
and RubyVM::USAGE_ANALYSIS_REGISTER_START to begin collecting VM instructions.

Add RubyVM::USAGE_ANALYSIS_INSN_RUNNING, RubyVM::USAGE_ANALYSIS_OPERAND_RUNNING,
and RubyVM::USAGE_ANALYSIS_REGISTER_RUNNING to check if VM instructions
are being collected.

Closes: ruby#2258
gmcgibbon added a commit to Shopify/ruby that referenced this pull request Aug 8, 2019
Add *_clear methods to VM_COLLECT_USAGE_DETAILS API
Add RubyVM::USAGE_ANALYSIS_INSN_CLEAR, RubyVM::USAGE_ANALYSIS_OPERAND_CLEAR,
and RubyVM::USAGE_ANALYSIS_REGISTER_CLEAR to clear VM instruction hash constants.

Closes: ruby#2258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.