darshan-ruby 3.0.0 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1e3b14bb796900d053874e17ed26540b32855f0
4
- data.tar.gz: 075a3a3789edf6237427d869403ab45f228b4a0f
3
+ metadata.gz: e67929f858f4576da2761e4ff3f1aac6abe604d9
4
+ data.tar.gz: d3111becbbe77576d8fa6809d76ebae77a78a826
5
5
  SHA512:
6
- metadata.gz: bbe57d68844f84f2f69837727decab1b98884137f3d907b713c50500c6deebfe44a3c2e4f643b17edc534d5a6f8bc4eb483292e0b8b1d186fcebe87f9bfe2afd
7
- data.tar.gz: 6396e0d9ed8d20487a8d148ffdd33ea4a8fc5b0c2d8482b2b1f92536f98342e8c56c4faaf5dedec27e283fa0dd4d5360ac8a818c0ca96907ea6487916b9d3c3e
6
+ metadata.gz: 733b3ef723604deb9d01b5034d983cd902628e861ff6d57aa5b8d7f05425cccdc8e3a040d6df007a1e56235723a5cd18cf7b6fc6113b5b5e73386ab3897873a2
7
+ data.tar.gz: d30095626d87f7a9f86219d63d6656a15730dd557f7993061f7746e07d4de5b22b37bba080b1c5911bb77598d080ba27d1317aa5ad7fa11d3009d5b602da7a73
@@ -15,23 +15,15 @@ VALUE mDarshanBGQ;
15
15
  static VALUE Darshan3rb_bgq_get_rank(VALUE self)
16
16
  {
17
17
  struct darshan_bgq_record* c_record = NULL;
18
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
19
- if(c_record) return LL2NUM(c_record->rank);
20
- else return Qnil;
21
- }
22
-
23
- static VALUE Darshan3rb_bgq_get_alignment(VALUE self)
24
- {
25
- struct darshan_bgq_record* c_record = NULL;
26
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
27
- if(c_record) return INT2NUM(c_record->alignment);
18
+ Data_Get_Struct(self,struct darshan_bgq_record,c_record);
19
+ if(c_record) return LL2NUM(c_record->base_rec.rank);
28
20
  else return Qnil;
29
21
  }
30
22
 
31
23
  static VALUE Darshan3rb_bgq_get_counter(VALUE self, VALUE index)
32
24
  {
33
25
  struct darshan_bgq_record* c_record = NULL;
34
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
26
+ Data_Get_Struct(self,struct darshan_bgq_record,c_record);
35
27
  int i = NUM2INT(index);
36
28
  if((i < 0) || (c_record == NULL)) return Qnil;
37
29
  if(i < BGQ_NUM_INDICES) return LL2NUM(c_record->counters[i]);
@@ -59,15 +51,14 @@ void Darshan3rb_init_bgq()
59
51
  cDarshanBGQRecord = rb_define_class_under(mDarshanBGQ,"Record",cDarshanRecord);
60
52
  rb_define_method(cDarshanBGQRecord,"rank",Darshan3rb_bgq_get_rank,0);
61
53
  rb_define_method(cDarshanBGQRecord,"counter",Darshan3rb_bgq_get_counter,1);
62
- rb_define_method(cDarshanBGQRecord,"alignment",Darshan3rb_bgq_get_alignment,0);
63
54
  }
64
55
 
65
56
  VALUE Darshan3rb_get_bgq_record(darshan_fd fd, darshan_record_id* rec_id)
66
57
  {
67
- struct darshan_bgq_record* c_record = (struct darshan_bgq_record*)malloc(sizeof(struct darshan_bgq_record));
68
- int r = mod_logutils[DARSHAN_BGQ_MOD]->log_get_record(fd, (char*)c_record, rec_id);
58
+ struct darshan_bgq_record* c_record = NULL;
59
+ int r = mod_logutils[DARSHAN_BGQ_MOD]->log_get_record(fd, (void**)&c_record);
69
60
  if(r != 1) return Qnil;
70
-
61
+ *rec_id = c_record->base_rec.id;
71
62
  VALUE rb_record = Data_Wrap_Struct(cDarshanBGQRecord, NULL , free, c_record);
72
63
  return rb_record;
73
64
  }
@@ -27,7 +27,7 @@ static VALUE rb_darshan_open(VALUE self, VALUE name)
27
27
 
28
28
  // get the job struct
29
29
  struct darshan_job job;
30
- int err = darshan_log_getjob(fd,&job);
30
+ int err = darshan_log_get_job(fd,&job);
31
31
 
32
32
  if(err < 0) return Qnil;
33
33
 
@@ -63,8 +63,9 @@ static VALUE rb_darshan_open(VALUE self, VALUE name)
63
63
  rb_iv_set(res,"@metadata", metadata);
64
64
 
65
65
  // set the executable name
66
- char exe[DARSHAN_EXE_LEN+2];
67
- err = darshan_log_getexe(fd, exe);
66
+ char exe[DARSHAN_EXE_LEN+1];
67
+ memset(exe,0,DARSHAN_EXE_LEN+1);
68
+ err = darshan_log_get_exe(fd, exe);
68
69
 
69
70
  if(err < 0) return Qnil;
70
71
 
@@ -75,10 +76,9 @@ static VALUE rb_darshan_open(VALUE self, VALUE name)
75
76
  rb_iv_set(res,"@current_module", INT2NUM(-1));
76
77
 
77
78
  // set the list of mount points
78
- char** mnt_pts = NULL;
79
- char** fs_types = NULL;
80
79
  int count = 0;
81
- err = darshan_log_getmounts(fd,&mnt_pts,&fs_types,&count);
80
+ struct darshan_mnt_info *mnt_info;
81
+ err = darshan_log_get_mounts(fd,&mnt_info,&count);
82
82
 
83
83
  if(err < 0) {
84
84
  return Qnil;
@@ -90,22 +90,17 @@ static VALUE rb_darshan_open(VALUE self, VALUE name)
90
90
  int i;
91
91
  for(i=0; i<count; i++) {
92
92
  VALUE hash = rb_hash_new();
93
- rb_hash_aset(hash,path,rb_str_new2(mnt_pts[i]));
94
- rb_hash_aset(hash,type,rb_str_new2(fs_types[i]));
93
+ rb_hash_aset(hash,path,rb_str_new2(mnt_info[i].mnt_path));
94
+ rb_hash_aset(hash,type,rb_str_new2(mnt_info[i].mnt_type));
95
95
  rb_ary_store(mp,i,hash);
96
- if(mnt_pts != NULL && mnt_pts[i] != NULL)
97
- free(mnt_pts[i]);
98
- if(fs_types != NULL && fs_types[i] != NULL)
99
- free(fs_types[i]);
100
96
  }
97
+ if(mnt_info) free(mnt_info);
101
98
 
102
- if(mnt_pts != NULL) free(mnt_pts);
103
- if(fs_types != NULL) free(fs_types);
104
99
  rb_iv_set(res,"@mount_points", mp);
105
100
 
106
101
  // get the hash
107
- struct darshan_record_ref *rec_hash = NULL;
108
- err = darshan_log_gethash(fd, &rec_hash);
102
+ struct darshan_name_record_ref *rec_hash = NULL;
103
+ err = darshan_log_get_namehash(fd, &rec_hash);
109
104
  if(err < 0) {
110
105
  return Qnil;
111
106
  }
@@ -185,8 +180,8 @@ static VALUE rb_darshan_next_record(VALUE self)
185
180
  if(fd == NULL) return Qnil;
186
181
 
187
182
  VALUE rbhash = rb_iv_get(rfd,"@hash");
188
- struct darshan_record_ref* rec_hash = NULL;
189
- Data_Get_Struct(rbhash,struct darshan_record_ref, rec_hash);
183
+ struct darshan_name_record_ref* rec_hash = NULL;
184
+ Data_Get_Struct(rbhash,struct darshan_name_record_ref, rec_hash);
190
185
  if(rec_hash == NULL) return Qnil;
191
186
 
192
187
  darshan_record_id rec_id;
@@ -211,14 +206,17 @@ static VALUE rb_darshan_next_record(VALUE self)
211
206
  case DARSHAN_BGQ_MOD:
212
207
  res = Darshan3rb_get_bgq_record(fd,&rec_id);
213
208
  break;
209
+ case DARSHAN_LUSTRE_MOD:
210
+ res = Darshan3rb_get_lustre_record(fd,&rec_id);
211
+ break;
214
212
  }
215
213
 
216
214
  if(res == Qnil) return Qnil;
217
215
 
218
- struct darshan_record_ref* ref;
216
+ struct darshan_name_record_ref* ref;
219
217
  HASH_FIND(hlink, rec_hash, &rec_id, sizeof(darshan_record_id), ref);
220
218
 
221
- rb_iv_set(res,"@name",rb_str_new2(ref->rec.name));
219
+ rb_iv_set(res,"@name",rb_str_new2(ref->name_record->name));
222
220
 
223
221
  return res;
224
222
  }
@@ -244,6 +242,7 @@ void Init_Darshan3rb() {
244
242
  Darshan3rb_init_hdf5();
245
243
  Darshan3rb_init_pnetcdf();
246
244
  Darshan3rb_init_bgq();
245
+ Darshan3rb_init_lustre();
247
246
 
248
247
  rb_define_method(cDarshanLogFile,"next_module",
249
248
  rb_darshan_next_module,0);
@@ -15,5 +15,6 @@
15
15
  #include "hdf5-module.h"
16
16
  #include "pnetcdf-module.h"
17
17
  #include "bgq-module.h"
18
+ #include "lustre-module.h"
18
19
 
19
20
  #endif
@@ -15,15 +15,15 @@ VALUE mDarshanHDF5;
15
15
  static VALUE Darshan3rb_hdf5_get_rank(VALUE self)
16
16
  {
17
17
  struct darshan_hdf5_file* c_record = NULL;
18
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
19
- if(c_record) return LL2NUM(c_record->rank);
18
+ Data_Get_Struct(self,struct darshan_hdf5_file,c_record);
19
+ if(c_record) return LL2NUM(c_record->base_rec.rank);
20
20
  else return Qnil;
21
21
  }
22
22
 
23
23
  static VALUE Darshan3rb_hdf5_get_counter(VALUE self, VALUE index)
24
24
  {
25
25
  struct darshan_hdf5_file* c_record = NULL;
26
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
26
+ Data_Get_Struct(self, struct darshan_hdf5_file, c_record);
27
27
  int i = NUM2INT(index);
28
28
  if((i < 0) || (c_record == NULL)) return Qnil;
29
29
  if(i < HDF5_NUM_INDICES) return LL2NUM(c_record->counters[i]);
@@ -55,10 +55,10 @@ void Darshan3rb_init_hdf5()
55
55
 
56
56
  VALUE Darshan3rb_get_hdf5_record(darshan_fd fd, darshan_record_id* rec_id)
57
57
  {
58
- struct darshan_hdf5_file* c_record = (struct darshan_hdf5_file*)malloc(sizeof(struct darshan_hdf5_file));
59
- int r = mod_logutils[DARSHAN_HDF5_MOD]->log_get_record(fd, (char*)c_record, rec_id);
58
+ struct darshan_hdf5_file* c_record = NULL;
59
+ int r = mod_logutils[DARSHAN_HDF5_MOD]->log_get_record(fd, (void**)&c_record);
60
60
  if(r != 1) return Qnil;
61
-
61
+ *rec_id = c_record->base_rec.id;
62
62
  VALUE rb_record = Data_Wrap_Struct(cDarshanHDF5Record, NULL , free, c_record);
63
63
  return rb_record;
64
64
  }
@@ -8,4 +8,4 @@
8
8
 
9
9
  void Darshan3rb_init_hdf5();
10
10
 
11
- VALUE Darshan3rb_get_hdf5_record(darshan_fd fd, darshan_record_id* rec_id);
11
+ VALUE Darshan3rb_get_hdf5_record(darshan_fd fd, darshan_record_id* id);
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Copyright (C) 2015 University of Chicago.
3
+ * See COPYRIGHT notice in top-level directory.
4
+ *
5
+ */
6
+
7
+ #include "darshan-ruby.h"
8
+
9
+ extern VALUE cDarshanRecord;
10
+ extern VALUE mDarshan;
11
+
12
+ VALUE cDarshanLustreRecord;
13
+ VALUE mDarshanLustre;
14
+
15
+ static VALUE Darshan3rb_lustre_get_counter(VALUE self, VALUE index)
16
+ {
17
+ struct darshan_lustre_record* c_record = NULL;
18
+ Data_Get_Struct(self,struct darshan_lustre_record, c_record);
19
+ int i = NUM2INT(index);
20
+ if((i < 0) || (c_record == NULL)) return Qnil;
21
+ if(i < LUSTRE_NUM_INDICES) return LL2NUM(c_record->counters[i]);
22
+ else return Qnil;
23
+ }
24
+
25
+ static VALUE Darshan3rb_lustre_get_osts(VALUE self)
26
+ {
27
+ struct darshan_lustre_record* c_record = NULL;
28
+ Data_Get_Struct(self,struct darshan_lustre_record, c_record);
29
+ size_t num_osts = c_record->counters[LUSTRE_STRIPE_WIDTH];
30
+ VALUE res = rb_ary_new2(num_osts);
31
+ int i;
32
+ for(i=0; i<num_osts; i++) {
33
+ rb_ary_store(res,i,LL2NUM(c_record->ost_ids[i]));
34
+ }
35
+ return res;
36
+ }
37
+
38
+ void Darshan3rb_init_lustre()
39
+ {
40
+ mDarshanLustre = rb_define_module_under(mDarshan,"Lustre");
41
+
42
+ VALUE cnames = rb_ary_new2(LUSTRE_NUM_INDICES);
43
+ int i;
44
+ for(i=0; i < LUSTRE_NUM_INDICES; i++) {
45
+ rb_ary_store(cnames,i,rb_str_new2(mpiio_counter_names[i]));
46
+ rb_define_const(mDarshanLustre,mpiio_counter_names[i],INT2NUM(i));
47
+ }
48
+ rb_define_const(mDarshanLustre,"NAMES",cnames);
49
+
50
+ cDarshanLustreRecord = rb_define_class_under(mDarshanLustre,"Record",cDarshanRecord);
51
+ rb_define_method(cDarshanLustreRecord,"counter",Darshan3rb_lustre_get_counter,1);
52
+ rb_define_method(cDarshanLustreRecord,"osts",Darshan3rb_lustre_get_osts,0);
53
+ }
54
+
55
+ VALUE Darshan3rb_get_lustre_record(darshan_fd fd, darshan_record_id* rec_id)
56
+ {
57
+ struct darshan_lustre_record* c_record = NULL;
58
+ int r = mod_logutils[DARSHAN_LUSTRE_MOD]->log_get_record(fd, (void**)&c_record);
59
+ if(r != 1) return Qnil;
60
+ *rec_id = c_record->base_rec.id;
61
+ VALUE rb_record = Data_Wrap_Struct(cDarshanLustreRecord, NULL , free, c_record);
62
+ return rb_record;
63
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (C) 2015 University of Chicago.
3
+ * See COPYRIGHT notice in top-level directory.
4
+ *
5
+ */
6
+
7
+ #include <ruby.h>
8
+
9
+ void Darshan3rb_init_lustre();
10
+
11
+ VALUE Darshan3rb_get_lustre_record(darshan_fd fd, darshan_record_id* rec_id);
@@ -15,15 +15,15 @@ VALUE mDarshanMPIIO;
15
15
  static VALUE Darshan3rb_mpiio_get_rank(VALUE self)
16
16
  {
17
17
  struct darshan_mpiio_file* c_record = NULL;
18
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
19
- if(c_record) return LL2NUM(c_record->rank);
18
+ Data_Get_Struct(self,struct darshan_mpiio_file,c_record);
19
+ if(c_record) return LL2NUM(c_record->base_rec.rank);
20
20
  else return Qnil;
21
21
  }
22
22
 
23
23
  static VALUE Darshan3rb_mpiio_get_counter(VALUE self, VALUE index)
24
24
  {
25
25
  struct darshan_mpiio_file* c_record = NULL;
26
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
26
+ Data_Get_Struct(self,struct darshan_mpiio_file,c_record);
27
27
  int i = NUM2INT(index);
28
28
  if((i < 0) || (c_record == NULL)) return Qnil;
29
29
  if(i < MPIIO_NUM_INDICES) return LL2NUM(c_record->counters[i]);
@@ -55,10 +55,10 @@ void Darshan3rb_init_mpiio()
55
55
 
56
56
  VALUE Darshan3rb_get_mpiio_record(darshan_fd fd, darshan_record_id* rec_id)
57
57
  {
58
- struct darshan_mpiio_file* c_record = (struct darshan_mpiio_file*)malloc(sizeof(struct darshan_mpiio_file));
59
- int r = mod_logutils[DARSHAN_MPIIO_MOD]->log_get_record(fd, (char*)c_record, rec_id);
58
+ struct darshan_mpiio_file* c_record = NULL;
59
+ int r = mod_logutils[DARSHAN_MPIIO_MOD]->log_get_record(fd, (void**)&c_record);
60
60
  if(r != 1) return Qnil;
61
-
61
+ *rec_id = c_record->base_rec.id;
62
62
  VALUE rb_record = Data_Wrap_Struct(cDarshanMPIIORecord, NULL , free, c_record);
63
63
  return rb_record;
64
64
  }
@@ -15,15 +15,15 @@ VALUE mDarshanPNETCDF;
15
15
  static VALUE Darshan3rb_pnetcdf_get_rank(VALUE self)
16
16
  {
17
17
  struct darshan_pnetcdf_file* c_record = NULL;
18
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
19
- if(c_record) return LL2NUM(c_record->rank);
18
+ Data_Get_Struct(self,struct darshan_pnetcdf_file,c_record);
19
+ if(c_record) return LL2NUM(c_record->base_rec.rank);
20
20
  else return Qnil;
21
21
  }
22
22
 
23
23
  static VALUE Darshan3rb_pnetcdf_get_counter(VALUE self, VALUE index)
24
24
  {
25
25
  struct darshan_pnetcdf_file* c_record = NULL;
26
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
26
+ Data_Get_Struct(self,struct darshan_pnetcdf_file,c_record);
27
27
  int i = NUM2INT(index);
28
28
  if((i < 0) || (c_record == NULL)) return Qnil;
29
29
  if(i < PNETCDF_NUM_INDICES) return LL2NUM(c_record->counters[i]);
@@ -55,10 +55,10 @@ void Darshan3rb_init_pnetcdf()
55
55
 
56
56
  VALUE Darshan3rb_get_pnetcdf_record(darshan_fd fd, darshan_record_id* rec_id)
57
57
  {
58
- struct darshan_pnetcdf_file* c_record = (struct darshan_pnetcdf_file*)malloc(sizeof(struct darshan_pnetcdf_file));
59
- int r = mod_logutils[DARSHAN_PNETCDF_MOD]->log_get_record(fd, (char*)c_record, rec_id);
58
+ struct darshan_pnetcdf_file* c_record = NULL;
59
+ int r = mod_logutils[DARSHAN_PNETCDF_MOD]->log_get_record(fd, (void**)&c_record);
60
60
  if(r != 1) return Qnil;
61
-
61
+ *rec_id = c_record->base_rec.id;
62
62
  VALUE rb_record = Data_Wrap_Struct(cDarshanPNETCDFRecord, NULL , free, c_record);
63
63
  return rb_record;
64
64
  }
@@ -15,15 +15,15 @@ VALUE mDarshanPOSIX;
15
15
  static VALUE Darshan3rb_posix_get_rank(VALUE self)
16
16
  {
17
17
  struct darshan_posix_file* c_record = NULL;
18
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
19
- if(c_record) return LL2NUM(c_record->rank);
18
+ Data_Get_Struct(self, struct darshan_posix_file, c_record);
19
+ if(c_record) return LL2NUM(c_record->base_rec.rank);
20
20
  else return Qnil;
21
21
  }
22
22
 
23
23
  static VALUE Darshan3rb_posix_get_counter(VALUE self, VALUE index)
24
24
  {
25
25
  struct darshan_posix_file* c_record = NULL;
26
- Data_Get_Struct(self,struct darshan_fd_s,c_record);
26
+ Data_Get_Struct(self,struct darshan_posix_file, c_record);
27
27
  int i = NUM2INT(index);
28
28
  if((i < 0) || (c_record == NULL)) return Qnil;
29
29
  if(i < POSIX_NUM_INDICES) return LL2NUM(c_record->counters[i]);
@@ -55,10 +55,10 @@ void Darshan3rb_init_posix()
55
55
 
56
56
  VALUE Darshan3rb_get_posix_record(darshan_fd fd, darshan_record_id* rec_id)
57
57
  {
58
- struct darshan_posix_file* c_record = (struct darshan_posix_file*)malloc(sizeof(struct darshan_posix_file));
59
- int r = mod_logutils[DARSHAN_POSIX_MOD]->log_get_record(fd, (char*)c_record, rec_id);
58
+ struct darshan_posix_file* c_record = NULL;
59
+ int r = mod_logutils[DARSHAN_POSIX_MOD]->log_get_record(fd, (void**)&c_record);
60
60
  if(r != 1) return Qnil;
61
-
61
+ *rec_id = c_record->base_rec.id;
62
62
  VALUE rb_record = Data_Wrap_Struct(cDarshanPOSIXRecord, NULL , free, c_record);
63
63
  return rb_record;
64
64
  }
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.0.0
4
+ version: 3.1.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: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-10-28 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
@@ -24,6 +24,8 @@ files:
24
24
  - ext/darshan/extconf.rb
25
25
  - ext/darshan/hdf5-module.c
26
26
  - ext/darshan/hdf5-module.h
27
+ - ext/darshan/lustre-module.c
28
+ - ext/darshan/lustre-module.h
27
29
  - ext/darshan/mpiio-module.c
28
30
  - ext/darshan/mpiio-module.h
29
31
  - ext/darshan/pnetcdf-module.c
@@ -55,5 +57,5 @@ rubyforge_project: nowarning
55
57
  rubygems_version: 2.5.1
56
58
  signing_key:
57
59
  specification_version: 4
58
- summary: Ruby binding to Darshan version 3 and above
60
+ summary: Ruby binding to Darshan version 3.1.1 and above
59
61
  test_files: []