1 /* $Id: ProcessProfile.java 203 2010-10-11 08:59:47Z dchokshi $ */
\r
2 package dol.helper.profiler;
\r
4 import java.util.HashMap;
\r
5 import java.util.Iterator;
\r
8 * Functional simulation profile information for a process.
\r
10 public class ProcessProfile {
\r
15 * @param name name of the process this profile belongs to
\r
17 public ProcessProfile(String name) {
\r
19 _portProfiles = new HashMap<String, PortProfile>();
\r
23 * Indicate that the process has entered fire().
\r
25 public void start() {
\r
31 * Indicate that the process has leaved fire().
\r
33 public void stop() {
\r
40 Iterator<String> iterator = _portProfiles.keySet().iterator();
\r
42 while (iterator.hasNext()) {
\r
43 PortProfile profile = _portProfiles.get(iterator.next());
\r
49 * Indicate a read or write access to a port.
\r
51 * @param port the accessed port
\r
52 * @param amount number of bytes communicated
\r
54 public void portAccess(String port, int amount) {
\r
55 if (_portProfiles.get(port) == null) {
\r
56 PortProfile profile = new PortProfile(port, this);
\r
57 _portProfiles.put(port, profile);
\r
60 _portProfiles.get(port).addAccess(amount);
\r
62 _portProfiles.get(port).addInitialAccess(amount);
\r
67 * Return the number of firings.
\r
69 * @return the number of fire() calls of a process.
\r
71 public int getNumOfFires() {
\r
76 * Return the name of the process this profile belongs to.
\r
78 * @return name of the process this profile belongs to
\r
80 public String getName() {
\r
85 * Return the profiles of all ports.
\r
87 * @return profile of all ports
\r
89 public HashMap<String, PortProfile> getPortProfiles() {
\r
90 return _portProfiles;
\r
93 protected String _name;
\r
94 boolean _started = false;
\r
95 protected int _numOfFires = 0;
\r
96 HashMap<String, PortProfile> _portProfiles;
\r