dev_suite 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +1 -1
- data/README.md +31 -4
- data/dev_suite.gemspec +1 -2
- data/lib/dev_suite/performance/analyzer.rb +6 -7
- data/lib/dev_suite/performance/data.rb +9 -0
- data/lib/dev_suite/performance/{profiling/base_profiler.rb → profiler/base.rb} +2 -2
- data/lib/dev_suite/performance/{profiling/benchmark_profiler.rb → profiler/benchmark.rb} +4 -4
- data/lib/dev_suite/performance/{profiling/memory_profiler.rb → profiler/memory.rb} +3 -3
- data/lib/dev_suite/performance/profiler.rb +10 -0
- data/lib/dev_suite/performance/reportor/base.rb +11 -0
- data/lib/dev_suite/performance/{reporting/report_generator.rb → reportor/simple.rb} +5 -5
- data/lib/dev_suite/performance/reportor.rb +9 -0
- data/lib/dev_suite/performance.rb +7 -0
- data/lib/dev_suite/utils/table/column.rb +11 -0
- data/lib/dev_suite/utils/table/renderer.rb +12 -0
- data/lib/dev_suite/utils/table/row.rb +11 -0
- data/lib/dev_suite/utils/table/table.rb +1 -1
- data/lib/dev_suite/utils.rb +9 -0
- data/lib/dev_suite/version.rb +1 -1
- data/lib/dev_suite.rb +1 -1
- metadata +17 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18cb4bab59f55347094ab11c9772b132446789b2c5a12cdb0a596b9ccd57ab0b
|
4
|
+
data.tar.gz: 212866e22087fa628633af141c349e9831f0d0ad060018aed0f0cd6742cbfb9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29b881d2e2f34f10aced28ff856a56ca75da39c4000c8cd17194d2bd535c7b595799919ba164bf2a55ac61b4e0f3d9833f9e11c028e3fcc51c0b1017ba307aca
|
7
|
+
data.tar.gz: d136f946ff59f6db1d5ac5d14447d302ed6f85df55e1c4b64af2f0cc5a54efa2a48ec4aaffa2a520cb455195af4300aeb0c3ae606da6c4b7aba19ca66a5a6e32
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# DevSuite
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/dev_suite.svg)](https://badge.fury.io/rb/dev_suite)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/patrick204nqh/dev_suite/badges/gpa.svg)](https://codeclimate.com/github/patrick204nqh/dev_suite)
|
5
|
+
|
3
6
|
Welcome to DevSuite! This gem provides a suite of utilities for developers to enhance their productivity.
|
4
7
|
|
5
8
|
## Installation
|
@@ -40,7 +43,7 @@ DevSuite::SomeUtility.do_something
|
|
40
43
|
## Features
|
41
44
|
|
42
45
|
<details>
|
43
|
-
<summary><strong>Performance Analysis
|
46
|
+
<summary><strong>Performance Analysis</strong></summary>
|
44
47
|
|
45
48
|
Analyze the performance of your code blocks with detailed benchmark and memory usage reports.
|
46
49
|
|
@@ -49,10 +52,34 @@ DevSuite::SomeUtility.do_something
|
|
49
52
|
require 'dev_suite'
|
50
53
|
|
51
54
|
DevSuite::Performance::Analyzer.analyze(description: "My Code Block") do
|
52
|
-
|
55
|
+
sum = 0
|
56
|
+
1_000_000.times do |i|
|
57
|
+
sum += i
|
58
|
+
end
|
59
|
+
sum
|
53
60
|
end
|
54
61
|
```
|
55
|
-
|
62
|
+
|
63
|
+
**Example output**
|
64
|
+
```
|
65
|
+
| Performance Analysis |
|
66
|
+
+----------------------------+---------------+
|
67
|
+
| Metric | Value |
|
68
|
+
+----------------------------+---------------+
|
69
|
+
| Description | My Code Block |
|
70
|
+
| Total Time (s) | 0.056238 |
|
71
|
+
| User CPU Time (s) | 0.055662 |
|
72
|
+
| System CPU Time (s) | 0.000097 |
|
73
|
+
| User + System CPU Time (s) | 0.055759 |
|
74
|
+
| Memory Before (MB) | 25.39 |
|
75
|
+
| Memory After (MB) | 25.42 |
|
76
|
+
| Memory Used (MB) | 0.03 |
|
77
|
+
| Max Memory Used (MB) | 25.41 |
|
78
|
+
| Min Memory Used (MB) | 25.41 |
|
79
|
+
| Avg Memory Used (MB) | 25.41 |
|
80
|
+
```
|
81
|
+
</details>
|
82
|
+
|
56
83
|
|
57
84
|
## Development
|
58
85
|
|
@@ -84,4 +111,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
84
111
|
|
85
112
|
## Code of Conduct
|
86
113
|
|
87
|
-
Everyone interacting in the DevSuite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/patrick204nqh/dev_suite/blob/master/CODE_OF_CONDUCT.md).
|
114
|
+
Everyone interacting in the DevSuite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/patrick204nqh/dev_suite/blob/master/CODE_OF_CONDUCT.md).
|
data/dev_suite.gemspec
CHANGED
@@ -9,8 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["patrick204nqh@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "A suite of development tools."
|
12
|
-
spec.description = "
|
13
|
-
"and custom curl command generation."
|
12
|
+
spec.description = "This gem provides a suite of utilities for developers to enhance their productivity."
|
14
13
|
spec.homepage = "https://patrick204nqh.github.io"
|
15
14
|
spec.license = "MIT"
|
16
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
5
|
-
require_relative "profiling/memory_profiler"
|
3
|
+
require_relative "reportor"
|
4
|
+
require_relative "profiler"
|
6
5
|
|
7
6
|
module DevSuite
|
8
7
|
module Performance
|
@@ -21,8 +20,8 @@ module DevSuite
|
|
21
20
|
|
22
21
|
def initialize(description: "Block")
|
23
22
|
@description = description
|
24
|
-
@benchmark_profiler =
|
25
|
-
@memory_profiler =
|
23
|
+
@benchmark_profiler = Profiler::Benchmark.new
|
24
|
+
@memory_profiler = Profiler::Memory.new
|
26
25
|
@memory_usage = Data::MemoryUsage.new
|
27
26
|
end
|
28
27
|
|
@@ -54,12 +53,12 @@ module DevSuite
|
|
54
53
|
# @param benchmark_result [Benchmark::Tms] The benchmark result
|
55
54
|
# @param memory_stats [Hash] The memory statistics
|
56
55
|
def generate_report(benchmark_result, memory_stats)
|
57
|
-
|
56
|
+
reportor = Reportor::Simple.new(
|
58
57
|
@description,
|
59
58
|
benchmark_result,
|
60
59
|
memory_stats,
|
61
60
|
)
|
62
|
-
|
61
|
+
reportor.generate
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "benchmark"
|
4
|
-
require_relative "
|
4
|
+
require_relative "base"
|
5
5
|
|
6
6
|
module DevSuite
|
7
7
|
module Performance
|
8
|
-
module
|
9
|
-
class
|
8
|
+
module Profiler
|
9
|
+
class Benchmark < Base
|
10
10
|
def run(&block)
|
11
|
-
Benchmark.measure do
|
11
|
+
::Benchmark.measure do
|
12
12
|
block.call
|
13
13
|
end
|
14
14
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
3
|
+
require_relative "base"
|
4
4
|
require_relative "../data/memory_usage"
|
5
5
|
|
6
6
|
module DevSuite
|
7
7
|
module Performance
|
8
|
-
module
|
9
|
-
class
|
8
|
+
module Profiler
|
9
|
+
class Memory < Base
|
10
10
|
attr_reader :max_memory, :min_memory, :average_memory
|
11
11
|
|
12
12
|
def initialize
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
4
|
-
require_relative "../../utils
|
5
|
-
require_relative "../../utils/table/renderer/simple"
|
3
|
+
require_relative "base"
|
4
|
+
require_relative "../../utils"
|
6
5
|
|
7
6
|
module DevSuite
|
8
7
|
module Performance
|
9
|
-
module
|
10
|
-
class
|
8
|
+
module Reportor
|
9
|
+
class Simple < Base
|
11
10
|
def initialize(description, benchmark_result, memory_stats)
|
11
|
+
super()
|
12
12
|
@description = description
|
13
13
|
@benchmark_result = benchmark_result
|
14
14
|
@memory_stats = memory_stats
|
data/lib/dev_suite/version.rb
CHANGED
data/lib/dev_suite.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_suite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huy Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark
|
@@ -38,8 +38,8 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.2'
|
41
|
-
description:
|
42
|
-
|
41
|
+
description: This gem provides a suite of utilities for developers to enhance their
|
42
|
+
productivity.
|
43
43
|
email:
|
44
44
|
- patrick204nqh@gmail.com
|
45
45
|
executables: []
|
@@ -61,19 +61,28 @@ files:
|
|
61
61
|
- bin/setup
|
62
62
|
- dev_suite.gemspec
|
63
63
|
- lib/dev_suite.rb
|
64
|
+
- lib/dev_suite/performance.rb
|
64
65
|
- lib/dev_suite/performance/analyzer.rb
|
66
|
+
- lib/dev_suite/performance/data.rb
|
65
67
|
- lib/dev_suite/performance/data/memory_usage.rb
|
66
|
-
- lib/dev_suite/performance/
|
67
|
-
- lib/dev_suite/performance/
|
68
|
-
- lib/dev_suite/performance/
|
69
|
-
- lib/dev_suite/performance/
|
68
|
+
- lib/dev_suite/performance/profiler.rb
|
69
|
+
- lib/dev_suite/performance/profiler/base.rb
|
70
|
+
- lib/dev_suite/performance/profiler/benchmark.rb
|
71
|
+
- lib/dev_suite/performance/profiler/memory.rb
|
72
|
+
- lib/dev_suite/performance/reportor.rb
|
73
|
+
- lib/dev_suite/performance/reportor/base.rb
|
74
|
+
- lib/dev_suite/performance/reportor/simple.rb
|
75
|
+
- lib/dev_suite/utils.rb
|
76
|
+
- lib/dev_suite/utils/table/column.rb
|
70
77
|
- lib/dev_suite/utils/table/column/column.rb
|
71
78
|
- lib/dev_suite/utils/table/config.rb
|
72
79
|
- lib/dev_suite/utils/table/formatter/colorizer.rb
|
73
80
|
- lib/dev_suite/utils/table/formatter/column_width_calculator.rb
|
74
81
|
- lib/dev_suite/utils/table/formatter/text_aligner.rb
|
82
|
+
- lib/dev_suite/utils/table/renderer.rb
|
75
83
|
- lib/dev_suite/utils/table/renderer/base.rb
|
76
84
|
- lib/dev_suite/utils/table/renderer/simple.rb
|
85
|
+
- lib/dev_suite/utils/table/row.rb
|
77
86
|
- lib/dev_suite/utils/table/row/row.rb
|
78
87
|
- lib/dev_suite/utils/table/table.rb
|
79
88
|
- lib/dev_suite/version.rb
|