9
9
* Keith Seitz <keiths@redhat.com> - initial API and implementation
10
* Kent Sebastian <ksebasti@redhat.com> -
11
*******************************************************************************/
10
* Kent Sebastian <ksebasti@redhat.com> -
11
*******************************************************************************/
13
13
package org.eclipse.linuxtools.internal.oprofile.core.model;
15
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
16
18
* A class which represents the event collected in a given session.
18
20
public class OpModelEvent {
19
private String eventName;
20
private OpModelSession[] sessions;
21
private String printTabs = ""; //for nice output //$NON-NLS-1$
23
public OpModelEvent(String name) {
27
public OpModelSession[] getSessions() {
31
public void setSessions(OpModelSession[] sessions) {
32
this.sessions = sessions;
35
public String getName() {
39
//populate all sessions
40
public void refreshModel() {
41
if (sessions != null) {
42
for (int i = 0; i < sessions.length; i++) {
43
sessions[i].refreshModel();
48
public String toString(String tabs) {
50
String s = toString();
51
printTabs = ""; //$NON-NLS-1$
56
public String toString() {
57
String s = eventName + "\n"; //$NON-NLS-1$
58
if (sessions != null) {
59
for (int i = 0; i < sessions.length; i++) {
60
s += printTabs + "Session: "; //$NON-NLS-1$
61
s += sessions[i].toString(printTabs + "\t"); //$NON-NLS-1$
21
private String eventName;
22
private String printTabs = ""; //for nice output //$NON-NLS-1$
23
private OpModelImage image;
24
private OpModelSession parentSession;
27
public OpModelEvent(OpModelSession parentSession ,String name) {
28
this.parentSession = parentSession;
29
this.eventName = name;
32
public String getName() {
36
public OpModelSession getSession() {
40
//populate all images & dependent images
41
public void refreshModel() {
42
image = getNewImage();
45
public OpModelImage getImage() {
49
protected OpModelImage getNewImage() {
50
return Oprofile.getModelData(this.eventName, parentSession.getName());
53
public int getCount() {
57
return image.getCount();
61
public String toString(String tabs) {
63
String s = toString();
64
printTabs = ""; //$NON-NLS-1$
69
public String toString() {
70
String s = eventName + "\n"; //$NON-NLS-1$
72
s += printTabs + "Image: "; //$NON-NLS-1$
73
s += image.toString(printTabs + "\t"); //$NON-NLS-1$