Difference between revisions of "File:Kernel patches stats.png"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Kir uploaded a new version of "File:Kernel patches stats.png": better labels)
(Source code: updated the scripts)
Line 13: Line 13:
 
<small><source lang="bash">
 
<small><source lang="bash">
 
#!/bin/sh
 
#!/bin/sh
+
 
 
# Whose patches to count
 
# Whose patches to count
PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|adobriyan@|kuznet@'
+
#PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|kuznet@'
+
#PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|adobriyan@|kuznet@|gorcunov@'
 +
PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|kuznet@|gorcunov@'
 +
 
 
# Return the date of the given tag, in a format usable by gnuplot
 
# Return the date of the given tag, in a format usable by gnuplot
 
get_tag_date() {
 
get_tag_date() {
Line 23: Line 25:
 
sed 's/ ..:..:..//' | sed 's/ /-/g'
 
sed 's/ ..:..:..//' | sed 's/ /-/g'
 
}
 
}
+
 
 
# Count the number of patches whose authors match $PAT,
 
# Count the number of patches whose authors match $PAT,
 
# for the period between two given git tags
 
# for the period between two given git tags
Line 30: Line 32:
 
egrep '^Author: ' | egrep $PAT | wc -l
 
egrep '^Author: ' | egrep $PAT | wc -l
 
}
 
}
+
 
# Old 2.6 kernel branch
+
count_total_patches() {
# We start from 2.6.12 -- the first kernel available in git
+
git log --pretty=short --no-merges $1..$2 | grep -c '^commit '
# and end on 2.6.39 -- the last kernel on 2.6 branch
+
}
for f in $(seq 13 39); do
+
 
v1=v2.6.$((f-1))
+
# Latest 3.x kernel
d1=$(get_tag_date $v1)
+
#latest3=$(git tag | grep -v -- -rc | tail -n1 | sed -e 's/^.*\.\(.*\)$/\1/')
if [ $f -gt 39 ]; then
+
latest3=$(git tag | grep -v -- -rc | grep -F 'v3.' | \
v2=$HEAD
+
awk -F . '{print $2}' | sort -n | tail -n1)
else
+
# Latest 2.6.x kernel
v2=v2.6.$f
+
latest26=39
fi
+
 
d2=$(get_tag_date $v2)
 
count=$(count_patches $v1 $v2)
 
if test "$count" -gt 0; then
 
echo $d2 $v2 " " $count
 
fi
 
 
done | sed 's/ /\t/g'
 
 
# New 3.x kernel branch
 
# Transition: patches from 2.6.39 to 3.0
 
d2=$(get_tag_date v3.0)
 
count=$(count_patches v2.6.39 v3.0)
 
echo $d2 "v3.0" " " $count | sed 's/ /\t/g'
 
 
# What is the latest kernel patch number in 3.x
 
latest=$(git tag | grep -v -- -rc | tail -n1 | sed -e 's/^.*\.\(.*\)$/\1/')
 
 
 
# Find out if number of patches for HEAD is much more
 
# Find out if number of patches for HEAD is much more
# than for latest -rc. If yes, use HEAD, otherwise -rc.
+
# than for latest -rc. If yes, use HEAD, otherwise -rc.:
last_rc=$(git tag | tail -n 1 | grep -- -rc)
+
last_rc=$(git describe --abbrev=0)
 
HEAD=$last_rc
 
HEAD=$last_rc
 
if ! test -z "$last_rc"; then
 
if ! test -z "$last_rc"; then
much_more=15
+
much_more=10
count_head=$(count_patches v3.$latest HEAD)
+
count_head=$(count_patches v3.$latest3 HEAD)
count_rc=$(count_patches v3.$latest $last_rc)
+
count_rc=$(count_patches v3.$latest3 $last_rc)
 
if test $count_head -gt $((count_rc+much_more)); then
 
if test $count_head -gt $((count_rc+much_more)); then
 
HEAD="HEAD  "
 
HEAD="HEAD  "
 
fi
 
fi
 
fi
 
fi
+
 
# We start from 3.0
+
pv=''
for f in $(seq 1 $((latest+1))); do
+
for v in $(git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |\
v1=v3.$((f-1))
+
grep -v -E -- '-rc|-tree|v2.6.11') HEAD; do
d1=$(get_tag_date $v1)
+
if [ -z "$pv" ]; then
if [ $f -gt $latest ]; then
+
pv=$v
v2=$HEAD
+
continue
else
 
v2=v3.$f
 
 
fi
 
fi
d2=$(get_tag_date $v2)
+
 
count=$(count_patches $v1 $v2)
+
pd=$(get_tag_date $pv)
if test "$count" -gt 0; then
+
d=$(get_tag_date $v)
echo $d2 $v2 " " $count
+
count_ours=$(count_patches $pv $v)
 +
