Class: Darshan::Module
- Inherits:
-
Object
- Object
- Darshan::Module
- Defined in:
- lib/darshan.rb,
ext/darshan/darshan-ruby.c
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #each_record ⇒ Object
-
#next_record ⇒ Object
Within: Darshan::Module class Returns the next Darshan::Record entry from the module, or nil if there is no more such an entry.
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
105 106 107 |
# File 'lib/darshan.rb', line 105 def index @index end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
104 105 106 |
# File 'lib/darshan.rb', line 104 def length @length end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
103 104 105 |
# File 'lib/darshan.rb', line 103 def name @name end |
Instance Method Details
#each_record ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/darshan.rb', line 107 def each_record return nil if not block_given? rec = nil while((rec = next_record()) != nil) yield rec end return nil end |
#next_record ⇒ Object
Within: Darshan::Module class Returns the next Darshan::Record entry from the module, or nil if there is no more such an entry.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'ext/darshan/darshan-ruby.c', line 171 static VALUE rb_darshan_next_record(VALUE self) { // get the index of the module to access its functions int i = NUM2INT(rb_iv_get(self,"@index")); // get the parent log file descriptor VALUE rfd = rb_iv_get(self,"@fd"); darshan_fd fd = NULL; Data_Get_Struct(rfd,struct darshan_fd_s, fd); if(fd == NULL) return Qnil; VALUE rbhash = rb_iv_get(rfd,"@hash"); struct darshan_name_record_ref* rec_hash = NULL; Data_Get_Struct(rbhash,struct darshan_name_record_ref, rec_hash); if(rec_hash == NULL) return Qnil; darshan_record_id rec_id; VALUE res = Qnil; switch(i) { case DARSHAN_NULL_MOD: res = Qnil; break; case DARSHAN_POSIX_MOD: res = Darshan3rb_get_posix_record(fd,&rec_id); break; case DARSHAN_MPIIO_MOD: res = Darshan3rb_get_mpiio_record(fd,&rec_id); break; case DARSHAN_HDF5_MOD: res = Darshan3rb_get_hdf5_record(fd,&rec_id); break; case DARSHAN_PNETCDF_MOD: res = Darshan3rb_get_pnetcdf_record(fd,&rec_id); break; case DARSHAN_BGQ_MOD: res = Darshan3rb_get_bgq_record(fd,&rec_id); break; case DARSHAN_STDIO_MOD: res = Darshan3rb_get_stdio_record(fd,&rec_id); break; case DARSHAN_LUSTRE_MOD: res = Darshan3rb_get_lustre_record(fd,&rec_id); break; case DXT_POSIX_MOD: res = Darshan3rb_get_dxt_posix_record(fd,&rec_id); break; case DXT_MPIIO_MOD: res = Darshan3rb_get_dxt_mpiio_record(fd,&rec_id); break; } if(res == Qnil) return Qnil; struct darshan_name_record_ref* ref; HASH_FIND(hlink, rec_hash, &rec_id, sizeof(darshan_record_id), ref); rb_iv_set(res,"@name",rb_str_new2(ref->name_record->name)); return res; } |