Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
* [PATCH] formal/regression: Tweak table format and indent in listing
@ 2017-10-29 15:44 Akira Yokosawa
  2017-10-29 18:22 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Akira Yokosawa @ 2017-10-29 15:44 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 729f4ef5e8116d8a61b56d0f2a86d005f354ac59 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 30 Oct 2017 00:27:49 +0900
Subject: [PATCH] formal/regression: Tweak table format and indent in listing

Use "S" column specifier in tables containing time duration.

Remove vertical and horizontal rules in scorecard. Instead,
add narrow skips between colored cells by adding empty columns
in between and reducing \tabcolsep length locally in the table.
\addlinespace is a booktabs' command to add vertical space between
rows.

Substitute two white spaces for TAB characters in "verbbox" for
proper indentation.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 formal/regression.tex | 133 ++++++++++++++++++++++++++------------------------
 1 file changed, 69 insertions(+), 64 deletions(-)

diff --git a/formal/regression.tex b/formal/regression.tex
index 0d464b1..9e564f7 100644
--- a/formal/regression.tex
+++ b/formal/regression.tex
@@ -174,24 +174,24 @@ C C-SB+l-o-o-u+l-o-o-u-C

 P0(int *sl, int *x0, int *x1)
 {
-	int r2;
-	int r1;
+  int r2;
+  int r1;

-	r2 = cmpxchg_acquire(sl, 0, 1);
-	WRITE_ONCE(*x0, 1);
-	r1 = READ_ONCE(*x1);
-	smp_store_release(sl, 0);
+  r2 = cmpxchg_acquire(sl, 0, 1);
+  WRITE_ONCE(*x0, 1);
+  r1 = READ_ONCE(*x1);
+  smp_store_release(sl, 0);
 }

 P1(int *sl, int *x0, int *x1)
 {
-	int r2;
-	int r1;
+  int r2;
+  int r1;

-	r2 = cmpxchg_acquire(sl, 0, 1);
-	WRITE_ONCE(*x1, 1);
-	r1 = READ_ONCE(*x0);
-	smp_store_release(sl, 0);
+  r2 = cmpxchg_acquire(sl, 0, 1);
+  WRITE_ONCE(*x1, 1);
+  r1 = READ_ONCE(*x0);
+  smp_store_release(sl, 0);
 }

 filter (0:r2=0 /\ 1:r2=0)
@@ -205,14 +205,15 @@ exists (0:r1=0 /\ 1:r1=0)
 \end{listing}

 \begin{table}[tbh]
-\rowcolors{6}{}{lightgray}
+\rowcolors{1}{}{lightgray}
 \renewcommand*{\arraystretch}{1.1}
 \small
-\centering\OneColumnHSpace{-0.1in}
-\begin{tabular}{rrr}
+\centering
+\begin{tabular}{S[table-format=1.0]S[table-format=1.3]S[table-format=2.3]}
 	\toprule
