blob: fb19f8c486eeff4659ee60288804bd9a98f6512c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*******************************************************************************
* Copyright (c) 2013 Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Dumais (Ericsson) - Initial API and implementation (Bug 396268)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal;
import java.util.HashMap;
import java.util.Map;
/**
* This class provides a container to store the computed
* loads for the various CPU cores.
*
*/
public class ProcStatCoreLoads {
private Map<String, Float> m_coreLoads;
public ProcStatCoreLoads() {
m_coreLoads = new HashMap<String,Float>();
}
public void put(String coreId, Float load) {
m_coreLoads.put(coreId,load);
}
/**
* @param cpuId: the cpu/core id, as listed in /proc/cpuinfo.
* For example, for the core labelled "cpu0" in /proc/stat,
* use id "0".
* @return The measured load for that core
*/
public Float getLoad(String cpuId) {
return m_coreLoads.get("cpu"+cpuId); //$NON-NLS-1$
}
}
|