Module: T::Profile
- Defined in:
- lib/types/profile.rb
Overview
typed: true frozen_string_literal: true
Constant Summary collapse
- SAMPLE_RATE =
1 out of that many typechecks will be measured
101
Class Attribute Summary collapse
-
.typecheck_duration ⇒ Object
Returns the value of attribute typecheck_duration.
-
.typecheck_sample_attempts ⇒ Object
Returns the value of attribute typecheck_sample_attempts.
-
.typecheck_samples ⇒ Object
Returns the value of attribute typecheck_samples.
Class Method Summary collapse
Class Attribute Details
.typecheck_duration ⇒ Object
Returns the value of attribute typecheck_duration.
7 8 9 |
# File 'lib/types/profile.rb', line 7 def typecheck_duration @typecheck_duration end |
.typecheck_sample_attempts ⇒ Object
Returns the value of attribute typecheck_sample_attempts.
9 10 11 |
# File 'lib/types/profile.rb', line 9 def typecheck_sample_attempts @typecheck_sample_attempts end |
.typecheck_samples ⇒ Object
Returns the value of attribute typecheck_samples.
8 9 10 |
# File 'lib/types/profile.rb', line 8 def typecheck_samples @typecheck_samples end |
Class Method Details
.reset ⇒ Object
20 21 22 23 24 |
# File 'lib/types/profile.rb', line 20 def reset @typecheck_duration = 0 @typecheck_samples = 0 @typecheck_sample_attempts = SAMPLE_RATE end |
.typecheck_count_estimate ⇒ Object
16 17 18 |
# File 'lib/types/profile.rb', line 16 def typecheck_count_estimate typecheck_samples * SAMPLE_RATE end |
.typecheck_duration_estimate ⇒ Object
10 11 12 13 14 |
# File 'lib/types/profile.rb', line 10 def typecheck_duration_estimate total_typechecks = typecheck_samples * SAMPLE_RATE + (SAMPLE_RATE - typecheck_sample_attempts) typechecks_measured = typecheck_samples * SAMPLE_RATE typecheck_duration * SAMPLE_RATE * 1.0 * total_typechecks / typechecks_measured end |