profile: support for -profile-no-inline (with it, [inline] fns will not get profiled)
parent
847a1035a5
commit
4c320e1512
|
@ -75,6 +75,9 @@ The build flags are shared by the build and run commands:
|
||||||
d) the function name
|
d) the function name
|
||||||
NB: if you want to output the profile info to stdout, use `-profile -`.
|
NB: if you want to output the profile info to stdout, use `-profile -`.
|
||||||
|
|
||||||
|
-profile-no-inline
|
||||||
|
Skip [inline] functions when profiling.
|
||||||
|
|
||||||
-stats
|
-stats
|
||||||
Enable more detailed statistics reporting, while compiling test files.
|
Enable more detailed statistics reporting, while compiling test files.
|
||||||
You can use that with `v test` too, for example:
|
You can use that with `v test` too, for example:
|
||||||
|
|
|
@ -150,6 +150,9 @@ fn parse_args(args []string) (&pref.Preferences, string) {
|
||||||
res.is_prof = true
|
res.is_prof = true
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
'-profile-no-inline' {
|
||||||
|
res.profile_no_inline = true
|
||||||
|
}
|
||||||
'-prod' {
|
'-prod' {
|
||||||
res.is_prod = true
|
res.is_prod = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ fn (mut g Gen) profile_fn(fn_name string, is_main bool){
|
||||||
g.writeln('\tatexit(vprint_profile_stats);')
|
g.writeln('\tatexit(vprint_profile_stats);')
|
||||||
g.writeln('')
|
g.writeln('')
|
||||||
}
|
}
|
||||||
|
if g.pref.profile_no_inline && g.attr == 'inline' {
|
||||||
|
g.defer_profile_code = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
if fn_name.starts_with('time.vpc_now') {
|
if fn_name.starts_with('time.vpc_now') {
|
||||||
g.defer_profile_code = ''
|
g.defer_profile_code = ''
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub mut:
|
||||||
is_shared bool // an ordinary shared library, -shared, no matter if it is live or not
|
is_shared bool // an ordinary shared library, -shared, no matter if it is live or not
|
||||||
is_prof bool // benchmark every function
|
is_prof bool // benchmark every function
|
||||||
profile_file string // the profile results will be stored inside profile_file
|
profile_file string // the profile results will be stored inside profile_file
|
||||||
|
profile_no_inline bool // when true, [inline] functions would not be profiled
|
||||||
translated bool // `v translate doom.v` are we running V code translated from C? allow globals, ++ expressions, etc
|
translated bool // `v translate doom.v` are we running V code translated from C? allow globals, ++ expressions, etc
|
||||||
is_prod bool // use "-O2"
|
is_prod bool // use "-O2"
|
||||||
obfuscate bool // `v -obf program.v`, renames functions to "f_XXX"
|
obfuscate bool // `v -obf program.v`, renames functions to "f_XXX"
|
||||||
|
|
Loading…
Reference in New Issue