1
/*******************************************************************************
2
* Copyright (c) 2008, 2009 Red Hat, Inc.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
10
*******************************************************************************/
12
package org.eclipse.linuxtools.internal.oprofile.core.model;
14
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
18
* This class represents oprofile sessions. Sessions contain an image
19
* of the profiled binary.
21
public class OpModelSession {
22
private static final String DEFAULT_SESSION_STRING = "current"; //$NON-NLS-1$
24
private OpModelEvent parentEvent;
25
private OpModelImage image;
27
private String printTabs = ""; //for nice output //$NON-NLS-1$
29
public OpModelSession(OpModelEvent event, String name) {
35
public OpModelImage getImage() {
39
public OpModelEvent getEvent() {
43
public String getName() {
47
public int getCount() {
51
return image.getCount();
55
public boolean isDefaultSession() {
56
return name.equals(DEFAULT_SESSION_STRING);
59
public void refreshModel() {
60
//populate this session with samples
61
image = getNewImage();
64
protected OpModelImage getNewImage() {
65
return Oprofile.getModelData(parentEvent.getName(), name);
68
public String toString(String tabs) {
70
String s = toString();
71
printTabs = ""; //$NON-NLS-1$
76
public String toString() {
77
String s = name + "\n"; //$NON-NLS-1$
79
s += printTabs + "Image: "; //$NON-NLS-1$
80
s += image.toString(printTabs + "\t"); //$NON-NLS-1$