All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
@ 2018-08-31 20:01 Jeff Moyer
  2018-08-31 20:56 ` Jeff Moyer
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jeff Moyer @ 2018-08-31 20:01 UTC (permalink / raw)
  To: linux-btrace

iowatcher currently always spawns 8 rsvg-convert processes, no matter
how many CPUs a system has.  I did some limited testing of different
numbers of rsvg-convert processes.  Here are the results:

8 processes:
real	4m2.194s
user	23m36.665s
sys	0m38.523s

20 processes:
real	2m28.935s
user	24m51.817s
sys	0m49.227s

40 processes:
real	2m28.150s
user	24m56.994s
sys	0m49.621s

Note that this is the time it takes for a full run of iowatcher -- I
didn't separate out just the rsvg-convert portion.

Given the above results, it seems like a reasonable thing to spawn one
rsvg-convert process per cpu.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/iowatcher/main.c b/iowatcher/main.c
index 54325fb..4b97013 100644
--- a/iowatcher/main.c
+++ b/iowatcher/main.c
@@ -1043,9 +1043,14 @@ static void system_check(const char *cmd)
 
 static void convert_movie_files(char *movie_dir)
 {
+	long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+
+	if (nr_cpus < 0)
+		nr_cpus = 8;
+
 	fprintf(stderr, "Converting svg files in %s\n", movie_dir);
-	snprintf(line, line_len, "find %s -name \\*.svg | xargs -I{} -n 1 -P 8 rsvg-convert -o {}.png {}",
-		 movie_dir);
+	snprintf(line, line_len, "find %s -name \\*.svg | xargs -I{} -n 1 -P %ld rsvg-convert -o {}.png {}",
+		 movie_dir, nr_cpus);
 	system_check(line);
 }
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
  2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
@ 2018-08-31 20:56 ` Jeff Moyer
  2018-08-31 20:58 ` Jens Axboe
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeff Moyer @ 2018-08-31 20:56 UTC (permalink / raw)
  To: linux-btrace

Jeff Moyer <jmoyer@redhat.com> writes:

> iowatcher currently always spawns 8 rsvg-convert processes, no matter
> how many CPUs a system has.  I did some limited testing of different
> numbers of rsvg-convert processes.  Here are the results:

I forgot to mention that my system has 20 hyperthreads.

Jens, can you also fix the spwan typo in the subject when you commit
this?

Thanks!
Jeff

> 8 processes:
> real	4m2.194s
> user	23m36.665s
> sys	0m38.523s
>
> 20 processes:
> real	2m28.935s
> user	24m51.817s
> sys	0m49.227s
>
> 40 processes:
> real	2m28.150s
> user	24m56.994s
> sys	0m49.621s
>
> Note that this is the time it takes for a full run of iowatcher -- I
> didn't separate out just the rsvg-convert portion.
>
> Given the above results, it seems like a reasonable thing to spawn one
> rsvg-convert process per cpu.
>
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
>
> diff --git a/iowatcher/main.c b/iowatcher/main.c
> index 54325fb..4b97013 100644
> --- a/iowatcher/main.c
> +++ b/iowatcher/main.c
> @@ -1043,9 +1043,14 @@ static void system_check(const char *cmd)
>  
>  static void convert_movie_files(char *movie_dir)
>  {
> +	long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
> +
> +	if (nr_cpus < 0)
> +		nr_cpus = 8;
> +
>  	fprintf(stderr, "Converting svg files in %s\n", movie_dir);
> -	snprintf(line, line_len, "find %s -name \\*.svg | xargs -I{} -n 1 -P 8 rsvg-convert -o {}.png {}",
> -		 movie_dir);
> +	snprintf(line, line_len, "find %s -name \\*.svg | xargs -I{} -n 1 -P %ld rsvg-convert -o {}.png {}",
> +		 movie_dir, nr_cpus);
>  	system_check(line);
>  }
>  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
  2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
  2018-08-31 20:56 ` Jeff Moyer
@ 2018-08-31 20:58 ` Jens Axboe
  2018-08-31 20:59 ` Chris Mason
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2018-08-31 20:58 UTC (permalink / raw)
  To: linux-btrace

On 8/31/18 2:01 PM, Jeff Moyer wrote:
> iowatcher currently always spawns 8 rsvg-convert processes, no matter
> how many CPUs a system has.  I did some limited testing of different
> numbers of rsvg-convert processes.  Here are the results:
> 
> 8 processes:
> real	4m2.194s
> user	23m36.665s
> sys	0m38.523s
> 
> 20 processes:
> real	2m28.935s
> user	24m51.817s
> sys	0m49.227s
> 
> 40 processes:
> real	2m28.150s
> user	24m56.994s
> sys	0m49.621s
> 
> Note that this is the time it takes for a full run of iowatcher -- I
> didn't separate out just the rsvg-convert portion.
> 
> Given the above results, it seems like a reasonable thing to spawn one
> rsvg-convert process per cpu.

Applied, with the typo fixed.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
  2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
  2018-08-31 20:56 ` Jeff Moyer
  2018-08-31 20:58 ` Jens Axboe
@ 2018-08-31 20:59 ` Chris Mason
  2018-08-31 21:02 ` Jens Axboe
  2018-09-04 10:42 ` Jeff Moyer
  4 siblings, 0 replies; 6+ messages in thread
From: Chris Mason @ 2018-08-31 20:59 UTC (permalink / raw)
  To: linux-btrace

On 31 Aug 2018, at 16:56, Jeff Moyer wrote:

> Jeff Moyer <jmoyer@redhat.com> writes:
>
>> iowatcher currently always spawns 8 rsvg-convert processes, no matter
>> how many CPUs a system has.  I did some limited testing of different
>> numbers of rsvg-convert processes.  Here are the results:
>
> I forgot to mention that my system has 20 hyperthreads.
>
> Jens, can you also fix the spwan typo in the subject when you commit
> this?

Reviewed-by: Chris Mason <clm@fb.com> but only if the typo stays.

-chris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
  2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
                   ` (2 preceding siblings ...)
  2018-08-31 20:59 ` Chris Mason
@ 2018-08-31 21:02 ` Jens Axboe
  2018-09-04 10:42 ` Jeff Moyer
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2018-08-31 21:02 UTC (permalink / raw)
  To: linux-btrace

On 8/31/18 2:59 PM, Chris Mason wrote:
> On 31 Aug 2018, at 16:56, Jeff Moyer wrote:
> 
>> Jeff Moyer <jmoyer@redhat.com> writes:
>>
>>> iowatcher currently always spawns 8 rsvg-convert processes, no matter
>>> how many CPUs a system has.  I did some limited testing of different
>>> numbers of rsvg-convert processes.  Here are the results:
>>
>> I forgot to mention that my system has 20 hyperthreads.
>>
>> Jens, can you also fix the spwan typo in the subject when you commit
>> this?
> 
> Reviewed-by: Chris Mason <clm@fb.com> but only if the typo stays.

Haha damn, well I guess that worked out, since I committed it 5 min
ago, without the reviewed-by, but with typo fixed :-)

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s
  2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
                   ` (3 preceding siblings ...)
  2018-08-31 21:02 ` Jens Axboe
@ 2018-09-04 10:42 ` Jeff Moyer
  4 siblings, 0 replies; 6+ messages in thread
From: Jeff Moyer @ 2018-09-04 10:42 UTC (permalink / raw)
  To: linux-btrace

Jens Axboe <axboe@kernel.dk> writes:

> On 8/31/18 2:59 PM, Chris Mason wrote:
>> On 31 Aug 2018, at 16:56, Jeff Moyer wrote:
>> 
>>> Jeff Moyer <jmoyer@redhat.com> writes:
>>>
>>>> iowatcher currently always spawns 8 rsvg-convert processes, no matter
>>>> how many CPUs a system has.  I did some limited testing of different
>>>> numbers of rsvg-convert processes.  Here are the results:
>>>
>>> I forgot to mention that my system has 20 hyperthreads.
>>>
>>> Jens, can you also fix the spwan typo in the subject when you commit
>>> this?
>> 
>> Reviewed-by: Chris Mason <clm@fb.com> but only if the typo stays.
>
> Haha damn, well I guess that worked out, since I committed it 5 min
> ago, without the reviewed-by, but with typo fixed :-)

You guys crack me up.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-04 10:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31 20:01 [patch] iowatcher: spwan NPROCESSORS_ONLN rsvg-convert-s Jeff Moyer
2018-08-31 20:56 ` Jeff Moyer
2018-08-31 20:58 ` Jens Axboe
2018-08-31 20:59 ` Chris Mason
2018-08-31 21:02 ` Jens Axboe
2018-09-04 10:42 ` Jeff Moyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.