X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fhelper%2Fprofiler%2FPortProfile.java;fp=dol%2Fsrc%2Fdol%2Fhelper%2Fprofiler%2FPortProfile.java;h=cd040ab197b02f3a134f9967b3598a8ef12be69a;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/helper/profiler/PortProfile.java b/dol/src/dol/helper/profiler/PortProfile.java new file mode 100644 index 0000000..cd040ab --- /dev/null +++ b/dol/src/dol/helper/profiler/PortProfile.java @@ -0,0 +1,95 @@ +/* $Id: PortProfile.java 203 2010-10-11 08:59:47Z dchokshi $ */ +package dol.helper.profiler; + +/** + * Functional simulation profile information for a port. + */ +public class PortProfile { + + /** + * Constructor. + * + * @param name name of the port this profile belongs to + */ + public PortProfile(String name, ProcessProfile processProfile) { + _name = name; + _processProfile = processProfile; + _accesses = new Range(); + _tokenSize = new Range(); + _currentTokenSize = new Range(); + } + + /** + * Return the name of the channel this profile belongs to. + * + * @return name of the channel this profile belongs to + */ + public String getName() { + return _name; + } + + /** + * Add a read or write access to this port. + * + * @param tokenSize number of bytes communicated in this access + */ + public void addAccess(int tokenSize) { + _currentAccesses++; + _currentTokenSize.merge(tokenSize); + } + + /** + * Add an initial read or write access to this port (access happened + * during init() phase). + * + * @param tokenSize number of bytes communicated in this access + */ + public void addInitialAccess(int tokenSize) { + _initialAccesses++; + if (_initialTokenSize == null) { + _initialTokenSize = new Range(tokenSize); + } else { + _initialTokenSize.merge(tokenSize); + } + } + + /** + * + */ + public void update() { + _accesses.merge(_currentAccesses); + _tokenSize.merge(_currentTokenSize); + + _currentAccesses = 0; + _currentTokenSize.reset(); + } + + public int getInitialAccesses() { + return _initialAccesses; + } + + public Range getInitialTokenSize() { + if (_initialTokenSize == null) { + return new Range(0); + } else { + return _initialTokenSize; + } + } + + public Range getAccesses() { + return _accesses; + } + + public Range getTokenSize() { + return _tokenSize; + } + + String _name; + Range _accesses; + Range _tokenSize; + int _currentAccesses; + Range _currentTokenSize; + int _initialAccesses; + Range _initialTokenSize = null; + ProcessProfile _processProfile; +}