Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit 2c56c58

Browse files
committed
skeleton
1 parent e790547 commit 2c56c58

File tree

7 files changed

+168
-57
lines changed

7 files changed

+168
-57
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
clones
22
clones/
33
repos.txt
4-
summary-*.csv
4+
summary.csv
55
article.pdf
66
*.aux
77
*.fdb_latexmk

Gemfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2020 Yegor Bugayenko
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
source 'https://rubygems.org'
24+
ruby '~>2.6'
25+
26+
gem 'octokit', '4.18.0'
27+
gem 'slop', '4.6.0'

Makefile

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ all: install search clone calc summary draw article
2424

2525
install:
2626
bundle update
27-
gem install volatility
2827

2928
clean:
3029
rm -rf *.tex
@@ -33,66 +32,55 @@ clean:
3332
rm -rf clones
3433
cd paper; latexmk -c
3534

36-
# search:
37-
# ruby find-repos.rb | tee repos.txt
35+
search:
36+
ruby find-repos.rb | tee repos.txt
3837

39-
# clone:
40-
# while read line; do \
41-
# p="clones/$${line}"; \
42-
# if [ -e "$${p}/.git" ]; then \
43-
# echo "$${p} already here"; \
44-
# else \
45-
# mkdir -p "$${p}"; \
46-
# git clone --depth=1 "https://github.com/$${line}" "$${p}"; \
47-
# fi \
48-
# done < repos.txt
38+
clone:
39+
while read line; do \
40+
p="clones/$${line}"; \
41+
if [ -e "$${p}/.git" ]; then \
42+
echo "$${p} already here"; \
43+
else \
44+
mkdir -p "$${p}"; \
45+
git clone --depth=1 "https://github.com/$${line}" "$${p}"; \
46+
fi \
47+
done < repos.txt
4948

50-
# uncalc:
51-
# find metrics -name 'scv.m' -exec rm \{} \;
52-
# find metrics -name 'scv*.m' -exec rm \{} \;
49+
uncalc:
50+
rm -rf metrics
5351

54-
# metrics=files bytes scv32 scv64 scv128
52+
calc:
53+
mkdir -p metrics
54+
for r in $$(find clones/ -type directory -depth 2); do \
55+
d="metrics/$${r/clones\/\//}"; \
56+
if [ -e "$${d}" ]; then \
57+
echo "Dir with metrics already here: $${d}"; \
58+
else \
59+
mkdir -p "$${d}"; \
60+
for f in $$(find $${r} -name '*.java'); do \
61+
m="metrics/$${f/clones\/\//}.m"; \
62+
mkdir -p $$(dirname "$${m}"); \
63+
echo '1,1' > "$${m}"; \
64+
done; \
65+
echo "$$(find $${d} -type file | wc -l) Java classes analyzed into $${d}"; \
66+
fi; \
67+
done
5568

56-
# calc:
57-
# for f in $$(find clones/ -type directory -depth 2); do \
58-
# f=$${f/clones\/\//}; \
59-
# mkdir -p "metrics/$${f}"; \
60-
# p="metrics/$${f}/files.m"; \
61-
# if [ ! -e "$${p}" ]; then \
62-
# find "clones/$${f}" -type file -not -path '.git/*' | wc -l > "$${p}"; \
63-
# fi; \
64-
# p="metrics/$${f}/bytes.m"; \
65-
# if [ ! -e "$${p}" ]; then \
66-
# du -s -b "clones/$${f}" | awk '{ print $$1 }' > "$${p}"; \
67-
# fi; \
68-
# for z in 32 64 128; do \
69-
# p="metrics/$${f}/scv$${z}.m"; \
70-
# if [ ! -e "$${p}" ]; then \
71-
# /code/volatility/bin/volatility --sectors=$${z} --home="clones/$${f}" > "$${p}"; \
72-
# fi; \
73-
# done; \
74-
# done
69+
summary:
70+
s="summary.csv"; \
71+
rm -rf $${s}; \
72+
touch $${s}; \
73+
for f in $$(find metrics -name '*.m'); do \
74+
cat "$${f}" >> $${s}; \
75+
done; \
76+
echo "$$(wc -l < $${s}) methods measured, the summary is in $${s}"; \
7577

76-
# summary:
77-
# for i in ${metrics}; do \
78-
# s="summary-$${i}.csv"; \
79-
# rm -rf $${s}; \
80-
# touch $${s}; \
81-
# for f in $$(find metrics -name $${i}.m); do \
82-
# cat "$${f}" >> $${s}; \
83-
# done; \
84-
# echo "$$(wc -l < $${s}) repos measured $${i}, summary in $${s}"; \
85-
# done
78+
draw: summary.csv
79+
ruby draw.rb --summary=summary.csv > paper/graph.tex
8680

87-
# draw: summary-files.csv summary-bytes.csv
88-
# for z in 32 64 128; do \
89-
# ruby draw.rb --yaxis=summary-scv$${z}.csv --xaxis=summary-files.csv '--xlabel=log_{10}(M_1)' > paper/files-$${z}.tex; \
90-
# ruby draw.rb --yaxis=summary-scv$${z}.csv --xaxis=summary-bytes.csv '--xlabel=log_{10}(M_2)' > paper/bytes-$${z}.tex; \
91-
# done
81+
paper/total.tex:
82+
rm -f paper/total.tex
83+
echo "\\\def\\\thetotalrepos{$$(find metrics -name 'files.m' | wc -l)}" > paper/total.tex
9284

93-
# metrics:
94-
# rm -f paper/total.tex
95-
# echo "\\\def\\\thetotalrepos{$$(find metrics -name 'files.m' | wc -l)}" > paper/total.tex
96-
97-
article: paper/article.tex
85+
article: paper/article.tex paper/total.tex
9886
cd paper; rm -f article.pdf; latexmk -pdf article

draw.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env ruby
2+
# The MIT License (MIT)
3+
#
4+
# Copyright (c) 2020 Yegor Bugayenko
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included
14+
# in all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
require 'slop'
25+
26+
opts = Slop.parse(ARGV, strict: true, help: true) do |o|
27+
o.integer '--width', default: 9
28+
o.integer '--height', default: 5
29+
o.string '--xlabel', default: 'CC'
30+
o.string '--ylabel', default: 'Vars'
31+
o.string '--summary', default: 'summary.csv'
32+
end
33+
34+
points = []
35+
36+
# Load CSV from summary
37+
38+
ymax = points.map { |p| p[:y] }.max
39+
xmax = points.map { |p| p[:x] }.max
40+
41+
puts '\begin{tikzpicture}'
42+
puts "\\begin{axis}[width=#{opts[:width]}cm,height=#{opts[:height]}cm,"
43+
puts "axis lines=middle, xlabel={$#{opts[:xlabel]}$}, ylabel={$#{opts[:ylabel]}$},"
44+
puts "xmin=#{points.map { |p| p[:x] }.min}, xmax=#{xmax},"
45+
puts "ymin=#{points.map { |p| p[:y] }.min}, ymax=#{ymax},"
46+
puts "extra tick style={major grid style=black},grid=major]"
47+
puts "\\addplot [mark=*, only marks, mark size=0.8pt] coordinates {"
48+
points.each do |p|
49+
puts "(#{p[:x]},#{p[:y]})"
50+
end
51+
puts "};"
52+
puts '\end{axis}\end{tikzpicture}'

find-repos.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env ruby
2+
# The MIT License (MIT)
3+
#
4+
# Copyright (c) 2020 Yegor Bugayenko
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included
14+
# in all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
STDOUT.sync = true
25+
26+
require 'octokit'
27+
28+
github = Octokit::Client.new
29+
(0..50).each do |p|
30+
json = github.search_repositories('stars:>=1000 size:>200 language:java is:public mirror:false archived:false', page: p)
31+
json[:items].each do |i|
32+
puts i[:full_name]
33+
end
34+
end

paper/graph.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
\begin{tikzpicture}
2+
\begin{axis}[width=9cm,height=5cm,
3+
axis lines=middle, xlabel={$CC$}, ylabel={$Vars$},
4+
xmin=, xmax=,
5+
ymin=, ymax=,
6+
extra tick style={major grid style=black},grid=major]
7+
\addplot [mark=*, only marks, mark size=0.8pt] coordinates {
8+
};
9+
\end{axis}\end{tikzpicture}

paper/total.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
\def\thetotalrepos{0}

0 commit comments

Comments
 (0)