diff mbox series

[rt-tests,v2,v2,06/20] cyclictest: Move verbose message into main

Message ID 20201218161843.1764-7-dwagner@suse.de
State Superseded
Headers show
Series [rt-tests,v2,v2,01/20] cyclictest: Always use libnuma | expand

Commit Message

Daniel Wagner Dec. 18, 2020, 4:18 p.m. UTC
By moving the verbose message down we print the message with the final
affinity_mask. This also handles the case where the bitmask is not set.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

John Kacur Jan. 26, 2021, 6:28 a.m. UTC | #1
On Fri, 18 Dec 2020, Daniel Wagner wrote:

> By moving the verbose message down we print the message with the final

> affinity_mask. This also handles the case where the bitmask is not set.

> 

> Signed-off-by: Daniel Wagner <dwagner@suse.de>

> ---

>  src/cyclictest/cyclictest.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)

> 

> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c

> index a34b2140f940..7e84c25f7070 100644

> --- a/src/cyclictest/cyclictest.c

> +++ b/src/cyclictest/cyclictest.c

> @@ -1020,10 +1020,6 @@ static void process_options(int argc, char *argv[], int max_cpus)

>  				    argv[optind][0] == '!')) {

>  				parse_cpumask(argv[optind], max_cpus, &affinity_mask);

>  			}

> -

> -			if (verbose)

> -				printf("Using %u cpus.\n",

> -					numa_bitmask_weight(affinity_mask));

>  			break;

>  		case 'A':

>  		case OPT_ALIGNED:

> @@ -1732,6 +1728,10 @@ int main(int argc, char **argv)

>  		res = numa_sched_setaffinity(getpid(), affinity_mask);

>  		if (res != 0)

>  			warn("Couldn't setaffinity in main thread: %s\n", strerror(errno));

> +

> +		if (verbose)

> +			printf("Using %u cpus.\n",

> +				numa_bitmask_weight(affinity_mask));

>  	}

>  

>  	if (trigger) {

> -- 

> 2.29.2

> 

> 

Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index a34b2140f940..7e84c25f7070 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1020,10 +1020,6 @@  static void process_options(int argc, char *argv[], int max_cpus)
 				    argv[optind][0] == '!')) {
 				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
 			}
-
-			if (verbose)
-				printf("Using %u cpus.\n",
-					numa_bitmask_weight(affinity_mask));
 			break;
 		case 'A':
 		case OPT_ALIGNED:
@@ -1732,6 +1728,10 @@  int main(int argc, char **argv)
 		res = numa_sched_setaffinity(getpid(), affinity_mask);
 		if (res != 0)
 			warn("Couldn't setaffinity in main thread: %s\n", strerror(errno));
+
+		if (verbose)
+			printf("Using %u cpus.\n",
+				numa_bitmask_weight(affinity_mask));
 	}
 
 	if (trigger) {