Coarse process profiling, factor out k-util.sh#2410
Conversation
6459c99 to
62635b4
Compare
dwightguth
left a comment
There was a problem hiding this comment.
I would strongly suggest using the time bash primitive rather than what you have here, which will only measure wall time. You can look into the TIMEFORMAT environment variable if you want it to look a certain way.
|
@dwightguth I've made the switch to shell builtin That not-withstanding, we lose information about the time between the "major" sub-calls (which are done with Should I try to recover this information as well? It would require printing a timestamp before each command is executed I guess. |
… runs without crashing
radumereuta
left a comment
There was a problem hiding this comment.
Nice.
I just want some more documentation.
radumereuta
left a comment
There was a problem hiding this comment.
lgtm. I'll let you and Dwight decide on the rest of his comments.
dwightguth
left a comment
There was a problem hiding this comment.
This seems better, but I still have one minor request. I would also like to see an example of what the output with this flag looks like.
| error () { | ||
| local result | ||
| result="$1" ; shift | ||
| printf "[Error] Critical: $*\n" | ${fold_lines} 1>&2 |
There was a problem hiding this comment.
This removes the specificity of which component has the error, which I would really like to keep. You can solve this by making it grab the component from an environment variable set by the script that sources this file.
There was a problem hiding this comment.
Addressed, using variable ktool which the user of k-util.sh is expected to set, and the instructions are updated.
|
Here is some sample output: |
dwightguth
left a comment
There was a problem hiding this comment.
I'm not sure how I feel about the text specifying a specific tool rather than being consistent with the format of errors reported by Java code. I would really prefer we keep a uniform experience if possible. But if you think this is a significant improvement, I guess I don't have a huge argument.
I would like to note though that it's possible for the act of sourcing the library script to trigger an error, so we should put the environment variable being set before the source command rather than after.
If you decide you prefer errors with the text they have now, and you address the issue I just mentioned, feel free to merge.
|
I would like to be uniform as well, which |
Blocked on #2404This PR does several things:
k-util.shto thek-util.shfile itself. Basically, if an option was used somewhere ink-util.sh, I tried to factor out that option handling into that script. This includes:--verbose--no-exc-wrapprintf "... $@" | ${fold_lines}to use$*instead of$@($@expands to each argument separately when in double-quotes, but$*expands it as part of a single argument, andprintfexpects a single argument).warningfunction.k_util_usage.