archive_r_ruby 0.1.21 → 0.1.22

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