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 > >>