1
/*******************************************************************************
2
* Copyright (c) 2004,2008 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
* Keith Seitz <keiths@redhat.com> - initial API and implementation
10
* Kent Sebastian <ksebasti@redhat.com>
11
*******************************************************************************/
13
package org.eclipse.linuxtools.internal.oprofile.core.daemon;
15
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
18
* This class represents an event used to configure the OProfile
21
public class OprofileDaemonEvent {
22
public static final int COUNT_UNINITIALIZED = 0;
23
public static final int COUNT_INVALID = -1;
25
// The event to collect on this counter
26
private OpEvent event;
29
private boolean profileKernel;
32
private boolean profileUser;
34
// Reset counter value
37
public OprofileDaemonEvent() {
40
count = COUNT_UNINITIALIZED;
45
* Set the event to collect
46
* @param event the OProfile event
48
public void setEvent(OpEvent event) {
53
* Get the event to collect
54
* @returns the OProfile event
56
public OpEvent getEvent() {
61
* Set whether to profile the kernel
62
* @param profileKernel whether to enable kernel profiling
64
public void setProfileKernel(boolean profileKernel) {
65
this.profileKernel = profileKernel;
69
* Get whether to profile the kernel
70
* @return whether to profile the kernel
72
public boolean getProfileKernel() {
77
* Set whether to profile userspace
78
* @param profileUser whether to profile userspace
80
public void setProfileUser(boolean profileUser) {
81
this.profileUser = profileUser;
85
* Get whether to profile userspace
86
* @return whether to profile userspace
88
public boolean getProfileUser() {
94
* @param count the new count
96
public void setResetCount(int count) {
101
* Get the reset count
102
* @return the reset count
104
public int getResetCount() {
105
// FIXME: This isn't quite in the right place...
106
if (count == COUNT_UNINITIALIZED) {
107
// This is what Oprofile does in oprof_start.cpp:
108
double speed = Oprofile.getCpuFrequency();
110
count = event.getMinCount() * 30;
112
count = (int) speed * 20;