-	\# Threads & Locking & \tco{cmpxchg_acquire} \\
-	\cmidrule{1-1} \cmidrule{2-2} \cmidrule{3-3}
+	\multicolumn{1}{c}{\# Threads} & \multicolumn{1}{c}{Locking} &
+			\multicolumn{1}{c}{\tco{cmpxchg_acquire}} \\
+	\midrule
 	2 & 0.004 &  0.022 \\
 	3 & 0.041 &  0.743 \\
 	4 & 0.374 & 59.565 \\
@@ -250,19 +251,22 @@ is more than two orders of magnitude faster than emulation!
 	the \co{exists} clause, which provides significant speedups.

 \begin{table}[tbh]
-\rowcolors{6}{}{lightgray}
+\rowcolors{7}{lightgray}{}
 \renewcommand*{\arraystretch}{1.1}
 \small
-\centering\OneColumnHSpace{-0.1in}
-\begin{tabular}{rrrrrr}
+\centering
+\begin{tabular}{S[table-format=1.0]S[table-format=1.3]S[table-format=2.3]
+		S[table-format=3.3]S[table-format=2.3]S[table-format=3.3]}
 	\toprule
 	& & \multicolumn{2}{c}{\tco{cmpxchg_acquire}}
 		& \multicolumn{2}{c}{\tco{xchg_acquire}} \\
 	\cmidrule(l){3-4} \cmidrule(l){5-6}
-	\# & Locking & \tco{filter} & \tco{exists}
-		& \tco{filter} & \tco{exists} \\
-	\cmidrule(l){1-1} \cmidrule(l){2-2} \cmidrule(l){3-3} \cmidrule(l){4-4}
-		\cmidrule(l){5-5} \cmidrule(l){6-6}
+	\multicolumn{1}{c}{\#} & \multicolumn{1}{c}{Locking}
+		& \multicolumn{1}{c}{\tco{filter}}
+			& \multicolumn{1}{c}{\tco{exists}}
+				& \multicolumn{1}{c}{\tco{filter}}
+					& \multicolumn{1}{c}{\tco{exists}} \\
+	\cmidrule{1-1} \cmidrule(l){2-2} \cmidrule(l){3-4} \cmidrule(l){5-6}
 	2 & 0.004 &  0.022 &   0.039 &  0.027 &  0.058 \\
 	3 & 0.041 &  0.743 &   1.653 &  0.968 &  3.203 \\
 	4 & 0.374 & 59.565 & 151.962 & 74.818 & 500.96 \\
@@ -400,53 +404,54 @@ required if we are to actually increase software reliability.

 \begin{table*}[tbh]
 % \rowcolors{6}{}{lightgray}
-\renewcommand*{\arraystretch}{1.1}
+%\renewcommand*{\arraystretch}{1.1}
 \small
-\centering\OneColumnHSpace{-0.1in}
-\begin{tabular}{l|c|c|c|c|c}
+\centering
+\setlength{\tabcolsep}{2pt}
+\begin{tabular}{lcccccccccc}
 	\toprule
-	& Promela & PPCMEM & \tco{herd} & \tco{cbmc} & Nidhugg \\
-	\hline
-	(1) Automated
-		& \cellcolor{red!50}
-			& \cellcolor{orange!50}
-				& \cellcolor{orange!50}
-					& \cellcolor{blue!50}
+	& & Promela & & PPCMEM & & \tco{herd} & & \tco{cbmc} & & Nidhugg \\
+	\midrule
+	(1) Automated &
+		& \cellcolor{red!50} &
+			& \cellcolor{orange!50} &
+				& \cellcolor{orange!50} &
+					& \cellcolor{blue!50} &
 						& \cellcolor{blue!50} \\
-	\hline
-	(2) Environment
-		& \cellcolor{red!50} (MM)
-			& \cellcolor{green!50}
-				& \cellcolor{blue!50}
-					& \cellcolor{yellow!50} (MM)
+	\addlinespace[3pt]
+	(2) Environment &
+		& \cellcolor{red!50} (MM) &
+			& \cellcolor{green!50} &
+				& \cellcolor{blue!50} &
+					& \cellcolor{yellow!50} (MM) &
 						& \cellcolor{orange!50} (MM) \\
-	\hline
-	(3) Overhead
-		& \cellcolor{yellow!50}
-			& \cellcolor{red!50}
-				& \cellcolor{yellow!50}
-					& \cellcolor{yellow!50} (SAT)
+	\addlinespace[3pt]
+	(3) Overhead &
+		& \cellcolor{yellow!50} &
+			& \cellcolor{red!50} &
+				& \cellcolor{yellow!50} &
+					& \cellcolor{yellow!50} (SAT) &
 						& \cellcolor{green!50} \\
-	\hline
-	(4) Locate Bugs
-		& \cellcolor{yellow!50}
-			& \cellcolor{yellow!50}
-				& \cellcolor{yellow!50}
-					& \cellcolor{green!50}
+	\addlinespace[3pt]
+	(4) Locate Bugs &
+		& \cellcolor{yellow!50} &
+			& \cellcolor{yellow!50} &
+				& \cellcolor{yellow!50} &
+					& \cellcolor{green!50} &
 						& \cellcolor{green!50} \\
-	\hline
-	(5) Minimal Scaffolding
-		& \cellcolor{green!50}
-			& \cellcolor{yellow!50}
-				& \cellcolor{yellow!50}
-					& \cellcolor{blue!50}
+	\addlinespace[3pt]
+	(5) Minimal Scaffolding &
+		& \cellcolor{green!50} &
+			& \cellcolor{yellow!50} &
+				& \cellcolor{yellow!50} &
+					& \cellcolor{blue!50} &
 						& \cellcolor{blue!50} \\
-	\hline
-	(6) Relevant Bugs
-		& \cellcolor{yellow!50} ???
-			& \cellcolor{yellow!50} ???
-				& \cellcolor{yellow!50} ???
-					& \cellcolor{yellow!50} ???
+	\addlinespace[3pt]
+	(6) Relevant Bugs &
+		& \cellcolor{yellow!50} ??? &
+			& \cellcolor{yellow!50} ??? &
+				& \cellcolor{yellow!50} ??? &
+					& \cellcolor{yellow!50} ??? &
 						& \cellcolor{yellow!50} ??? \\
 	\bottomrule
 \end{tabular}
-- 
2.7.4


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

* Re: [PATCH] formal/regression: Tweak table format and indent in listing
  2017-10-29 15:44 [PATCH] formal/regression: Tweak table format and indent in listing Akira Yokosawa
@ 2017-10-29 18:22 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2017-10-29 18:22 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Mon, Oct 30, 2017 at 12:44:48AM +0900, Akira Yokosawa wrote:
> >From 729f4ef5e8116d8a61b56d0f2a86d005f354ac59 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Mon, 30 Oct 2017 00:27:49 +0900
> Subject: [PATCH] formal/regression: Tweak table format and indent in listing
> 
> Use "S" column specifier in tables containing time duration.
> 
> Remove vertical and horizontal rules in scorecard. Instead,
> add narrow skips between colored cells by adding empty columns
> in between and reducing \tabcolsep length locally in the table.
> \addlinespace is a booktabs' command to add vertical space between
> rows.
> 
> Substitute two white spaces for TAB characters in "verbbox" for
> proper indentation.
> 
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>

-Much- better, thank you!!!  Applied and pushed.

							Thanx, Paul

> ---
>  formal/regression.tex | 133 ++++++++++++++++++++++++++------------------------
>  1 file changed, 69 insertions(+), 64 deletions(-)
> 
> diff --git a/formal/regression.tex b/formal/regression.tex
> index 0d464b1..9e564f7 100644
> --- a/formal/regression.tex
> +++ b/formal/regression.tex
> @@ -174,24 +174,24 @@ C C-SB+l-o-o-u+l-o-o-u-C
> 
>  P0(int *sl, int *x0, int *x1)
>  {
> -	int r2;
> -	int r1;
> +  int r2;
> +  int r1;
> 
> -	r2 = cmpxchg_acquire(sl, 0, 1);
> -	WRITE_ONCE(*x0, 1);
> -	r1 = READ_ONCE(*x1);
> -	smp_store_release(sl, 0);
> +  r2 = cmpxchg_acquire(sl, 0, 1);
> +  WRITE_ONCE(*x0, 1);
> +  r1 = READ_ONCE(*x1);
> +  smp_store_release(sl, 0);
>  }
> 
>  P1(int *sl, int *x0, int *x1)
>  {
> -	int r2;
> -	int r1;
> +  int r2;
> +  int r1;
> 
> -	r2 = cmpxchg_acquire(sl, 0, 1);
> -	WRITE_ONCE(*x1, 1);
> -	r1 = READ_ONCE(*x0);
> -	smp_store_release(sl, 0);
> +  r2 = cmpxchg_acquire(sl, 0, 1);
> +  WRITE_ONCE(*x1, 1);
> +  r1 = READ_ONCE(*x0);
> +  smp_store_release(sl, 0);
>  }
> 
>  filter (0:r2=0 /\ 1:r2=0)
> @@ -205,14 +205,15 @@ exists (0:r1=0 /\ 1:r1=0)
>  \end{listing}
> 
>  \begin{table}[tbh]
> -\rowcolors{6}{}{lightgray}
> +\rowcolors{1}{}{lightgray}
>  \renewcommand*{\arraystretch}{1.1}
>  \small
> -\centering\OneColumnHSpace{-0.1in}
> -\begin{tabular}{rrr}
> +\centering
> +\begin{tabular}{S[table-format=1.0]S[table-format=1.3]S[table-format=2.3]}
>  	\toprule
> -	\# Threads & Locking & \tco{cmpxchg_acquire} \\
> -	\cmidrule{1-1} \cmidrule{2-2} \cmidrule{3-3}
> +	\multicolumn{1}{c}{\# Threads} & \multicolumn{1}{c}{Locking} &
> +			\multicolumn{1}{c}{\tco{cmpxchg_acquire}} \\
> +	\midrule
>  	2 & 0.004 &  0.022 \\
>  	3 & 0.041 &  0.743 \\
>  	4 & 0.374 & 59.565 \\
> @@ -250,19 +251,22 @@ is more than two orders of magnitude faster than emulation!
>  	the \co{exists} clause, which provides significant speedups.
> 
>  \begin{table}[tbh]
> -\rowcolors{6}{}{lightgray}
> +\rowcolors{7}{lightgray}{}
>  \renewcommand*{\arraystretch}{1.1}
>  \small
> -\centering\OneColumnHSpace{-0.1in}
> -\begin{tabular}{rrrrrr}
> +\centering
> +\begin{tabular}{S[table-format=1.0]S[table-format=1.3]S[table-format=2.3]
> +		S[table-format=3.3]S[table-format=2.3]S[table-format=3.3]}
>  	\toprule
>  	& & \multicolumn{2}{c}{\tco{cmpxchg_acquire}}
>  		& \multicolumn{2}{c}{\tco{xchg_acquire}} \\
>  	\cmidrule(l){3-4} \cmidrule(l){5-6}
> -	\# & Locking & \tco{filter} & \tco{exists}
> -		& \tco{filter} & \tco{exists} \\
> -	\cmidrule(l){1-1} \cmidrule(l){2-2} \cmidrule(l){3-3} \cmidrule(l){4-4}
> -		\cmidrule(l){5-5} \cmidrule(l){6-6}
> +	\multicolumn{1}{c}{\#} & \multicolumn{1}{c}{Locking}
> +		& \multicolumn{1}{c}{\tco{filter}}
> +			& \multicolumn{1}{c}{\tco{exists}}
> +				& \multicolumn{1}{c}{\tco{filter}}
> +					& \multicolumn{1}{c}{\tco{exists}} \\
> +	\cmidrule{1-1} \cmidrule(l){2-2} \cmidrule(l){3-4} \cmidrule(l){5-6}
>  	2 & 0.004 &  0.022 &   0.039 &  0.027 &  0.058 \\
>  	3 & 0.041 &  0.743 &   1.653 &  0.968 &  3.203 \\
>  	4 & 0.374 & 59.565 & 151.962 & 74.818 & 500.96 \\
> @@ -400,53 +404,54 @@ required if we are to actually increase software reliability.
> 
>  \begin{table*}[tbh]
>  % \rowcolors{6}{}{lightgray}
> -\renewcommand*{\arraystretch}{1.1}
> +%\renewcommand*{\arraystretch}{1.1}
>  \small
> -\centering\OneColumnHSpace{-0.1in}
> -\begin{tabular}{l|c|c|c|c|c}
> +\centering
> +\setlength{\tabcolsep}{2pt}
> +\begin{tabular}{lcccccccccc}
>  	\toprule
> -	& Promela & PPCMEM & \tco{herd} & \tco{cbmc} & Nidhugg \\
> -	\hline
> -	(1) Automated
> -		& \cellcolor{red!50}
> -			& \cellcolor{orange!50}
> -				& \cellcolor{orange!50}
> -					& \cellcolor{blue!50}
> +	& & Promela & & PPCMEM & & \tco{herd} & & \tco{cbmc} & & Nidhugg \\
> +	\midrule
> +	(1) Automated &
> +		& \cellcolor{red!50} &
> +			& \cellcolor{orange!50} &
> +				& \cellcolor{orange!50} &
> +					& \cellcolor{blue!50} &
>  						& \cellcolor{blue!50} \\
> -	\hline
> -	(2) Environment
> -		& \cellcolor{red!50} (MM)
> -			& \cellcolor{green!50}
> -				& \cellcolor{blue!50}
> -					& \cellcolor{yellow!50} (MM)
> +	\addlinespace[3pt]
> +	(2) Environment &
> +		& \cellcolor{red!50} (MM) &
> +			& \cellcolor{green!50} &
> +				& \cellcolor{blue!50} &
> +					& \cellcolor{yellow!50} (MM) &
>  						& \cellcolor{orange!50} (MM) \\
> -	\hline
> -	(3) Overhead
> -		& \cellcolor{yellow!50}
> -			& \cellcolor{red!50}
> -				& \cellcolor{yellow!50}
> -					& \cellcolor{yellow!50} (SAT)
> +	\addlinespace[3pt]
> +	(3) Overhead &
> +		& \cellcolor{yellow!50} &
> +			& \cellcolor{red!50} &
> +				& \cellcolor{yellow!50} &
> +					& \cellcolor{yellow!50} (SAT) &
>  						& \cellcolor{green!50} \\
> -	\hline
> -	(4) Locate Bugs
> -		& \cellcolor{yellow!50}
> -			& \cellcolor{yellow!50}
> -				& \cellcolor{yellow!50}
> -					& \cellcolor{green!50}
> +	\addlinespace[3pt]
> +	(4) Locate Bugs &
> +		& \cellcolor{yellow!50} &
> +			& \cellcolor{yellow!50} &
> +				& \cellcolor{yellow!50} &
> +					& \cellcolor{green!50} &
>  						& \cellcolor{green!50} \\
> -	\hline
> -	(5) Minimal Scaffolding
> -		& \cellcolor{green!50}
> -			& \cellcolor{yellow!50}
> -				& \cellcolor{yellow!50}
> -					& \cellcolor{blue!50}
> +	\addlinespace[3pt]
> +	(5) Minimal Scaffolding &
> +		& \cellcolor{green!50} &
> +			& \cellcolor{yellow!50} &
> +				& \cellcolor{yellow!50} &
> +					& \cellcolor{blue!50} &
>  						& \cellcolor{blue!50} \\
> -	\hline
> -	(6) Relevant Bugs
> -		& \cellcolor{yellow!50} ???
> -			& \cellcolor{yellow!50} ???
> -				& \cellcolor{yellow!50} ???
> -					& \cellcolor{yellow!50} ???
> +	\addlinespace[3pt]
> +	(6) Relevant Bugs &
> +		& \cellcolor{yellow!50} ??? &
> +			& \cellcolor{yellow!50} ??? &
> +				& \cellcolor{yellow!50} ??? &
> +					& \cellcolor{yellow!50} ??? &
>  						& \cellcolor{yellow!50} ??? \\
>  	\bottomrule
>  \end{tabular}
> -- 
> 2.7.4
> 


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

end of thread, other threads:[~2017-10-29 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-29 15:44 [PATCH] formal/regression: Tweak table format and indent in listing Akira Yokosawa
2017-10-29 18:22 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox