darshan-ruby 3.1.3.1 → 3.1.4.1
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.
- checksums.yaml +4 -4
- data/bin/quarshan +90 -17
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c25bc9473ebb0270d6b0e8835d0accb552ee8680
|
4
|
+
data.tar.gz: e33af97cec39ed8d4a69a8adc80d0ec4aacbfd6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9e67e9a0b26c9376676425c0e0e2eea2b62d0f2acd3816dc72f0f7f05fffdee032d496b14fb0be14dc28760f547a5810eda9d8431ec7bb28a89c1934f685aee
|
7
|
+
data.tar.gz: 682817301e9e66c90564b0c74a7273f4cf9fc17128029f0373b100b0af2df8149e917e0f46e65d8c7ed93ea5410c8bac3cebcab573f66d2a8040c12fba61391f
|
data/bin/quarshan
CHANGED
@@ -14,25 +14,27 @@ require 'darshan'
|
|
14
14
|
require 'optparse'
|
15
15
|
|
16
16
|
# List of Darshan modules
|
17
|
-
$darshan_mods = {
|
17
|
+
$darshan_mods = {
|
18
|
+
"POSIX" => Darshan::POSIX,
|
18
19
|
"MPI-IO" => Darshan::MPIIO,
|
19
20
|
"HDF5" => Darshan::HDF5,
|
20
21
|
"PNETCDF" => Darshan::PNETCDF,
|
21
22
|
"BG/Q" => Darshan::BGQ,
|
22
23
|
"LUSTRE" => Darshan::LUSTRE,
|
23
|
-
"STDIO" => Darshan::STDIO
|
24
|
+
"STDIO" => Darshan::STDIO
|
25
|
+
}
|
24
26
|
|
25
27
|
# List of available reduction operations
|
26
28
|
$reduction_ops = ['min','max','avg','var','std','med', 'sum']
|
27
29
|
|
28
30
|
# Structure for option parsing
|
29
|
-
Options = Struct.new(:counters,:query,:reductions,:header,:files,:mod,:qcounters)
|
31
|
+
Options = Struct.new(:counters,:query,:reductions,:header,:prefix,:files,:mod,:qcounters,:info)
|
30
32
|
|
31
33
|
# Option parsing class
|
32
34
|
class Parser
|
33
35
|
|
34
36
|
def self.parse(options)
|
35
|
-
args = Options.new([],'true',[],false,[],nil,[])
|
37
|
+
args = Options.new([],'true',[],false,'',[],nil,[],false)
|
36
38
|
opt_parser = OptionParser.new do |opts|
|
37
39
|
opts.banner = "Usage: quarshan file1 [file2 [...]] [options]"
|
38
40
|
|
@@ -52,6 +54,14 @@ class Parser
|
|
52
54
|
args.reductions = r.split(',')
|
53
55
|
end
|
54
56
|
|
57
|
+
opts.on("-p", "--prefix PREFIX", "Prefixes that file records should have to be considered") do |r|
|
58
|
+
args.prefix = r
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on("-i", "--info", "Prints information about files that satisfy a query") do | r |
|
62
|
+
args.info = true
|
63
|
+
end
|
64
|
+
|
55
65
|
opts.on("-h", "--help", "Prints this help") do
|
56
66
|
puts opts
|
57
67
|
exit
|
@@ -64,8 +74,9 @@ class Parser
|
|
64
74
|
end
|
65
75
|
|
66
76
|
def self.validate(args)
|
67
|
-
# check that at least one counter is provided, otherwise we can exit right now
|
68
|
-
|
77
|
+
# check that at least one counter is provided, otherwise we can exit right now,
|
78
|
+
# unless the user wants the file's informations
|
79
|
+
if(args.counters.size == 0 && args.info == false)
|
69
80
|
exit(0)
|
70
81
|
end
|
71
82
|
# check that if reductions are present, there are as many as counters, or 1
|
@@ -87,15 +98,17 @@ class Parser
|
|
87
98
|
end
|
88
99
|
end
|
89
100
|
# deduce the module based on the first counter's name
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
101
|
+
if args.counters.size != 0
|
102
|
+
for name,mod in $darshan_mods
|
103
|
+
counter = args.counters[0]
|
104
|
+
if(mod::NAMES.include?(counter))
|
105
|
+
args.mod = mod
|
106
|
+
break
|
107
|
+
end
|
95
108
|
end
|
96
109
|
end
|
97
110
|
# if module not found, error
|
98
|
-
if(args.mod == nil)
|
111
|
+
if(args.mod == nil && args.counters.size != 0)
|
99
112
|
$stderr << "Could not deduce Darshan module from provided counters\n"
|
100
113
|
exit(-1)
|
101
114
|
end
|
@@ -146,8 +159,10 @@ class Query
|
|
146
159
|
@header = args.header
|
147
160
|
@mod = args.mod
|
148
161
|
@query = args.query
|
162
|
+
@prefix = args.prefix == [] ? "" : args.prefix
|
149
163
|
@counters = args.counters
|
150
164
|
@qcounters = args.qcounters
|
165
|
+
@info = args.info
|
151
166
|
@counters_idx = [nil]*@counters.size
|
152
167
|
@qcounters_idx = [nil]*@counters.size
|
153
168
|
for i in 0...@counters.size
|
@@ -158,31 +173,78 @@ class Query
|
|
158
173
|
end
|
159
174
|
@reductions = args.reductions
|
160
175
|
@results = []
|
176
|
+
# @results[0] is a column of record names
|
177
|
+
# @results[1] to @results[@counters.size] are columns of results
|
178
|
+
# @results[@counters.size+1] is a hash associating a line X to a LogFileInfo object
|
161
179
|
(@counters.size+1).times do
|
162
180
|
@results << []
|
163
181
|
end
|
182
|
+
@results << {} # for LogFileInfo
|
183
|
+
end
|
184
|
+
|
185
|
+
def get_logfile_info(file,mods=[])
|
186
|
+
res = "# ----- NEW LOG FILE ----\n"
|
187
|
+
res += "# name: #{file.name}\n"
|
188
|
+
res += "# darshan version: #{file.version}\n"
|
189
|
+
res += "# executable: #{file.exe}\n"
|
190
|
+
res += "# uid: #{file.uid}\n"
|
191
|
+
res += "# job id: #{file.job_id}\n"
|
192
|
+
res += "# nprocs: #{file.nprocs}\n"
|
193
|
+
res += "# start time: #{file.start_time}\n"
|
194
|
+
res += "# end time: #{file.end_time}\n"
|
195
|
+
res += "# metadata: #{file.metadata}\n"
|
196
|
+
res += "# mount points: \n"
|
197
|
+
file.mount_points.each do | mp |
|
198
|
+
res += "#\t#{mp[:path]} (#{mp[:type]})\n"
|
199
|
+
end
|
200
|
+
res += "# modules:"
|
201
|
+
for m in mods
|
202
|
+
res += " #{m}"
|
203
|
+
end
|
204
|
+
res += "\n"
|
205
|
+
return res
|
164
206
|
end
|
165
207
|
|
166
208
|
def read_file(filename)
|
209
|
+
current_line = @results[0].size
|
167
210
|
Darshan::LogFile.open(filename) do |file|
|
211
|
+
log_processed = false
|
212
|
+
modules_present = []
|
168
213
|
file.each_module do | m |
|
214
|
+
modules_present << m.name
|
169
215
|
next if @mod != $darshan_mods[m.name]
|
170
216
|
m.each_record do | r |
|
171
|
-
|
217
|
+
if r.name.start_with?(@prefix)
|
218
|
+
b = process_record(r)
|
219
|
+
log_processed = true if b
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
if (log_processed || @counters.size == 0) && @info
|
224
|
+
idx = 0
|
225
|
+
if @counters.size == 0
|
226
|
+
idx = @results[-1].size
|
227
|
+
else
|
228
|
+
idx = current_line
|
172
229
|
end
|
230
|
+
@results[-1][idx] = get_logfile_info(file,modules_present)
|
173
231
|
end
|
174
232
|
end
|
175
233
|
end
|
176
234
|
|
177
235
|
def process_record(record)
|
178
|
-
return if(!query_satisfied(record))
|
236
|
+
return false if(!query_satisfied(record))
|
179
237
|
@results[0] << record.name
|
180
238
|
for i in 0...@counters_idx.size
|
181
239
|
@results[i+1] << record.counter(@counters_idx[i])
|
182
240
|
end
|
241
|
+
return true
|
183
242
|
end
|
184
243
|
|
185
244
|
def query_satisfied(record)
|
245
|
+
if @counters.size == 0
|
246
|
+
return false
|
247
|
+
end
|
186
248
|
str = ""
|
187
249
|
for i in 0...@qcounters.size
|
188
250
|
str += "#{@qcounters[i].downcase}=#{record.counter(@qcounters_idx[i])}; "
|
@@ -201,7 +263,7 @@ class Query
|
|
201
263
|
|
202
264
|
def to_s
|
203
265
|
res = ""
|
204
|
-
if(@header)
|
266
|
+
if(@header && @counters.size != 0)
|
205
267
|
res += "# records\t"
|
206
268
|
for i in 0...@counters.size
|
207
269
|
if(@reductions.size == 0)
|
@@ -212,11 +274,22 @@ class Query
|
|
212
274
|
end
|
213
275
|
res += "\n"
|
214
276
|
end
|
215
|
-
|
216
|
-
|
277
|
+
|
278
|
+
if @counters.size != 0
|
279
|
+
for j in 0...@results[0].size # for all rows
|
280
|
+
if (@results[-1][j] != nil) && (@reductions.size == 0)
|
281
|
+
# print the file info
|
282
|
+
res += "#{@results[-1][j]}"
|
283
|
+
end
|
284
|
+
for i in 0...(@results.size-1) # for all columns
|
217
285
|
res += "#{@results[i][j]}\t"
|
218
286
|
end
|
219
287
|
res += "\n"
|
288
|
+
end
|
289
|
+
else # @counters.size == 0
|
290
|
+
@results[-1].each do |k,v|
|
291
|
+
res += v
|
292
|
+
end
|
220
293
|
end
|
221
294
|
return res
|
222
295
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darshan-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Dorier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby binding to ANL's Darshan library for HPC I/O tracing and analysis
|
14
14
|
email: mdorier@anl.gov
|
@@ -63,5 +63,5 @@ rubyforge_project: nowarning
|
|
63
63
|
rubygems_version: 2.5.1
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
|
-
summary: Ruby binding to Darshan version 3.1.
|
66
|
+
summary: Ruby binding to Darshan version 3.1.4 and above
|
67
67
|
test_files: []
|