count_total=$(count_total_patches $pv $v)
 +
if test "$count_ours" -gt 0; then
 +
echo $d $v " " $count_ours $count_total
 
fi
 
fi
+
pv=$v
 
done | sed 's/ /\t/g'
 
done | sed 's/ /\t/g'
 
</source></small>
 
</source></small>
Line 95: Line 81:
 
<small><source lang="bash">
 
<small><source lang="bash">
 
#!/bin/sh
 
#!/bin/sh
 +
 +
REPO=~/git/linux/.git
 +
COUNT=$(pwd)/count
 +
OUT=$(pwd)/time.dat
 +
export GDFONTPATH=/usr/share/fonts/microsoft
 +
export GIT_DIR=$REPO
  
 
if test "$1" != "-f"; then
 
if test "$1" != "-f"; then
git checkout master
+
echo "== Previous (old) stats =="
git pull
+
tail -n 2 $OUT
sh count > time.dat
+
# Update the repo and count new stats
 +
(cd $REPO && cd .. && git pull) && sh $COUNT > $OUT
 +
echo "== New stats =="
 +
tail -n 2 $OUT
 
fi
 
fi
  
DATE=$(tail -n 1 time.dat | cut -f 1 | awk -F- '{print $2,$1,$3}')
+
DATE=$(tail -n 1 $OUT | cut -f 1 | awk -F- '{print $2,$1,$3}')
MAXY=$(awk 'BEGIN {max=0}; ($3 > max) {max=$3}; END {print max+50}' < time.dat)
+
MAXY=$(awk 'BEGIN {max=0}; ($3 > max) {max=$3}; END {print max+80}' < time.dat)
 
# GNU date is powerful!
 
# GNU date is powerful!
 
MAXX=$(date +%b-1-%Y --date='+2 months')
 
MAXX=$(date +%b-1-%Y --date='+2 months')
  
export GDFONTPATH=/usr/share/fonts/msttcorefonts/
 
 
cat << EOF | gnuplot > plot.png
 
cat << EOF | gnuplot > plot.png
set terminal png enhanced font "verdanab,20" size 1600,1200
+
set terminal png enhanced font "verdana,13" size 1600,1200
#set terminal png enhanced transparent font "verdanab,14" size 1200,600
+
 
#set terminal svg enhanced font "verdanab,8" size 800,600
 
  
 
set title "OpenVZ team kernel patches progress as of ${DATE}"
 
set title "OpenVZ team kernel patches progress as of ${DATE}"
Line 129: Line 122:
 
set ytics nomirror # no tics at right
 
set ytics nomirror # no tics at right
  
plot 'time.dat' using 1:3 with linespoints pt 6 ps 1 lw 2 lt 2 notitle, \
+
plot '${OUT}' using 1:3 with linespoints pt 6 ps 1 lw 2 lt 2 notitle, \
'' using 1:3:2 with labels left offset 0,1 rotate notitle, \
+
'' using 1:3:2 with labels left offset 0,5.5 rotate notitle, \
 
'' using 1:3:3 with labels left offset 0.7,0 notitle
 
'' using 1:3:3 with labels left offset 0.7,0 notitle
  
 
EOF
 
EOF
 
</source></small>
 
</source></small>

Revision as of 03:30, 24 March 2014


Description

This graph shows how many patches from OpenVZ developers were merged into mainstream Linux kernel, per each kernel version.

It is drawn by gnuplot using the data set obtained from kernel git repository.

Source code

Collect data

Here is the script to produce the data for the graph, called count:

#!/bin/sh

# Whose patches to count
#PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|kuznet@'
#PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|adobriyan@|kuznet@|gorcunov@'
PAT='@openvz.org|@parallels.com|@sw.ru|@swsoft.com|@sw.com.sg|kuznet@|gorcunov@'

# Return the date of the given tag, in a format usable by gnuplot
get_tag_date() {
	echo $(git show $1 | egrep ^Date: | head -n1) | 
		sed 's/^Date: ... \(.*\) [-+]....$/\1/' |
		sed 's/ ..:..:..//' | sed 's/ /-/g'
}

# Count the number of patches whose authors match $PAT,
# for the period between two given git tags
count_patches() {
	git log --pretty=short --no-merges $1..$2 |
		egrep '^Author: ' | egrep $PAT | wc -l
}

count_total_patches() {
	git log --pretty=short --no-merges $1..$2 | grep -c '^commit '
}

# Latest 3.x kernel
#latest3=$(git tag | grep -v -- -rc | tail -n1 | sed -e 's/^.*\.\(.*\)$/\1/')
latest3=$(git tag | grep -v -- -rc | grep -F 'v3.' | \
		awk -F . '{print $2}' | sort -n | tail -n1)
# Latest 2.6.x kernel
latest26=39

