cgen: fix profile time on windows #23227
Merged
spytheman merged 2 commits intovlang:masterfrom Dec 21, 2024
Merged
Conversation
Contributor
Author
|
a example : module main
import time
fn main() {
time.sleep(1000 * time.millisecond)
}compile it with: v tt.v -profilerun it and will get result: D:\v\time>.\tt
1 0.001ms 600ns at_exit
1 0.014ms 13600ns _v_malloc
1 0.014ms 13900ns memdup
1 0.000ms 200ns gc_set_warn_proc
1 0.024ms 24200ns is_terminal
1 0.181ms 181500ns builtin_init
1 0.006ms 5600ns add_vectored_exception_handler
1 0.006ms 5600ns add_unhandled_exception_handler
1 1002.005ms 1002004700ns time__sleep
1 1002.010ms 1002009500ns main__main
D:\v\time> |
spytheman
reviewed
Dec 21, 2024
spytheman
reviewed
Dec 21, 2024
spytheman
reviewed
Dec 21, 2024
spytheman
reviewed
Dec 21, 2024
spytheman
approved these changes
Dec 21, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix issue #19130
QueryPerformanceCounter()only a counter value, it need to divideQueryPerformanceFrequency()to get real time.As
time.vpc_now()return only a counter value:https://learn.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps
Huly®: V_0.6-21661