-
Notifications
You must be signed in to change notification settings - Fork 45
Make statistics by class #1328
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
Merged
Merged
Make statistics by class #1328
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a494d22
provide fuzzing ratio property
SBOne-Kenobi 673910f
small instructions counting fix
SBOne-Kenobi 05f375e
add packages to export detection
SBOne-Kenobi ddf6012
restruct statistics by projects
SBOne-Kenobi 42415ca
update coroutines management
SBOne-Kenobi ca911d3
update monitoring scripts
SBOne-Kenobi ad45fc9
update docs, add comments
SBOne-Kenobi cd98c8c
add metrics preparing for grafana
SBOne-Kenobi 2a7c2d9
update ci
SBOne-Kenobi 5580dc2
update docs
SBOne-Kenobi c096b41
add runner label
SBOne-Kenobi 1c900cc
fix context management
SBOne-Kenobi bf68fea
fix property name
SBOne-Kenobi 39d3bdc
fix action
SBOne-Kenobi dfb6292
fix according to review
SBOne-Kenobi dfef0ea
change metrics names
SBOne-Kenobi 3636aab
fix metrics with bool values
SBOne-Kenobi 1f2d5d5
fix metrics names
SBOne-Kenobi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
provide fuzzing ratio property
reformat serialization
- Loading branch information
commit a494d22a26ca36c77c39d6b0f8c86f07c53b14ed
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
utbot-junit-contest/src/main/kotlin/org/utbot/monitoring/MonitoringReport.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package org.utbot.monitoring | ||
|
||
import kotlinx.serialization.Serializable | ||
import org.utbot.contest.GlobalStats | ||
import org.utbot.contest.StatsForClass | ||
|
||
@Serializable | ||
data class MonitoringReport( | ||
val parameters: MonitoringParameters, | ||
val summarised_metrics: SummarisedMetricsReport, | ||
val targets: List<TargetReport>, | ||
) { | ||
constructor(parameters: MonitoringParameters, targets: List<TargetReport>): this( | ||
parameters, | ||
SummarisedMetricsReport(targets), | ||
targets | ||
) | ||
|
||
constructor(parameters: MonitoringParameters, stats: GlobalStats) : this( | ||
parameters, | ||
stats.statsForClasses.map { | ||
TargetReport( | ||
TargetDescription(it.project, it.className), | ||
ClassMetricsReport(it) | ||
) | ||
} | ||
) | ||
} | ||
|
||
@Serializable | ||
data class MonitoringParameters( | ||
val fuzzing_ratio: Double, | ||
val class_timeout_sec: Int, | ||
val run_timeout_min: Int, | ||
) | ||
|
||
@Serializable | ||
data class TargetReport( | ||
val target: TargetDescription, | ||
val metrics: ClassMetricsReport | ||
) | ||
|
||
@Serializable | ||
data class TargetDescription( | ||
val project: String, | ||
val classname: String | ||
) | ||
|
||
private fun Int.cover(total: Int): Double = | ||
if (total == 0) 0.0 else this.toDouble() / total | ||
|
||
@Serializable | ||
data class ClassMetricsReport( | ||
val testcases_generated: Int, | ||
val failed_to_compile: Boolean, | ||
val canceled_by_timeout: Boolean, | ||
val total_methods_in_class: Int, | ||
val methods_with_at_least_one_testcase_generated: Int, | ||
val methods_with_at_least_one_exception: Int, | ||
val methods_without_any_tests_and_exceptions: Int, | ||
val covered_bytecode_instructions_in_class: Int, | ||
val covered_bytecode_instructions_in_class_by_fuzzing: Int, | ||
val covered_bytecode_instructions_in_class_by_concolic: Int, | ||
val total_bytecode_instructions_in_class: Int, | ||
val bytecode_instructions_coverage_in_class: Double = covered_bytecode_instructions_in_class.cover(total_bytecode_instructions_in_class), | ||
val bytecode_instructions_coverage_in_class_by_fuzzing: Double = covered_bytecode_instructions_in_class_by_fuzzing.cover(total_bytecode_instructions_in_class), | ||
val bytecode_instructions_coverage_in_class_by_concolic: Double = covered_bytecode_instructions_in_class_by_concolic.cover(total_bytecode_instructions_in_class) | ||
) { | ||
constructor(statsForClass: StatsForClass) : this( | ||
testcases_generated = statsForClass.testcasesGenerated, | ||
failed_to_compile = statsForClass.failedToCompile, | ||
canceled_by_timeout = statsForClass.canceledByTimeout, | ||
total_methods_in_class = statsForClass.methodsCount, | ||
methods_with_at_least_one_testcase_generated = statsForClass.statsForMethods.count { it.testsGeneratedCount > 0 }, | ||
methods_with_at_least_one_exception = statsForClass.methodsWithAtLeastOneException, | ||
methods_without_any_tests_and_exceptions = statsForClass.statsForMethods.count { it.isSuspicious }, | ||
covered_bytecode_instructions_in_class = statsForClass.getCoverageInfo().covered, | ||
covered_bytecode_instructions_in_class_by_fuzzing = statsForClass.getFuzzedCoverageInfo().covered, | ||
covered_bytecode_instructions_in_class_by_concolic = statsForClass.getConcolicCoverageInfo().covered, | ||
total_bytecode_instructions_in_class = statsForClass.coverage.totalInstructions.toInt() | ||
) | ||
} | ||
|
||
@Serializable | ||
data class SummarisedMetricsReport( | ||
val total_classes: Int, | ||
val testcases_generated: Int, | ||
val classes_failed_to_compile: Int, | ||
val classes_canceled_by_timeout: Int, | ||
val total_methods: Int, | ||
val methods_with_at_least_one_testcase_generated: Int, | ||
val methods_with_at_least_one_exception: Int, | ||
val methods_without_any_tests_and_exceptions: Int, | ||
val covered_bytecode_instructions: Int, | ||
val covered_bytecode_instructions_by_fuzzing: Int, | ||
val covered_bytecode_instructions_by_concolic: Int, | ||
val total_bytecode_instructions: Int, | ||
val bytecode_instructions_coverage: Double = covered_bytecode_instructions.cover(total_bytecode_instructions), | ||
val bytecode_instructions_coverage_by_fuzzing: Double = covered_bytecode_instructions_by_fuzzing.cover(total_bytecode_instructions), | ||
val bytecode_instructions_coverage_by_concolic: Double = covered_bytecode_instructions_by_concolic.cover(total_bytecode_instructions), | ||
val averaged_bytecode_instruction_coverage_by_classes: Double | ||
) { | ||
constructor(targets: Collection<TargetReport>) : this( | ||
total_classes = targets.size, | ||
testcases_generated = targets.sumOf { it.metrics.testcases_generated }, | ||
classes_failed_to_compile = targets.count { it.metrics.failed_to_compile }, | ||
classes_canceled_by_timeout = targets.count { it.metrics.canceled_by_timeout }, | ||
total_methods = targets.sumOf { it.metrics.total_methods_in_class }, | ||
methods_with_at_least_one_testcase_generated = targets.sumOf { it.metrics.methods_with_at_least_one_testcase_generated }, | ||
methods_with_at_least_one_exception = targets.sumOf { it.metrics.methods_with_at_least_one_exception }, | ||
methods_without_any_tests_and_exceptions = targets.sumOf { it.metrics.methods_without_any_tests_and_exceptions }, | ||
covered_bytecode_instructions = targets.sumOf { it.metrics.covered_bytecode_instructions_in_class }, | ||
covered_bytecode_instructions_by_fuzzing = targets.sumOf { it.metrics.covered_bytecode_instructions_in_class_by_fuzzing }, | ||
covered_bytecode_instructions_by_concolic = targets.sumOf { it.metrics.covered_bytecode_instructions_in_class_by_concolic }, | ||
total_bytecode_instructions = targets.sumOf { it.metrics.total_bytecode_instructions_in_class }, | ||
averaged_bytecode_instruction_coverage_by_classes = targets.map { it.metrics.bytecode_instructions_coverage_in_class }.average() | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.