[1/4] perf bench messaging: Fix coding style issues for sched-messaging

Message ID 20230923093037.961232-2-yangjihong1@huawei.com
State New
Headers
Series perf bench messaging: Kill child processes when exit abnormally in process mode |

Commit Message

Yang Jihong Sept. 23, 2023, 9:30 a.m. UTC
  Fixed several code style issues in sched-messaging:
1. Use one space around "-" and "+" operators.
2. When a long line is broken, the operator is at the end of the line.

Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/bench/sched-messaging.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Ian Rogers Sept. 24, 2023, 6:10 p.m. UTC | #1
On Sat, Sep 23, 2023 at 2:32 AM Yang Jihong <yangjihong1@huawei.com> wrote:
>
> Fixed several code style issues in sched-messaging:
> 1. Use one space around "-" and "+" operators.
> 2. When a long line is broken, the operator is at the end of the line.
>
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>

Series:
Reviewed-by: Ian Rogers <irogers@google.com>
I wonder with the SIGTERM improvements whether there should be
improvements to tools/lib/subcmd and then we use that.

Thanks,
Ian

> ---
>  tools/perf/bench/sched-messaging.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
> index fa1f8f998814..6a33118c8f9b 100644
> --- a/tools/perf/bench/sched-messaging.c
> +++ b/tools/perf/bench/sched-messaging.c
> @@ -98,7 +98,7 @@ static void *sender(struct sender_context *ctx)
>
>  again:
>                         ret = write(ctx->out_fds[j], data + done,
> -                                   sizeof(data)-done);
> +                                   sizeof(data) - done);
>                         if (ret < 0)
>                                 err(EXIT_FAILURE, "SENDER: write");
>                         done += ret;
> @@ -201,8 +201,8 @@ static unsigned int group(pthread_t *pth,
>                 int wakefd)
>  {
>         unsigned int i;
> -       struct sender_context *snd_ctx = malloc(sizeof(struct sender_context)
> -                       + num_fds * sizeof(int));
> +       struct sender_context *snd_ctx = malloc(sizeof(struct sender_context) +
> +                                               num_fds * sizeof(int));
>
>         if (!snd_ctx)
>                 err(EXIT_FAILURE, "malloc()");
> @@ -239,7 +239,7 @@ static unsigned int group(pthread_t *pth,
>                 snd_ctx->wakefd = wakefd;
>                 snd_ctx->num_fds = num_fds;
>
> -               pth[num_fds+i] = create_worker(snd_ctx, (void *)sender);
> +               pth[num_fds + i] = create_worker(snd_ctx, (void *)sender);
>         }
>
>         /* Close the fds we have left */
> @@ -288,7 +288,7 @@ int bench_sched_messaging(int argc, const char **argv)
>
>         total_children = 0;
>         for (i = 0; i < num_groups; i++)
> -               total_children += group(pth_tab+total_children, num_fds,
> +               total_children += group(pth_tab + total_children, num_fds,
>                                         readyfds[1], wakefds[0]);
>
>         /* Wait for everyone to be ready */
> --
> 2.34.1
>
  

Patch

diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index fa1f8f998814..6a33118c8f9b 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -98,7 +98,7 @@  static void *sender(struct sender_context *ctx)
 
 again:
 			ret = write(ctx->out_fds[j], data + done,
-				    sizeof(data)-done);
+				    sizeof(data) - done);
 			if (ret < 0)
 				err(EXIT_FAILURE, "SENDER: write");
 			done += ret;
@@ -201,8 +201,8 @@  static unsigned int group(pthread_t *pth,
 		int wakefd)
 {
 	unsigned int i;
-	struct sender_context *snd_ctx = malloc(sizeof(struct sender_context)
-			+ num_fds * sizeof(int));
+	struct sender_context *snd_ctx = malloc(sizeof(struct sender_context) +
+						num_fds * sizeof(int));
 
 	if (!snd_ctx)
 		err(EXIT_FAILURE, "malloc()");
@@ -239,7 +239,7 @@  static unsigned int group(pthread_t *pth,
 		snd_ctx->wakefd = wakefd;
 		snd_ctx->num_fds = num_fds;
 
-		pth[num_fds+i] = create_worker(snd_ctx, (void *)sender);
+		pth[num_fds + i] = create_worker(snd_ctx, (void *)sender);
 	}
 
 	/* Close the fds we have left */
@@ -288,7 +288,7 @@  int bench_sched_messaging(int argc, const char **argv)
 
 	total_children = 0;
 	for (i = 0; i < num_groups; i++)
-		total_children += group(pth_tab+total_children, num_fds,
+		total_children += group(pth_tab + total_children, num_fds,
 					readyfds[1], wakefds[0]);
 
 	/* Wait for everyone to be ready */