archive_r_ruby 0.1.4 → 0.1.5

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +77 -77
  3. data/README.md +103 -103
  4. data/ext/archive_r/archive_r_ext.cc +1106 -1106
  5. data/ext/archive_r/extconf.rb +120 -120
  6. data/ext/archive_r/vendor/archive_r/LICENSE.txt +77 -77
  7. data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +52 -52
  8. data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +166 -166
  9. data/ext/archive_r/vendor/archive_r/include/archive_r/entry_fault.h +34 -34
  10. data/ext/archive_r/vendor/archive_r/include/archive_r/entry_metadata.h +56 -56
  11. data/ext/archive_r/vendor/archive_r/include/archive_r/multi_volume_stream_base.h +46 -46
  12. data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy.h +109 -109
  13. data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +37 -37
  14. data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +19 -19
  15. data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +122 -122
  16. data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +330 -330
  17. data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +97 -97
  18. data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +162 -162
  19. data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +54 -54
  20. data/ext/archive_r/vendor/archive_r/src/archive_type.cc +552 -552
  21. data/ext/archive_r/vendor/archive_r/src/archive_type.h +77 -77
  22. data/ext/archive_r/vendor/archive_r/src/data_stream.cc +35 -35
  23. data/ext/archive_r/vendor/archive_r/src/entry.cc +253 -253
  24. data/ext/archive_r/vendor/archive_r/src/entry_fault.cc +26 -26
  25. data/ext/archive_r/vendor/archive_r/src/entry_fault_error.cc +54 -54
  26. data/ext/archive_r/vendor/archive_r/src/entry_fault_error.h +32 -32
  27. data/ext/archive_r/vendor/archive_r/src/entry_impl.h +57 -57
  28. data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +81 -81
  29. data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +41 -41
  30. data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +199 -199
  31. data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +151 -151
  32. data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +304 -304
  33. data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +120 -120
  34. data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +295 -295
  35. data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +46 -46
  36. data/ext/archive_r/vendor/archive_r/src/traverser.cc +314 -314
  37. data/lib/archive_r.rb +105 -105
  38. metadata +2 -6
  39. data/ext/archive_r/Makefile +0 -273
  40. data/ext/archive_r/archive_r-x64-mingw-ucrt.def +0 -2
  41. data/ext/archive_r/archive_r_ext.o +0 -0
  42. data/ext/archive_r/mkmf.log +0 -40
