Class DummyWorkspace

    • Constructor Detail

      • DummyWorkspace

        public DummyWorkspace()
    • Method Detail

      • getId

        public String getId()
        This method returns Id of this workspace
        Specified by:
        getId in interface MemoryWorkspace
        Returns:
      • alloc

        public PagedPointer alloc​(long requiredMemory,
                                  DataType dataType,
                                  boolean initialize)
        This method does allocation from a given Workspace
        Specified by:
        alloc in interface MemoryWorkspace
        Parameters:
        requiredMemory - allocation size, in bytes
        dataType - dataType that is going to be used
        initialize -
        Returns:
      • alloc

        public PagedPointer alloc​(long requiredMemory,
                                  MemoryKind kind,
                                  DataType dataType,
                                  boolean initialize)
        This method does allocation from a given Workspace
        Specified by:
        alloc in interface MemoryWorkspace
        Parameters:
        requiredMemory - allocation size, in bytes
        kind - MemoryKind for allocation
        dataType - dataType that is going to be used
        initialize -
        Returns:
      • isScopeActive

        public boolean isScopeActive()
        This method returns True if scope was opened, and not closed yet.
        Specified by:
        isScopeActive in interface MemoryWorkspace
        Returns:
      • initializeWorkspace

        public void initializeWorkspace()
        This method causes Workspace initialization

        PLEASE NOTE: This call will have no effect on previously initialized Workspace

        Specified by:
        initializeWorkspace in interface MemoryWorkspace
      • destroyWorkspace

        public void destroyWorkspace()
        This method causes Workspace destruction: all memory allocations are released after this call.
        Specified by:
        destroyWorkspace in interface MemoryWorkspace
      • toggleWorkspaceUse

        public void toggleWorkspaceUse​(boolean isEnabled)
        This method allows you to temporary disable/enable given Workspace use. If turned off - direct memory allocations will be used.
        Specified by:
        toggleWorkspaceUse in interface MemoryWorkspace
        Parameters:
        isEnabled -
      • getThisCycleAllocations

        public long getThisCycleAllocations()
        This method returns amount of memory consumed in last successful cycle, in bytes
        Specified by:
        getThisCycleAllocations in interface MemoryWorkspace
        Returns:
      • enableDebug

        public void enableDebug​(boolean reallyEnable)
        This method enabled debugging mode for this workspace
        Specified by:
        enableDebug in interface MemoryWorkspace
        Parameters:
        reallyEnable -
      • getLastCycleAllocations

        public long getLastCycleAllocations()
        This method returns amount of memory consumed in last successful cycle, in bytes
        Specified by:
        getLastCycleAllocations in interface MemoryWorkspace
        Returns:
      • getMaxCycleAllocations

        public long getMaxCycleAllocations()
        This method returns amount of memory consumed by largest successful cycle, in bytes
        Specified by:
        getMaxCycleAllocations in interface MemoryWorkspace
        Returns:
      • getCurrentSize

        public long getCurrentSize()
        This methos returns current allocated size of this workspace
        Specified by:
        getCurrentSize in interface MemoryWorkspace
        Returns:
      • close

        public void close()
        Description copied from interface: MemoryWorkspace
        This method is for compatibility with "try-with-resources" java blocks. Internally it should be equal to notifyScopeLeft() method
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface MemoryWorkspace
      • setPreviousWorkspace

        public void setPreviousWorkspace​(MemoryWorkspace memoryWorkspace)
        Description copied from interface: MemoryWorkspace
        Set the previous workspace, if any
        NOTE: this method should only be used if you are fully aware of the consequences of doing so. Incorrect use of this method may leave workspace management in an invalid/indeterminant state!
        Specified by:
        setPreviousWorkspace in interface MemoryWorkspace
        Parameters:
        memoryWorkspace - Workspace to set as the previous workspace. This is the workspace that will become active when this workspace is closed.
      • targetDevice

        public int targetDevice()
        Description copied from interface: Deallocatable
        This method returns deviceId it's affined with, so deallocator thread will be guaranteed to match it
        Specified by:
        targetDevice in interface Deallocatable