Class: Darshan::LogFile

Inherits:
Object
  • Object
show all
Defined in:
lib/darshan.rb,
ext/darshan/darshan.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

#end_timeObject (readonly)

Returns the value of attribute end_time.



47
48
49
# File 'lib/darshan.rb', line 47

def end_time
  @end_time
end

#exeObject (readonly)

Returns the value of attribute exe.



43
44
45
# File 'lib/darshan.rb', line 43

def exe
  @exe
end

#job_idObject (readonly)

Returns the value of attribute job_id.



48
49
50
# File 'lib/darshan.rb', line 48

def job_id
  @job_id
end

#magic_numberObject (readonly)

Returns the value of attribute magic_number.



44
45
46
# File 'lib/darshan.rb', line 44

def magic_number
  @magic_number
end

#metadataObject (readonly)

Returns the value of attribute metadata.



50
51
52
# File 'lib/darshan.rb', line 50

def 
  @metadata
end

#mount_pointsObject (readonly)

Returns the value of attribute mount_points.



51
52
53
# File 'lib/darshan.rb', line 51

def mount_points
  @mount_points
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/darshan.rb', line 41

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



49
50
51
# File 'lib/darshan.rb', line 49

def size
  @size
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



46
47
48
# File 'lib/darshan.rb', line 46

def start_time
  @start_time
end

#uidObject (readonly)

Returns the value of attribute uid.



45
46
47
# File 'lib/darshan.rb', line 45

def uid
  @uid
end

#versionObject (readonly)

Returns the value of attribute version.



42
43
44
# File 'lib/darshan.rb', line 42

def version
  @version
end

Class Method Details

.open(filename, mode = "r") ⇒ Object

#

Opens a logfile, calls the given block if present.

#


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

def self.open(filename,mode="r")
	lf = Darshan.open(filename,mode)
	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_fileObject

#

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_file
	if not block_given?
		return nil
	end
	file = nil
	while((file = next_file()) != nil)
		yield file
	end
	return nil
end

#next_fileObject

Within: Darshan::LogFile class Returns the next Darshan::File entry from the log file, or nil if there is no more such an entry.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'ext/darshan/darshan.c', line 133

static VALUE rb_darshan_next_file(VALUE self)
{
	
	darshan_fd fd = NULL;
	Data_Get_Struct(self,struct darshan_fd_s, fd);
	if(fd == NULL) return Qnil;
	struct darshan_file* file = NULL;
	VALUE rb_file = Data_Make_Struct(cDarshanFile, 
			struct darshan_file, 
			NULL, free, file);
	Data_Get_Struct(rb_file, struct darshan_file, file);
	if(file == NULL) return Qnil;
	// if Darshan starts using the 2nd argument of
	// log_getfile, we'll have a problem
	if(darshan_log_getfile(fd, NULL, file) != 1) {
		return Qnil;
	}
	return rb_file;
}