* [PATCH] rt-tests: oslat: print version string
@ 2021-02-11 4:42 John Kacur
2021-02-11 7:45 ` Daniel Wagner
2021-02-11 14:05 ` Peter Xu
0 siblings, 2 replies; 5+ messages in thread
From: John Kacur @ 2021-02-11 4:42 UTC (permalink / raw)
To: RT
Cc: Daniel Wagner, Clark Williams, John Kacur, Pradipta Kumar Sahoo,
Reported-by : Peter Xu
During the streamlining of the command line options something went awry
with the version. The author of oslat wishes to always print the version
string. This allows us to just exit in the case of -v
Fixes e411219d27b1
Reported-by: Pradipta Kumar Sahoo <psahoo@redhat.com>
Reported-by: Reported-by: Peter Xu <peterx@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/oslat/oslat.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 5b7e0d5b5d5c..7826c277f26d 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -512,7 +512,6 @@ static void handle_alarm(int code)
static void usage(int error)
{
- printf("oslat V %1.2f\n", VERSION);
printf("Usage:\n"
"oslat <options>\n\n"
"This is an OS latency detector by running busy loops on specified cores.\n"
@@ -657,8 +656,8 @@ static void parse_options(int argc, char *argv[])
break;
case 'v':
/*
- * Because we always dump the version even before parsing options,
- * what we need to do is to quit..
+ * We always print the version before parsing options
+ * so just exit
*/
exit(0);
break;
@@ -736,7 +735,7 @@ int main(int argc, char *argv[])
g.workload_mem_size = WORKLOAD_MEM_SIZE;
/* Run the main thread on cpu0 by default */
g.cpu_main_thread = 0;
-
+ printf("oslat V %1.2f\n", VERSION);
parse_options(argc, argv);
TEST(mlockall(MCL_CURRENT | MCL_FUTURE) == 0);
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-tests: oslat: print version string
2021-02-11 4:42 [PATCH] rt-tests: oslat: print version string John Kacur
@ 2021-02-11 7:45 ` Daniel Wagner
2021-02-11 13:42 ` John Kacur
2021-02-11 14:05 ` Peter Xu
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2021-02-11 7:45 UTC (permalink / raw)
To: John Kacur
Cc: RT, Clark Williams, Pradipta Kumar Sahoo, Reported-by : Peter Xu
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -512,7 +512,6 @@ static void handle_alarm(int code)
>
> static void usage(int error)
> {
> - printf("oslat V %1.2f\n", VERSION);
> printf("Usage:\n"
Why do you remove the version string in the usage output. Every other
tool prints it?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-tests: oslat: print version string
2021-02-11 7:45 ` Daniel Wagner
@ 2021-02-11 13:42 ` John Kacur
2021-02-11 13:48 ` Daniel Wagner
0 siblings, 1 reply; 5+ messages in thread
From: John Kacur @ 2021-02-11 13:42 UTC (permalink / raw)
To: Daniel Wagner
Cc: RT, Clark Williams, Pradipta Kumar Sahoo, Reported-by : Peter Xu
On Thu, 11 Feb 2021, Daniel Wagner wrote:
> > --- a/src/oslat/oslat.c
> > +++ b/src/oslat/oslat.c
> > @@ -512,7 +512,6 @@ static void handle_alarm(int code)
> >
> > static void usage(int error)
> > {
> > - printf("oslat V %1.2f\n", VERSION);
> > printf("Usage:\n"
>
> Why do you remove the version string in the usage output. Every other
> tool prints it?
>
>
Because the version is printed out before the call to parse the options.
If you don't remove it here, it gets printed out twice.
John
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-tests: oslat: print version string
2021-02-11 13:42 ` John Kacur
@ 2021-02-11 13:48 ` Daniel Wagner
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2021-02-11 13:48 UTC (permalink / raw)
To: John Kacur
Cc: RT, Clark Williams, Pradipta Kumar Sahoo, Reported-by : Peter Xu
On Thu, Feb 11, 2021 at 08:42:41AM -0500, John Kacur wrote:
> Because the version is printed out before the call to parse the options.
> If you don't remove it here, it gets printed out twice.
Ah, that makes sense.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-tests: oslat: print version string
2021-02-11 4:42 [PATCH] rt-tests: oslat: print version string John Kacur
2021-02-11 7:45 ` Daniel Wagner
@ 2021-02-11 14:05 ` Peter Xu
1 sibling, 0 replies; 5+ messages in thread
From: Peter Xu @ 2021-02-11 14:05 UTC (permalink / raw)
To: John Kacur; +Cc: RT, Daniel Wagner, Clark Williams, Pradipta Kumar Sahoo
On Wed, Feb 10, 2021 at 11:42:21PM -0500, John Kacur wrote:
> During the streamlining of the command line options something went awry
> with the version. The author of oslat wishes to always print the version
> string. This allows us to just exit in the case of -v
Thanks. It's just that if we need to recover "-v" behavior it's simply to just
add that print() back, imho. Sorry if I seemed to have made that request
"stronger". :)
>
> Fixes e411219d27b1
>
> Reported-by: Pradipta Kumar Sahoo <psahoo@redhat.com>
> Reported-by: Reported-by: Peter Xu <peterx@redhat.com>
>
> Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-11 14:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-11 4:42 [PATCH] rt-tests: oslat: print version string John Kacur
2021-02-11 7:45 ` Daniel Wagner
2021-02-11 13:42 ` John Kacur
2021-02-11 13:48 ` Daniel Wagner
2021-02-11 14:05 ` Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox