All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data
@ 2021-09-09  4:00 Akira Yokosawa
  2021-09-09  4:14 ` [PATCH -perfbook 1/2] formal: Move formal/data to CodeSamples/formal/data Akira Yokosawa
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Akira Yokosawa @ 2021-09-09  4:00 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

Hi Paul,

So this patch set moves formal/data and formal/RCU-test-ratio.eps
to CodeSamples/formal/data.

Patch 1/2 does the movement.
Patch 2/2 puts symlink to the moved .eps file under formal/.

Actually, patch 2/2 is optional within the scope of this set.
It presents an idea of organizing .eps files generated by gnuplot
under CodeSamples/ so that redundant .eps -> .pdf conversions
can be avoided.

Currently, I observe three ways to include gnuplot outputs.

1) Copy generated .eps files manually to the relevant chapter's
subdirectory (after running the plot script).

2) Run a plot script under CodeSamples/ and the generated .eps
files are automatically copied by commands in the script.

3) Use paths of .pdf versions of .eps files under CodeSamples/...
as the argument to the \includegraphics{} macros (no copying
involved).

Most recent plots are managed by 3).

However, to accommodate 3), a wildcard pattern in Makefile was
extended to include deep subdirectories under CodeSamples/
(commit 57b442c02db3 "Makefile: Extend wildcard pattern to catch
.eps files under CodeSamples").
So it now picks up a lot of unused older gnuplot plots, and causes
redundant .eps -> .pdf conversions.

So, I suggest using symlink, e.g.,
formal/xxx.eps -> CodeSamples/formal/data/xxx.eps, and remove
CodeSamples/ from the wildcard pattern in Makefile.

That is, if it is OK to use symlink as in patch 2/2.

Another advantage of this idea is that it would be easier to
find out where a particular gnuplot image is originated.

By copying .eps files from CodeSamples/... to other directories,
you lose such origin info.  This won't be a issue if there is a
single .eps file of the same name under CodeSamples/, but this is
not always the case.

Symlinks can retain their origins.

So, for example, when Zhouyi changed "rcu" to "RCU" in gnuplot
generated plots (commit 2a2ca773005f "Change trace labels from
"rcu" to "RCU""), he could have find out which scripts need
updates more easily.

As a matter of fact, he failed to update .eps files
under CodeSamples/.  For example:

    $ diff -u CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps defer/refRCUperfPREEMPT.eps
    --- CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps	2021-08-12 13:48:28.580153786 +0900
    +++ defer/refRCUperfPREEMPT.eps	2021-08-17 13:14:58.114517535 +0900
    @@ -2209,7 +2209,7 @@
     1.000 UP
     LCb setrgbcolor
     1729 1458 M
    -[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (rcu)]
    +[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (RCU)]
     ] -33.3 MLshow
     LCb setrgbcolor
     1066 2212 M

If Patch 2/2 looks good to you, I'll do the changes along this idea
and update the wildcard pattern in Makefile.

        Thanks, Akira
--
Akira Yokosawa (2):
  formal: Move formal/data to CodeSamples/formal/data
  formal: Use symlink to .eps file under CodeSamples/formal/data

 .../formal}/data/.gitignore                   |    1 -
 CodeSamples/formal/data/RCU-test-ratio.eps    | 4370 ++++++++++++++++
 {formal => CodeSamples/formal}/data/plot.sh   |    2 -
 .../formal}/data/rcu-test.dat                 |    0
 formal/RCU-test-ratio.eps                     | 4371 +----------------
 5 files changed, 4371 insertions(+), 4373 deletions(-)
 rename {formal => CodeSamples/formal}/data/.gitignore (50%)
 create mode 100644 CodeSamples/formal/data/RCU-test-ratio.eps
 rename {formal => CodeSamples/formal}/data/plot.sh (96%)
 rename {formal => CodeSamples/formal}/data/rcu-test.dat (100%)
 mode change 100644 => 120000 formal/RCU-test-ratio.eps

-- 
2.17.1


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

* [PATCH -perfbook 1/2] formal: Move formal/data to CodeSamples/formal/data
  2021-09-09  4:00 [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Akira Yokosawa
@ 2021-09-09  4:14 ` Akira Yokosawa
  2021-09-09  4:16 ` [PATCH -perfbook 2/2] formal: Use symlink to .eps file under CodeSamples/formal/data Akira Yokosawa
  2021-09-09 17:29 ` [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Paul E. McKenney
  2 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2021-09-09  4:14 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

The "data" directory with the plot script should be near the script
used to obtain the data.
Also adjust path in \includegraphics{} and remove a copy command
in plot.sh.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Note: Trailing spaces in the .eps file as generated by gnuplot
is kept intact.

        Thanks, Akira
--
 {formal => CodeSamples/formal}/data/.gitignore         | 1 -
 {formal => CodeSamples/formal/data}/RCU-test-ratio.eps | 0
 {formal => CodeSamples/formal}/data/plot.sh            | 2 --
 {formal => CodeSamples/formal}/data/rcu-test.dat       | 0
 formal/formal.tex                                      | 4 ++--
 5 files changed, 2 insertions(+), 5 deletions(-)
 rename {formal => CodeSamples/formal}/data/.gitignore (50%)
 rename {formal => CodeSamples/formal/data}/RCU-test-ratio.eps (100%)
 rename {formal => CodeSamples/formal}/data/plot.sh (96%)
 rename {formal => CodeSamples/formal}/data/rcu-test.dat (100%)

diff --git a/formal/data/.gitignore b/CodeSamples/formal/data/.gitignore
similarity index 50%
rename from formal/data/.gitignore
rename to CodeSamples/formal/data/.gitignore
index e307f160..a1363379 100644
--- a/formal/data/.gitignore
+++ b/CodeSamples/formal/data/.gitignore
@@ -1,2 +1 @@
-*.eps
 *.pdf
diff --git a/formal/RCU-test-ratio.eps b/CodeSamples/formal/data/RCU-test-ratio.eps
similarity index 100%
rename from formal/RCU-test-ratio.eps
rename to CodeSamples/formal/data/RCU-test-ratio.eps
diff --git a/formal/data/plot.sh b/CodeSamples/formal/data/plot.sh
similarity index 96%
rename from formal/data/plot.sh
rename to CodeSamples/formal/data/plot.sh
index dbda174c..ab74b753 100644
--- a/formal/data/plot.sh
+++ b/CodeSamples/formal/data/plot.sh
@@ -41,5 +41,3 @@ set style line 2 \
 plot 'rcu-test.dat' using 2 t "RCU", '' using 3:xticlabels(1) t "RCU Test", \
      '' using 5 with line linestyle 2 axis x1y2 t "\% Test"
 ---EOF---
-
-cp RCU-test-ratio.eps ../RCU-test-ratio.eps
diff --git a/formal/data/rcu-test.dat b/CodeSamples/formal/data/rcu-test.dat
similarity index 100%
rename from formal/data/rcu-test.dat
rename to CodeSamples/formal/data/rcu-test.dat
diff --git a/formal/formal.tex b/formal/formal.tex
index ba52da88..55a5ed98 100644
--- a/formal/formal.tex
+++ b/formal/formal.tex
@@ -318,9 +318,9 @@ can help reduce the cost of finding and fixing any bugs located.
 \begin{figure}
 \centering
 \IfEbookSize{
-\resizebox{\onecolumntextwidth}{!}{\includegraphics{formal/RCU-test-ratio.pdf}}
+\resizebox{\onecolumntextwidth}{!}{\includegraphics{CodeSamples/formal/data/RCU-test-ratio.pdf}}
 }{
-\resizebox{4.5in}{!}{\includegraphics{formal/RCU-test-ratio.pdf}}
+\resizebox{4.5in}{!}{\includegraphics{CodeSamples/formal/data/RCU-test-ratio.pdf}}
 }
 \caption{Linux-Kernel RCU Test Code}
 \label{fig:formal:Linux-Kernel RCU Test Code}
-- 
2.17.1



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

* [PATCH -perfbook 2/2] formal: Use symlink to .eps file under CodeSamples/formal/data
  2021-09-09  4:00 [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Akira Yokosawa
  2021-09-09  4:14 ` [PATCH -perfbook 1/2] formal: Move formal/data to CodeSamples/formal/data Akira Yokosawa
@ 2021-09-09  4:16 ` Akira Yokosawa
  2021-09-09 17:29 ` [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Paul E. McKenney
  2 siblings, 0 replies; 6+ messages in thread
From: Akira Yokosawa @ 2021-09-09  4:16 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

This is a preparatory change of planned reduction of conversions
from .eps to .pdf.
The goal is to exclude unused plots under CodeSamples/ from conversions
by a2ping.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 formal/RCU-test-ratio.eps | 1 +
 formal/formal.tex         | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 120000 formal/RCU-test-ratio.eps

diff --git a/formal/RCU-test-ratio.eps b/formal/RCU-test-ratio.eps
new file mode 120000
index 00000000..ebba3220
--- /dev/null
+++ b/formal/RCU-test-ratio.eps
@@ -0,0 +1 @@
+../CodeSamples/formal/data/RCU-test-ratio.eps
\ No newline at end of file
diff --git a/formal/formal.tex b/formal/formal.tex
index 55a5ed98..ba52da88 100644
--- a/formal/formal.tex
+++ b/formal/formal.tex
@@ -318,9 +318,9 @@ can help reduce the cost of finding and fixing any bugs located.
 \begin{figure}
 \centering
 \IfEbookSize{
-\resizebox{\onecolumntextwidth}{!}{\includegraphics{CodeSamples/formal/data/RCU-test-ratio.pdf}}
+\resizebox{\onecolumntextwidth}{!}{\includegraphics{formal/RCU-test-ratio.pdf}}
 }{
-\resizebox{4.5in}{!}{\includegraphics{CodeSamples/formal/data/RCU-test-ratio.pdf}}
+\resizebox{4.5in}{!}{\includegraphics{formal/RCU-test-ratio.pdf}}
 }
 \caption{Linux-Kernel RCU Test Code}
 \label{fig:formal:Linux-Kernel RCU Test Code}
-- 
2.17.1



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

* Re: [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data
  2021-09-09  4:00 [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Akira Yokosawa
  2021-09-09  4:14 ` [PATCH -perfbook 1/2] formal: Move formal/data to CodeSamples/formal/data Akira Yokosawa
  2021-09-09  4:16 ` [PATCH -perfbook 2/2] formal: Use symlink to .eps file under CodeSamples/formal/data Akira Yokosawa
@ 2021-09-09 17:29 ` Paul E. McKenney
  2021-09-09 22:31   ` Akira Yokosawa
  2 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2021-09-09 17:29 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Thu, Sep 09, 2021 at 01:00:03PM +0900, Akira Yokosawa wrote:
> Hi Paul,
> 
> So this patch set moves formal/data and formal/RCU-test-ratio.eps
> to CodeSamples/formal/data.
> 
> Patch 1/2 does the movement.
> Patch 2/2 puts symlink to the moved .eps file under formal/.
> 
> Actually, patch 2/2 is optional within the scope of this set.
> It presents an idea of organizing .eps files generated by gnuplot
> under CodeSamples/ so that redundant .eps -> .pdf conversions
> can be avoided.
> 
> Currently, I observe three ways to include gnuplot outputs.
> 
> 1) Copy generated .eps files manually to the relevant chapter's
> subdirectory (after running the plot script).
> 
> 2) Run a plot script under CodeSamples/ and the generated .eps
> files are automatically copied by commands in the script.
> 
> 3) Use paths of .pdf versions of .eps files under CodeSamples/...
> as the argument to the \includegraphics{} macros (no copying
> involved).
> 
> Most recent plots are managed by 3).

Good point!  I moved (partially, as you noted) to #3 in part because #1
and #2 make it annoying to work out where the generated .eps came from.

> However, to accommodate 3), a wildcard pattern in Makefile was
> extended to include deep subdirectories under CodeSamples/
> (commit 57b442c02db3 "Makefile: Extend wildcard pattern to catch
> .eps files under CodeSamples").
> So it now picks up a lot of unused older gnuplot plots, and causes
> redundant .eps -> .pdf conversions.

And you are right, that is definitely not a good thing.  And it just
gets worse over time as more data is regenerated.

> So, I suggest using symlink, e.g.,
> formal/xxx.eps -> CodeSamples/formal/data/xxx.eps, and remove
> CodeSamples/ from the wildcard pattern in Makefile.
> 
> That is, if it is OK to use symlink as in patch 2/2.

I would prefer to avoid quite that many symlinks.

> Another advantage of this idea is that it would be easier to
> find out where a particular gnuplot image is originated.

Exactly!  Both #3 and symlink do that.  In #3, you just look at the
latex for the figure, and with the symlink, just run "ls -l".

> By copying .eps files from CodeSamples/... to other directories,
> you lose such origin info.  This won't be a issue if there is a
> single .eps file of the same name under CodeSamples/, but this is
> not always the case.
> 
> Symlinks can retain their origins.
> 
> So, for example, when Zhouyi changed "rcu" to "RCU" in gnuplot
> generated plots (commit 2a2ca773005f "Change trace labels from
> "rcu" to "RCU""), he could have find out which scripts need
> updates more easily.
> 
> As a matter of fact, he failed to update .eps files
> under CodeSamples/.  For example:
> 
>     $ diff -u CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps defer/refRCUperfPREEMPT.eps
>     --- CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps	2021-08-12 13:48:28.580153786 +0900
>     +++ defer/refRCUperfPREEMPT.eps	2021-08-17 13:14:58.114517535 +0900
>     @@ -2209,7 +2209,7 @@
>      1.000 UP
>      LCb setrgbcolor
>      1729 1458 M
>     -[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (rcu)]
>     +[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (RCU)]
>      ] -33.3 MLshow
>      LCb setrgbcolor
>      1066 2212 M
> 
> If Patch 2/2 looks good to you, I'll do the changes along this idea
> and update the wildcard pattern in Makefile.

How about if I "git mv" the directories containing old data to some
name starting (say) with "OLD-", so that the hash.2013.12.02a directory
within CodeSamples/datastruct/hash/data becomes OLD-hash.2013.12.02a?
Then the Makefile could ignore .eps files in directories starting with
"OLD-"?  And yes, would probably be an annoying change to the Makefile.
The only way I know to do it is to automatically generate that portion
of the Makefile and include it.  :-/

Or is there a better way?

(For the moment, I will apply 1/2, and thank you!)

							Thanx, Paul

>         Thanks, Akira
> --
> Akira Yokosawa (2):
>   formal: Move formal/data to CodeSamples/formal/data
>   formal: Use symlink to .eps file under CodeSamples/formal/data
> 
>  .../formal}/data/.gitignore                   |    1 -
>  CodeSamples/formal/data/RCU-test-ratio.eps    | 4370 ++++++++++++++++
>  {formal => CodeSamples/formal}/data/plot.sh   |    2 -
>  .../formal}/data/rcu-test.dat                 |    0
>  formal/RCU-test-ratio.eps                     | 4371 +----------------
>  5 files changed, 4371 insertions(+), 4373 deletions(-)
>  rename {formal => CodeSamples/formal}/data/.gitignore (50%)
>  create mode 100644 CodeSamples/formal/data/RCU-test-ratio.eps
>  rename {formal => CodeSamples/formal}/data/plot.sh (96%)
>  rename {formal => CodeSamples/formal}/data/rcu-test.dat (100%)
>  mode change 100644 => 120000 formal/RCU-test-ratio.eps
> 
> -- 
> 2.17.1
> 

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

* Re: [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data
  2021-09-09 17:29 ` [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Paul E. McKenney
@ 2021-09-09 22:31   ` Akira Yokosawa
  2021-09-10  4:31     ` Paul E. McKenney
  0 siblings, 1 reply; 6+ messages in thread
From: Akira Yokosawa @ 2021-09-09 22:31 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

On Thu, 9 Sep 2021 10:29:52 -0700, Paul E. McKenney wrote:
> On Thu, Sep 09, 2021 at 01:00:03PM +0900, Akira Yokosawa wrote:
>> Hi Paul,
>>
>> So this patch set moves formal/data and formal/RCU-test-ratio.eps
>> to CodeSamples/formal/data.
>>
>> Patch 1/2 does the movement.
>> Patch 2/2 puts symlink to the moved .eps file under formal/.
>>
>> Actually, patch 2/2 is optional within the scope of this set.
>> It presents an idea of organizing .eps files generated by gnuplot
>> under CodeSamples/ so that redundant .eps -> .pdf conversions
>> can be avoided.
>>
>> Currently, I observe three ways to include gnuplot outputs.
>>
>> 1) Copy generated .eps files manually to the relevant chapter's
>> subdirectory (after running the plot script).
>>
>> 2) Run a plot script under CodeSamples/ and the generated .eps
>> files are automatically copied by commands in the script.
>>
>> 3) Use paths of .pdf versions of .eps files under CodeSamples/...
>> as the argument to the \includegraphics{} macros (no copying
>> involved).
>>
>> Most recent plots are managed by 3).
> 
> Good point!  I moved (partially, as you noted) to #3 in part because #1
> and #2 make it annoying to work out where the generated .eps came from.
> 
>> However, to accommodate 3), a wildcard pattern in Makefile was
>> extended to include deep subdirectories under CodeSamples/
>> (commit 57b442c02db3 "Makefile: Extend wildcard pattern to catch
>> .eps files under CodeSamples").
>> So it now picks up a lot of unused older gnuplot plots, and causes
>> redundant .eps -> .pdf conversions.
> 
> And you are right, that is definitely not a good thing.  And it just
> gets worse over time as more data is regenerated.
> 
>> So, I suggest using symlink, e.g.,
>> formal/xxx.eps -> CodeSamples/formal/data/xxx.eps, and remove
>> CodeSamples/ from the wildcard pattern in Makefile.
>>
>> That is, if it is OK to use symlink as in patch 2/2.
> 
> I would prefer to avoid quite that many symlinks.

I see.

> 
>> Another advantage of this idea is that it would be easier to
>> find out where a particular gnuplot image is originated.
> 
> Exactly!  Both #3 and symlink do that.  In #3, you just look at the
> latex for the figure, and with the symlink, just run "ls -l".
> 
>> By copying .eps files from CodeSamples/... to other directories,
>> you lose such origin info.  This won't be a issue if there is a
>> single .eps file of the same name under CodeSamples/, but this is
>> not always the case.
>>
>> Symlinks can retain their origins.
>>
>> So, for example, when Zhouyi changed "rcu" to "RCU" in gnuplot
>> generated plots (commit 2a2ca773005f "Change trace labels from
>> "rcu" to "RCU""), he could have find out which scripts need
>> updates more easily.
>>
>> As a matter of fact, he failed to update .eps files
>> under CodeSamples/.  For example:
>>
>>     $ diff -u CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps defer/refRCUperfPREEMPT.eps
>>     --- CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps	2021-08-12 13:48:28.580153786 +0900
>>     +++ defer/refRCUperfPREEMPT.eps	2021-08-17 13:14:58.114517535 +0900
>>     @@ -2209,7 +2209,7 @@
>>      1.000 UP
>>      LCb setrgbcolor
>>      1729 1458 M
>>     -[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (rcu)]
>>     +[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (RCU)]
>>      ] -33.3 MLshow
>>      LCb setrgbcolor
>>      1066 2212 M
>>
>> If Patch 2/2 looks good to you, I'll do the changes along this idea
>> and update the wildcard pattern in Makefile.
> 
> How about if I "git mv" the directories containing old data to some
> name starting (say) with "OLD-", so that the hash.2013.12.02a directory
> within CodeSamples/datastruct/hash/data becomes OLD-hash.2013.12.02a?
> Then the Makefile could ignore .eps files in directories starting with
> "OLD-"?  And yes, would probably be an annoying change to the Makefile.
> The only way I know to do it is to automatically generate that portion
> of the Makefile and include it.  :-/

I think gnu-make's wildcard function can contain the pattern of (say):

    CodeSamples/*/*/OLD-*/*.eps

This will match the .eps files under OLD-hash.2013.12.02a.
A few more additional patterns can make a list of .eps files to be
ignored.
Then the list of latest .eps files can be made by the "filter-out"
function.

So your idea should work without that annoying change to the
Makefile. 

Paul, please go ahead and "git mv" to the "OLD-" directories.

I will update the Makefile as a follow-up change.

        Thanks, Akira

> 
> Or is there a better way?
> 
> (For the moment, I will apply 1/2, and thank you!)
> 
> 							Thanx, Paul
> 
>>         Thanks, Akira
>> --
>> Akira Yokosawa (2):
>>   formal: Move formal/data to CodeSamples/formal/data
>>   formal: Use symlink to .eps file under CodeSamples/formal/data
>>
>>  .../formal}/data/.gitignore                   |    1 -
>>  CodeSamples/formal/data/RCU-test-ratio.eps    | 4370 ++++++++++++++++
>>  {formal => CodeSamples/formal}/data/plot.sh   |    2 -
>>  .../formal}/data/rcu-test.dat                 |    0
>>  formal/RCU-test-ratio.eps                     | 4371 +----------------
>>  5 files changed, 4371 insertions(+), 4373 deletions(-)
>>  rename {formal => CodeSamples/formal}/data/.gitignore (50%)
>>  create mode 100644 CodeSamples/formal/data/RCU-test-ratio.eps
>>  rename {formal => CodeSamples/formal}/data/plot.sh (96%)
>>  rename {formal => CodeSamples/formal}/data/rcu-test.dat (100%)
>>  mode change 100644 => 120000 formal/RCU-test-ratio.eps
>>
>> -- 
>> 2.17.1
>>

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

* Re: [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data
  2021-09-09 22:31   ` Akira Yokosawa
@ 2021-09-10  4:31     ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2021-09-10  4:31 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Fri, Sep 10, 2021 at 07:31:33AM +0900, Akira Yokosawa wrote:
> On Thu, 9 Sep 2021 10:29:52 -0700, Paul E. McKenney wrote:
> > On Thu, Sep 09, 2021 at 01:00:03PM +0900, Akira Yokosawa wrote:
> >> Hi Paul,
> >>
> >> So this patch set moves formal/data and formal/RCU-test-ratio.eps
> >> to CodeSamples/formal/data.
> >>
> >> Patch 1/2 does the movement.
> >> Patch 2/2 puts symlink to the moved .eps file under formal/.
> >>
> >> Actually, patch 2/2 is optional within the scope of this set.
> >> It presents an idea of organizing .eps files generated by gnuplot
> >> under CodeSamples/ so that redundant .eps -> .pdf conversions
> >> can be avoided.
> >>
> >> Currently, I observe three ways to include gnuplot outputs.
> >>
> >> 1) Copy generated .eps files manually to the relevant chapter's
> >> subdirectory (after running the plot script).
> >>
> >> 2) Run a plot script under CodeSamples/ and the generated .eps
> >> files are automatically copied by commands in the script.
> >>
> >> 3) Use paths of .pdf versions of .eps files under CodeSamples/...
> >> as the argument to the \includegraphics{} macros (no copying
> >> involved).
> >>
> >> Most recent plots are managed by 3).
> > 
> > Good point!  I moved (partially, as you noted) to #3 in part because #1
> > and #2 make it annoying to work out where the generated .eps came from.
> > 
> >> However, to accommodate 3), a wildcard pattern in Makefile was
> >> extended to include deep subdirectories under CodeSamples/
> >> (commit 57b442c02db3 "Makefile: Extend wildcard pattern to catch
> >> .eps files under CodeSamples").
> >> So it now picks up a lot of unused older gnuplot plots, and causes
> >> redundant .eps -> .pdf conversions.
> > 
> > And you are right, that is definitely not a good thing.  And it just
> > gets worse over time as more data is regenerated.
> > 
> >> So, I suggest using symlink, e.g.,
> >> formal/xxx.eps -> CodeSamples/formal/data/xxx.eps, and remove
> >> CodeSamples/ from the wildcard pattern in Makefile.
> >>
> >> That is, if it is OK to use symlink as in patch 2/2.
> > 
> > I would prefer to avoid quite that many symlinks.
> 
> I see.
> 
> > 
> >> Another advantage of this idea is that it would be easier to
> >> find out where a particular gnuplot image is originated.
> > 
> > Exactly!  Both #3 and symlink do that.  In #3, you just look at the
> > latex for the figure, and with the symlink, just run "ls -l".
> > 
> >> By copying .eps files from CodeSamples/... to other directories,
> >> you lose such origin info.  This won't be a issue if there is a
> >> single .eps file of the same name under CodeSamples/, but this is
> >> not always the case.
> >>
> >> Symlinks can retain their origins.
> >>
> >> So, for example, when Zhouyi changed "rcu" to "RCU" in gnuplot
> >> generated plots (commit 2a2ca773005f "Change trace labels from
> >> "rcu" to "RCU""), he could have find out which scripts need
> >> updates more easily.
> >>
> >> As a matter of fact, he failed to update .eps files
> >> under CodeSamples/.  For example:
> >>
> >>     $ diff -u CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps defer/refRCUperfPREEMPT.eps
> >>     --- CodeSamples/defer/data/rcuscale.hps.2020.05.28a/refRCUperfPREEMPT.eps	2021-08-12 13:48:28.580153786 +0900
> >>     +++ defer/refRCUperfPREEMPT.eps	2021-08-17 13:14:58.114517535 +0900
> >>     @@ -2209,7 +2209,7 @@
> >>      1.000 UP
> >>      LCb setrgbcolor
> >>      1729 1458 M
> >>     -[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (rcu)]
> >>     +[ [(NimbusSanL-Regu) 100.0 0.0 true true 0 (RCU)]
> >>      ] -33.3 MLshow
> >>      LCb setrgbcolor
> >>      1066 2212 M
> >>
> >> If Patch 2/2 looks good to you, I'll do the changes along this idea
> >> and update the wildcard pattern in Makefile.
> > 
> > How about if I "git mv" the directories containing old data to some
> > name starting (say) with "OLD-", so that the hash.2013.12.02a directory
> > within CodeSamples/datastruct/hash/data becomes OLD-hash.2013.12.02a?
> > Then the Makefile could ignore .eps files in directories starting with
> > "OLD-"?  And yes, would probably be an annoying change to the Makefile.
> > The only way I know to do it is to automatically generate that portion
> > of the Makefile and include it.  :-/
> 
> I think gnu-make's wildcard function can contain the pattern of (say):
> 
>     CodeSamples/*/*/OLD-*/*.eps
> 
> This will match the .eps files under OLD-hash.2013.12.02a.
> A few more additional patterns can make a list of .eps files to be
> ignored.
> Then the list of latest .eps files can be made by the "filter-out"
> function.
> 
> So your idea should work without that annoying change to the
> Makefile. 

Even better!

> Paul, please go ahead and "git mv" to the "OLD-" directories.

I have done those in CodeSamples/datastruct/hash/data.  Does that one
work the way that you had in mind?

> I will update the Makefile as a follow-up change.

Sounds good -- if the first commit looks good to you, I will do the rest.

f891fa5c6e8b ("datastruct/hash: Mark directories of unused data")

							Thanx, Paul

>         Thanks, Akira
> 
> > 
> > Or is there a better way?
> > 
> > (For the moment, I will apply 1/2, and thank you!)
> > 
> > 							Thanx, Paul
> > 
> >>         Thanks, Akira
> >> --
> >> Akira Yokosawa (2):
> >>   formal: Move formal/data to CodeSamples/formal/data
> >>   formal: Use symlink to .eps file under CodeSamples/formal/data
> >>
> >>  .../formal}/data/.gitignore                   |    1 -
> >>  CodeSamples/formal/data/RCU-test-ratio.eps    | 4370 ++++++++++++++++
> >>  {formal => CodeSamples/formal}/data/plot.sh   |    2 -
> >>  .../formal}/data/rcu-test.dat                 |    0
> >>  formal/RCU-test-ratio.eps                     | 4371 +----------------
> >>  5 files changed, 4371 insertions(+), 4373 deletions(-)
> >>  rename {formal => CodeSamples/formal}/data/.gitignore (50%)
> >>  create mode 100644 CodeSamples/formal/data/RCU-test-ratio.eps
> >>  rename {formal => CodeSamples/formal}/data/plot.sh (96%)
> >>  rename {formal => CodeSamples/formal}/data/rcu-test.dat (100%)
> >>  mode change 100644 => 120000 formal/RCU-test-ratio.eps
> >>
> >> -- 
> >> 2.17.1
> >>

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

end of thread, other threads:[~2021-09-10  4:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09  4:00 [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Akira Yokosawa
2021-09-09  4:14 ` [PATCH -perfbook 1/2] formal: Move formal/data to CodeSamples/formal/data Akira Yokosawa
2021-09-09  4:16 ` [PATCH -perfbook 2/2] formal: Use symlink to .eps file under CodeSamples/formal/data Akira Yokosawa
2021-09-09 17:29 ` [PATCH -perfbook 0/2] formal: Move data dir to CodeSamples/fomral/data Paul E. McKenney
2021-09-09 22:31   ` Akira Yokosawa
2021-09-10  4:31     ` Paul E. McKenney

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.