adlint-benchmark 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/INSTALL ADDED
@@ -0,0 +1,54 @@
1
+ --
2
+ ___ ____ __ ___ _________
3
+ / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
+ / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
+ / __ |/ /_/ / /___/ / /| / / /
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
7
+
8
+ This file is part of adlint-benchmark.
9
+
10
+ adlint-benchmark is free software: you can redistribute it and/or modify it
11
+ under the terms of the GNU General Public License as published by the Free
12
+ Software Foundation, either version 3 of the License, or (at your option) any
13
+ later version.
14
+
15
+ adlint-benchmark is distributed in the hope that it will be useful, but
16
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18
+ details.
19
+
20
+ You should have received a copy of the GNU General Public License along with
21
+ adlint-benchmark. If not, see <http://www.gnu.org/licenses/>.
22
+
23
+ ++
24
+
25
+ === Requirements
26
+
27
+ * \AdLint 2.6.10 or later [*mandatory*]
28
+
29
+
30
+ === Installation
31
+
32
+ You can install adlint-benchmark by following command.
33
+
34
+ If \AdLint 2.6.10 or later version has not been installed, it will be installed
35
+ automatically before installing adlint-benchmark.
36
+
37
+ % gem install adlint-benchmark
38
+ or
39
+ % sudo gem install adlint-benchmark
40
+
41
+
42
+ === Usage
43
+
44
+ Run benchmark using Ruby's benchmark library.
45
+
46
+ % adlint_bm -p
47
+ user system total real
48
+ screen-4.0.3/process.c.small 16.190000 0.040000 16.230000 ( 16.376713)
49
+ 16.600s user, 0.060s system, 00:00:16.66 total
50
+
51
+ Run benchmark using time(1).
52
+
53
+ % time adlint_bm
54
+ adlint_bm 0.54s user 0.04s system 99% cpu 0.584 total
data/MANIFEST ADDED
@@ -0,0 +1,15 @@
1
+ AUTHORS
2
+ COPYING
3
+ ChangeLog
4
+ INSTALL
5
+ MANIFEST
6
+ NEWS
7
+ README
8
+ Rakefile
9
+ bin/adlint_bm
10
+ lib/adlint/benchmark.rb
11
+ lib/adlint/benchmark/driver.rb
12
+ lib/adlint/benchmark/target.rb
13
+ lib/adlint/benchmark/target/screen_4_0_3_process_c.rb
14
+ lib/adlint/benchmark/target/screen_4_0_3_process_c_small.rb
15
+ lib/adlint/benchmark/version.rb
data/NEWS ADDED
@@ -0,0 +1,31 @@
1
+ --
2
+ ___ ____ __ ___ _________
3
+ / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
+ / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
+ / __ |/ /_/ / /___/ / /| / / /
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
7
+
8
+ This file is part of adlint-benchmark.
9
+
10
+ adlint-benchmark is free software: you can redistribute it and/or modify it
11
+ under the terms of the GNU General Public License as published by the Free
12
+ Software Foundation, either version 3 of the License, or (at your option) any
13
+ later version.
14
+
15
+ adlint-benchmark is distributed in the hope that it will be useful, but
16
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18
+ details.
19
+
20
+ You should have received a copy of the GNU General Public License along with
21
+ adlint-benchmark. If not, see <http://www.gnu.org/licenses/>.
22
+
23
+ ++
24
+
25
+ === 1.0.0 is released (2012-11-27)
26
+
27
+ This is the initial GA release of adlint-benchmark.
28
+
29
+ ==== Implemented features
30
+
31
+ * \Benchmark for \AdLint's single module analysis of `screen-4.0.3/process.c'
data/README ADDED
@@ -0,0 +1,57 @@
1
+ --
2
+ ___ ____ __ ___ _________
3
+ / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
+ / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
+ / __ |/ /_/ / /___/ / /| / / /
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
7
+
8
+ This file is part of adlint-benchmark.
9
+
10
+ adlint-benchmark is free software: you can redistribute it and/or modify it
11
+ under the terms of the GNU General Public License as published by the Free
12
+ Software Foundation, either version 3 of the License, or (at your option) any
13
+ later version.
14
+
15
+ adlint-benchmark is distributed in the hope that it will be useful, but
16
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18
+ details.
19
+
20
+ You should have received a copy of the GNU General Public License along with
21
+ adlint-benchmark. If not, see <http://www.gnu.org/licenses/>.
22
+
23
+ ++
24
+
25
+ == What is
26
+
27
+ adlint-benchmark is a simple benchmark of \AdLint.
28
+
29
+ == News
30
+
31
+ :include:NEWS
32
+
33
+ == How to Install
34
+
35
+ :include:INSTALL
36
+
37
+ == License
38
+
39
+ Copyright (C) 2010-2012, {OGIS-RI}[http://www.ogis-ri.co.jp/] Co.,Ltd.
40
+
41
+ adlint-postfilter is free software: you can redistribute it and/or modify it
42
+ under the terms of the GNU General Public License as published by the Free
43
+ Software Foundation, either version 3 of the License, or (at your option) any
44
+ later version.
45
+
46
+ adlint-postfilter is distributed in the hope that it will be useful, but
47
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
48
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
49
+ details.
50
+
51
+ You should have received a copy of the GNU General Public License along with
52
+ adlint-postfilter. If not, see
53
+ <{http\://www.gnu.org/licenses/}[http://www.gnu.org/licenses/]>.
54
+
55
+ == Authors
56
+
57
+ :include:AUTHORS
data/Rakefile ADDED
@@ -0,0 +1,84 @@
1
+ #--
2
+ # ___ ____ __ ___ _________
3
+ # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
+ # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
+ # / __ |/ /_/ / /___/ / /| / / /
6
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
7
+ #
8
+ # This file is part of adlint-benchmark.
9
+ #
10
+ # adlint-benchmark is free software: you can redistribute it and/or modify it
11
+ # under the terms of the GNU General Public License as published by the Free
12
+ # Software Foundation, either version 3 of the License, or (at your option) any
13
+ # later version.
14
+ #
15
+ # adlint-benchmark is distributed in the hope that it will be useful, but
16
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18
+ # more details.
19
+ #
20
+ # You should have received a copy of the GNU General Public License along with
21
+ # adlint-benchmark. If not, see <http://www.gnu.org/licenses/>.
22
+ #
23
+ #++
24
+
25
+ require "rubygems/package_task"
26
+ require "rdoc/task"
27
+
28
+ $: << File.expand_path("lib", File.dirname(__FILE__))
29
+ require "adlint/benchmark/version"
30
+
31
+ task :default => [:gem]
32
+ task :clobber => [:clobber_package, :clobber_rdoc]
33
+
34
+ gemspec = Gem::Specification.new do |s|
35
+ s.name = "adlint-benchmark"
36
+ s.version = AdLint::Benchmark::SHORT_VERSION
37
+ s.date = AdLint::Benchmark::RELEASE_DATE
38
+ s.homepage = "http://adlint-goodies.sourceforge.net/"
39
+ s.licenses = ["GPLv3+: GNU General Public License version 3 or later"]
40
+ s.author = "Yutaka Yanoh"
41
+ s.email = "yanoh@users.sourceforge.net"
42
+ s.summary = "Simple benchmark of AdLint"
43
+ s.description = "Simple benchmark of AdLint"
44
+
45
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
46
+
47
+ s.executables = %w(adlint_bm)
48
+ s.require_paths = %w(lib)
49
+ manifest_fpath = File.expand_path("MANIFEST", File.dirname(__FILE__))
50
+ s.files = File.readlines(manifest_fpath).map { |str| str.chomp }
51
+
52
+ s.has_rdoc = true
53
+ s.extra_rdoc_files = %w(README)
54
+ s.rdoc_options = ["--main", "README", "--charset", "utf-8"]
55
+
56
+ s.add_dependency("adlint", ">= 2.6.10")
57
+ end
58
+
59
+ Gem::PackageTask.new(gemspec) do |pkg|
60
+ pkg.need_zip = true
61
+ pkg.need_tar_bz2 = true
62
+ end
63
+
64
+ RDoc::Task.new(:rdoc) do |rd|
65
+ rd.rdoc_dir = "rdoc"
66
+ rd.title = "adlint-benchmark #{AdLint::Benchmark::SHORT_VERSION}"
67
+ rd.main = "README"
68
+ rd.rdoc_files.include("README")
69
+ rd.rdoc_files.include("bin/*")
70
+ rd.rdoc_files.include("lib/**/*.rb")
71
+ rd.options << "--charset=utf-8" << "--all"
72
+ end
73
+
74
+ desc "Remove package products and RDoc HTML files"
75
+ task :clobber
76
+
77
+ desc "Generate tags file"
78
+ task :tags do
79
+ ctags *Dir["bin/*", "lib/**/*.rb"]
80
+ end
81
+
82
+ def ctags(*files)
83
+ sh "ctags " + files.join(" ")
84
+ end
data/bin/adlint_bm ADDED
@@ -0,0 +1,99 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Simple benchmark of AdLint.
5
+ #
6
+ # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
7
+ # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
8
+ # License:: GPLv3+: GNU General Public License version 3 or later
9
+ #
10
+ # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
11
+
12
+ #--
13
+ # ___ ____ __ ___ _________
14
+ # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
15
+ # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
16
+ # / __ |/ /_/ / /___/ / /| / / /
17
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
18
+ #
19
+ # This file is part of adlint-benchmark.
20
+ #
21
+ # adlint-benchmark is free software: you can redistribute it and/or modify it
22
+ # under the terms of the GNU General Public License as published by the Free
23
+ # Software Foundation, either version 3 of the License, or (at your option) any
24
+ # later version.
25
+ #
26
+ # adlint-benchmark is distributed in the hope that it will be useful, but
27
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
29
+ # more details.
30
+ #
31
+ # You should have received a copy of the GNU General Public License along with
32
+ # adlnt-benchmark. If not, see <http://www.gnu.org/licenses/>.
33
+ #
34
+ #++
35
+
36
+ require "pathname"
37
+
38
+ BENCHMARK_BINDIR = Pathname.new(__FILE__).realpath.dirname
39
+ BENCHMARK_PREFIX = Pathname.new("..").expand_path(BENCHMARK_BINDIR)
40
+ BENCHMARK_LIBDIR = Pathname.new("lib").expand_path(BENCHMARK_PREFIX)
41
+
42
+ $:.unshift(BENCHMARK_LIBDIR.to_s)
43
+
44
+ require "adlint/benchmark"
45
+
46
+ BENCHMARK_VERSION = "adlint-benchmark #{AdLint::Benchmark::VERSION}"
47
+
48
+ USAGE = <<EOS
49
+ Usage: adlint_bm [options]
50
+
51
+ Benchmark Options:
52
+ -t, --target [NAME] Analysis target name (screen-4.0.3/process.c.small)
53
+ -p, --print-time Display elapsed time
54
+
55
+ Other Options:
56
+ --version Display version information
57
+ --copyright Display copyright information
58
+ --prefix Display prefix directory of adlint-benchmark
59
+ -h, --help Display this message
60
+ EOS
61
+
62
+ require "getoptlong"
63
+
64
+ parser = GetoptLong.new(["--target", "-t", GetoptLong::REQUIRED_ARGUMENT],
65
+ ["--print-time", "-p", GetoptLong::NO_ARGUMENT],
66
+ ["--version", GetoptLong::NO_ARGUMENT],
67
+ ["--copyright", GetoptLong::NO_ARGUMENT],
68
+ ["--prefix", GetoptLong::NO_ARGUMENT],
69
+ ["--help", "-h", GetoptLong::NO_ARGUMENT])
70
+
71
+ begin
72
+ target_name = "screen-4.0.3/process.c.small"
73
+ print_time = false
74
+ parser.each_option do |optname, optarg|
75
+ case optname
76
+ when "--target"
77
+ target_name = optarg
78
+ when "--print-time"
79
+ print_time = true
80
+ when "--version"
81
+ puts BENCHMARK_VERSION, AdLint::Benchmark::AUTHOR
82
+ exit 0
83
+ when "--copyright"
84
+ puts AdLint::Benchmark::COPYRIGHT
85
+ exit 0
86
+ when "--prefix"
87
+ puts BENCHMARK_PREFIX
88
+ exit 0
89
+ when "--help"
90
+ puts USAGE
91
+ exit 0
92
+ end
93
+ end
94
+ rescue
95
+ end
96
+
97
+ AdLint::Benchmark.run(target_name, print_time)
98
+
99
+ exit 0
@@ -0,0 +1,71 @@
1
+ # Benchmark driver.
2
+ #
3
+ # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
+ # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
5
+ # License:: GPLv3+: GNU General Public License version 3 or later
6
+ #
7
+ # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
8
+
9
+ #--
10
+ # ___ ____ __ ___ _________
11
+ # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
+ # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
+ # / __ |/ /_/ / /___/ / /| / / /
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
15
+ #
16
+ # This file is part of adlint-benchmark.
17
+ #
18
+ # adlint-benchmark is free software: you can redistribute it and/or modify it
19
+ # under the terms of the GNU General Public License as published by the Free
20
+ # Software Foundation, either version 3 of the License, or (at your option) any
21
+ # later version.
22
+ #
23
+ # adlint-benchmark is distributed in the hope that it will be useful, but
24
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
26
+ # more details.
27
+ #
28
+ # You should have received a copy of the GNU General Public License along with
29
+ # adlnt-benchmark. If not, see <http://www.gnu.org/licenses/>.
30
+ #
31
+ #++
32
+
33
+ module AdLint #:nodoc:
34
+
35
+ module Benchmark
36
+ def run(target_name, print_time = false)
37
+ if print_time
38
+ require "benchmark"
39
+ ::Benchmark.bm(target_name.length) do |x|
40
+ x.report(target_name) { _run(target_name) }
41
+ end
42
+ else
43
+ _run(target_name)
44
+ end
45
+ end
46
+ module_function :run
47
+
48
+ def _run(target_name)
49
+ if target = AnalysisTarget.load(target_name)
50
+ _nullify_console_output { target.analyze }
51
+ else
52
+ raise "no such target `#{target_name}'"
53
+ end
54
+ end
55
+ module_function :_run
56
+
57
+ def _nullify_console_output(&block)
58
+ orig_stdout = $stdout.dup
59
+ orig_stderr = $stderr.dup
60
+ dev_null = File.open(File::NULL, "w")
61
+ $stdout.reopen(dev_null)
62
+ $stderr.reopen(dev_null)
63
+ yield
64
+ ensure
65
+ $stdout.reopen(orig_stdout)
66
+ $stderr.reopen(orig_stderr)
67
+ end
68
+ module_function :_nullify_console_output
69
+ end
70
+
71
+ end