# Find out if number of patches for HEAD is much more
# than for latest -rc. If yes, use HEAD, otherwise -rc.:
last_rc=$(git describe --abbrev=0)
HEAD=$last_rc
if ! test -z "$last_rc"; then
	much_more=10
	count_head=$(count_patches v3.$latest3 HEAD)
	count_rc=$(count_patches v3.$latest3 $last_rc)
	if test $count_head -gt $((count_rc+much_more)); then
		HEAD="HEAD   "
	fi
fi

pv=''
for v in $(git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |\
		 grep -v -E -- '-rc|-tree|v2.6.11') HEAD; do
	if [ -z "$pv" ]; then
		pv=$v
		continue
	fi

	pd=$(get_tag_date $pv)
	d=$(get_tag_date $v)
	count_ours=$(count_patches $pv $v)
	count_total=$(count_total_patches $pv $v)
	if test "$count_ours" -gt 0; then
		echo $d $v " " $count_ours $count_total
	fi
	pv=$v
done | sed 's/ /\t/g'

Draw the graph

Here is the script to produce the graph. Note it calls the previous script under the name 'count'.

#!/bin/sh

REPO=~/git/linux/.git
COUNT=$(pwd)/count
OUT=$(pwd)/time.dat
export GDFONTPATH=/usr/share/fonts/microsoft
export GIT_DIR=$REPO

if test "$1" != "-f"; then
	echo "== Previous (old) stats =="
	tail -n 2 $OUT
	# Update the repo and count new stats
	(cd $REPO && cd .. && git pull) && sh $COUNT > $OUT
	echo "== New stats =="
	tail -n 2 $OUT
fi

DATE=$(tail -n 1 $OUT | cut -f 1 | awk -F- '{print $2,$1,$3}')
MAXY=$(awk 'BEGIN {max=0}; ($3 > max) {max=$3}; END {print max+80}' < time.dat)
# GNU date is powerful!
MAXX=$(date +%b-1-%Y --date='+2 months')

cat << EOF | gnuplot > plot.png
set terminal png enhanced font "verdana,13" size 1600,1200


set title "OpenVZ team kernel patches progress as of ${DATE}"

unset xlabel
set xdata time
set timefmt "%b-%d-%Y"
set format x "%b\n%Y"
set grid xtics mxtics noytics

set xrange [ : "${MAXX}" ]
set yrange [ 0 : ${MAXY} ]
set ylabel "Number of patches from OpenVZ team,\n per kernel release, accepted into mainstream"

set border 3		# no lines at right and top
set xtics nomirror	# no tics at top
set ytics nomirror	# no tics at right

plot '${OUT}' using 1:3 with linespoints pt 6 ps 1 lw 2 lt 2 notitle, \
	''	using 1:3:2 with labels left offset 0,5.5 rotate notitle, \
	''	using 1:3:3 with labels left offset 0.7,0 notitle

EOF

File history

Click on a date/time to view the file as it appeared at that time.

(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
Date/TimeThumbnailDimensionsUserComment
current05:47, 28 March 2022Thumbnail for version as of 05:47, 28 March 20221,600 × 1,200 (52 KB)Vvs (talk | contribs)v5.17+
15:00, 8 May 2021Thumbnail for version as of 15:00, 8 May 20211,600 × 1,200 (49 KB)Vvs (talk | contribs)v5.12+
13:27, 3 May 2020Thumbnail for version as of 13:27, 3 May 20201,600 × 1,200 (50 KB)Vvs (talk | contribs)3.Mai 2020
10:21, 31 January 2020Thumbnail for version as of 10:21, 31 January 20201,600 × 1,200 (49 KB)Vvs (talk | contribs)v5.5+
07:36, 30 October 2019Thumbnail for version as of 07:36, 30 October 20191,600 × 1,200 (49 KB)Vvs (talk | contribs)v5.3+
07:16, 23 August 2019Thumbnail for version as of 07:16, 23 August 20191,600 × 1,200 (49 KB)Vvs (talk | contribs)v5.2+
06:26, 27 May 2019Thumbnail for version as of 06:26, 27 May 20191,600 × 1,200 (49 KB)Vvs (talk | contribs)26 may 2019, v5.2-rc2
15:48, 21 February 2019Thumbnail for version as of 15:48, 21 February 20191,600 × 1,200 (48 KB)Vvs (talk | contribs)5.0-rc7 state
11:10, 30 November 2018Thumbnail for version as of 11:10, 30 November 20181,600 × 1,200 (47 KB)Vvs (talk | contribs)
11:18, 27 August 2018Thumbnail for version as of 11:18, 27 August 20181,600 × 1,200 (48 KB)Vvs (talk | contribs)4.18+
(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
  • You cannot overwrite this file.

The following 2 pages link to this file:

Metadata