Class: Darshan::LogFile

Inherits:
Object
  • Object
show all
Defined in:
lib/darshan.rb,
ext/darshan/darshan-ruby.c

Overview

#

LogFile class, represents a binary log file (compressed). Open it by using logfile = LogFile.open(“filename”) … logfile.close or LogFile.open(“filename”) do | logfile | … end

#

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exeObject (readonly)

Returns the value of attribute exe.



31
32
33
# File 'lib/darshan.rb', line 31

def exe
  @exe
end

#job_idObject (readonly)

Returns the value of attribute job_id.



33
34
35
# File 'lib/darshan.rb', line 33

def job_id
  @job_id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



35
36
37
# File 'lib/darshan.rb', line 35

def 
  
end

#mount_pointsObject (readonly)

Returns the value of attribute mount_points.



36
37
38
# File 'lib/darshan.rb', line 36

def mount_points
  @mount_points
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/darshan.rb', line 29

def name
  @name
end

#nprocsObject (readonly)

Returns the value of attribute nprocs.



34
35
36
# File 'lib/darshan.rb', line 34

def nprocs
  @nprocs
end

#uidObject (readonly)

Returns the value of attribute uid.



32
33
34
# File 'lib/darshan.rb', line 32

def uid
  @uid
end

#versionObject (readonly)

Returns the value of attribute version.



30
31
32
# File 'lib/darshan.rb', line 30

def version
  @version
end

Class Method Details

.create(filename) ⇒ Object

#

Creates a logfile, calls the given block if present. The file is open for writing.

#


56
57
58
59
60
61
62
63
64
# File 'lib/darshan.rb', line 56

def self.create(filename)
  lf = Darshan.create(filename)
  if block_given? and lf != nil
    yield lf
    lf.close
    lf = nil
  end
  return lf
end

.open(filename) ⇒ Object

#

Opens a logfile, calls the given block if present. The file is open for reading only.

#


42
43
44
45
46
47
48
49
50
# File 'lib/darshan.rb', line 42

def self.open(filename)
  lf = Darshan.open(filename)
  if block_given? and lf != nil
    yield lf
    lf.close
    lf = nil
  end
  return lf
end

Instance Method Details

#closeObject

#

Close the file.

#


69
70
71
# File 'lib/darshan.rb', line 69

def close
  Darshan.close(self)
end

#each_moduleObject

#

Iterates through all the file entries described in the log file.

#


77
78
79
80
81
82
83
84
85
86
# File 'lib/darshan.rb', line 77

def each_module
  if not block_given?
    return nil
  end
  mod = nil
  while((mod = next_module()) != nil)
    yield mod
  end
  return nil
end

#end_timeObject



96
97
98
# File 'lib/darshan.rb', line 96

def end_time
  Time.at(@end_time)
end

#next_moduleObject

Within: Darshan::Module LogFile class Returns the next Darshan::Module entry from the log file, or nil if there is no more modules to read.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'ext/darshan/darshan-ruby.c', line 137

static VALUE rb_darshan_next_module(VALUE self) 
{
  darshan_fd fd = NULL;
  Data_Get_Struct(self,struct darshan_fd_s, fd);
  if(fd == NULL) return Qnil;
  int i = NUM2INT(rb_iv_get(self,"@current_module"));
  i +=1;

  while(fd->mod_map[i].len == 0 && i < DARSHAN_MAX_MODS) i++;
  if(i >= DARSHAN_MAX_MODS || (!mod_logutils[i])) {
    rb_iv_set(self,"@current_module",INT2NUM(i));
    return Qnil;
  }
  // Creat a Darshan::Module object
  VALUE argv[0];
  VALUE res = rb_class_new_instance(0, argv, cDarshanModule);
  VALUE name = rb_str_new2(darshan_module_names[i]);
  VALUE length = LL2NUM(fd->mod_map[i].len);

  rb_iv_set(res,"@name", name);
  rb_iv_set(res,"@length", length);

  rb_iv_set(res,"@fd",self);
  rb_iv_set(res,"@index",  INT2NUM(i));

  rb_iv_set(self,"@current_module",INT2NUM(i));

  return res;
}

#partial?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/darshan.rb', line 88

def partial?
  @partial
end

#start_timeObject



92
93
94
# File 'lib/darshan.rb', line 92

def start_time
  Time.at(@start_time)
end