@@ -1,120 +1,120 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2025 archive_r Team
3
-
4
- #pragma once
5
- #include <string>
6
-
7
- #include <chrono>
8
- #include <iostream>
9
- #include <map>
10
- #include <vector>
11
- #include <algorithm>
12
- #include <iomanip>
13
- #include <mutex>
14
-
15
-
16
- namespace archive_r {
17
- namespace internal {
18
-
19
-
20
-
21
- class SimpleProfiler {
22
- public:
23
- static SimpleProfiler& instance() {
24
- static SimpleProfiler inst;
25
- return inst;
26
- }
27
-
28
- ~SimpleProfiler() {
29
- report();
30
- }
31
-
32
- void start(const std::string& name) {
33
- std::lock_guard<std::mutex> lock(mutex_);
34
- auto now = std::chrono::high_resolution_clock::now();
35
- start_times_[name] = now;
36
- }
37
-
38
- void stop(const std::string& name) {
39
- std::lock_guard<std::mutex> lock(mutex_);
40
- auto now = std::chrono::high_resolution_clock::now();
41
- auto it = start_times_.find(name);
42
- if (it != start_times_.end()) {
43
- auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(now - it->second).count();
44
- durations_[name] += duration;
45
- counts_[name]++;
46
- }
47
- }
48
-
49
- void report() {
50
- std::lock_guard<std::mutex> lock(mutex_);
51
- if (durations_.empty()) return;
52
-
53
- std::cout << "\n=== Profiling Report (archive_r::internal) ===" << std::endl;
54
- std::vector<std::pair<std::string, long long>> sorted_durations;
55
- for (const auto& pair : durations_) {
56
- sorted_durations.push_back(pair);
57
- }
58
-
59
- std::sort(sorted_durations.begin(), sorted_durations.end(),
60
- [](const auto& a, const auto& b) { return a.second > b.second; });
61
-
62
- std::cout << std::left << std::setw(40) << "Name"
63
- << std::right << std::setw(15) << "Total (ms)"
64
- << std::setw(10) << "Count"
65
- << std::setw(15) << "Avg (us)" << std::endl;
66
- std::cout << std::string(80, '-') << std::endl;
67
-
68
- for (const auto& pair : sorted_durations) {
69
- const auto& name = pair.first;
70
- long long total_ns = pair.second;
71
- long long count = counts_[name];
72
- double avg_ns = count > 0 ? (double)total_ns / count : 0;
73
-
74
- std::cout << std::left << std::setw(40) << name
75
- << std::right << std::setw(15) << std::fixed << std::setprecision(3) << total_ns / 1000000.0
76
- << std::setw(10) << count
77
- << std::setw(15) << std::fixed << std::setprecision(3) << avg_ns / 1000.0
78
- << std::endl;
79
- }
80
- std::cout << "==============================================\n" << std::endl;
81
- }
82
-
83
- void reset() {
84
- std::lock_guard<std::mutex> lock(mutex_);
85
- start_times_.clear();
86
- durations_.clear();
87
- counts_.clear();
88
- }
89
-
90
- private:
91
- std::map<std::string, std::chrono::high_resolution_clock::time_point> start_times_;
92
- std::map<std::string, long long> durations_;
93
- std::map<std::string, long long> counts_;
94
- std::mutex mutex_;
95
- };
96
-
97
- class ScopedTimer {
98
- public:
99
- ScopedTimer(const std::string& name) : name_(name) {
100
- SimpleProfiler::instance().start(name_);
101
- }
102
- ~ScopedTimer() {
103
- SimpleProfiler::instance().stop(name_);
104
- }
105
- private:
106
- std::string name_;
107
- };
108
-
109
- } // namespace internal
110
- } // namespace archive_r
111
-
112
- #ifdef ARCHIVE_R_SIMPLE_PROFILER_DISABLED
113
- #define ARCHIVE_R_PROFILE(name) ((void)0)
114
- #else
115
- #define ARCHIVE_R_PROFILE(name) ::archive_r::internal::ScopedTimer ARCHIVE_R_PROFILE_UNIQUE_NAME(name)(name)
116
- #endif
117
-
118
- #define ARCHIVE_R_PROFILE_UNIQUE_NAME(name) ARCHIVE_R_PROFILE_CONCAT(_archive_r_profiler_scope_, __COUNTER__)
119
- #define ARCHIVE_R_PROFILE_CONCAT(a, b) ARCHIVE_R_PROFILE_CONCAT_INNER(a, b)
120
- #define ARCHIVE_R_PROFILE_CONCAT_INNER(a, b) a##b
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2025 archive_r Team
3
+
4
+ #pragma once
5
+ #include <string>
6
+
7
+ #include <chrono>
8
+ #include <iostream>
9
+ #include <map>
10
+ #include <vector>
11
+ #include <algorithm>
12
+ #include <iomanip>
13
+ #include <mutex>
14
+
15
+
16
+ namespace archive_r {
17
+ namespace internal {
18
+
19
+
20
+
21
+ class SimpleProfiler {
22
+ public:
23
+ static SimpleProfiler& instance() {
24
+ static SimpleProfiler inst;
25
+ return inst;
26
+ }
27
+
28
+ ~SimpleProfiler() {
29
+ report();
30
+ }
31
+
32
+ void start(const std::string& name) {
33
+ std::lock_guard<std::mutex> lock(mutex_);
34
+ auto now = std::chrono::high_resolution_clock::now();
35
+ start_times_[name] = now;
36
+ }
37
+
38
+ void stop(const std::string& name) {
39
+ std::lock_guard<std::mutex> lock(mutex_);
40
+ auto now = std::chrono::high_resolution_clock::now();
41
+ auto it = start_times_.find(name);
42
+ if (it != start_times_.end()) {
43
+ auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(now - it->second).count();
44
+ durations_[name] += duration;
45
+ counts_[name]++;
46
+ }
47
+ }
48
+
49
+ void report() {
50
+ std::lock_guard<std::mutex> lock(mutex_);
51
+ if (durations_.empty()) return;
52
+
53
+ std::cout << "\n=== Profiling Report (archive_r::internal) ===" << std::endl;
54
+ std::vector<std::pair<std::string, long long>> sorted_durations;
55
+ for (const auto& pair : durations_) {
56
+ sorted_durations.push_back(pair);
57
+ }
58
+
59
+ std::sort(sorted_durations.begin(), sorted_durations.end(),
60
+ [](const auto& a, const auto& b) { return a.second > b.second; });
61
+
62
+ std::cout << std::left << std::setw(40) << "Name"
63
+ << std::right << std::setw(15) << "Total (ms)"
64
+ << std::setw(10) << "Count"
65
+ << std::setw(15) << "Avg (us)" << std::endl;
66
+ std::cout << std::string(80, '-') << std::endl;
67
+
68
+ for (const auto& pair : sorted_durations) {
69
+ const auto& name = pair.first;
70
+ long long total_ns = pair.second;
71
+ long long count = counts_[name];
72
+ double avg_ns = count > 0 ? (double)total_ns / count : 0;
73
+
74
+ std::cout << std::left << std::setw(40) << name
75
+ << std::right << std::setw(15) << std::fixed << std::setprecision(3) << total_ns / 1000000.0
76
+ << std::setw(10) << count
77
+ << std::setw(15) << std::fixed << std::setprecision(3) << avg_ns / 1000.0
78
+ << std::endl;
79
+ }
80
+ std::cout << "==============================================\n" << std::endl;
81
+ }
82
+
83
+ void reset() {
84
+ std::lock_guard<std::mutex> lock(mutex_);
85
+ start_times_.clear();
86
+ durations_.clear();
87
+ counts_.clear();
88
+ }
89
+
90
+ private:
91
+ std::map<std::string, std::chrono::high_resolution_clock::time_point> start_times_;
92
+ std::map<std::string, long long> durations_;
93
+ std::map<std::string, long long> counts_;
94
+ std::mutex mutex_;
95
+ };
96
+
97
+ class ScopedTimer {
98
+ public:
99
+ ScopedTimer(const std::string& name) : name_(name) {
100
+ SimpleProfiler::instance().start(name_);
101
+ }
102
+ ~ScopedTimer() {
103
+ SimpleProfiler::instance().stop(name_);
104
+ }
105
+ private:
106
+ std::string name_;
107
+ };
108
+
109
+ } // namespace internal
110
+ } // namespace archive_r
111
+
112
+ #ifdef ARCHIVE_R_SIMPLE_PROFILER_DISABLED
113
+ #define ARCHIVE_R_PROFILE(name) ((void)0)
114
+ #else
115
+ #define ARCHIVE_R_PROFILE(name) ::archive_r::internal::ScopedTimer ARCHIVE_R_PROFILE_UNIQUE_NAME(name)(name)
116
+ #endif
117
+
118
+ #define ARCHIVE_R_PROFILE_UNIQUE_NAME(name) ARCHIVE_R_PROFILE_CONCAT(_archive_r_profiler_scope_, __COUNTER__)
119
+ #define ARCHIVE_R_PROFILE_CONCAT(a, b) ARCHIVE_R_PROFILE_CONCAT_INNER(a, b)
120
+ #define ARCHIVE_R_PROFILE_CONCAT_INNER(a, b) a##b