Ejemplo n.º 1
0
def test_disk():
    # Load tegracontroller
    with jtop.Tegrastats() as jetson:
        for x in range(5):
            disk = jetson.disk
            # Check type
            assert isinstance(disk, dict)
Ejemplo n.º 2
0
def test_open():
    # Initialize object
    tegra = jtop.Tegrastats()
    # Open data
    tegra.open()
    # Close connection
    tegra.close()
    assert True
Ejemplo n.º 3
0
def test_nvp():
    # Load tegracontroller
    with jtop.Tegrastats() as jetson:
        for x in range(5):
            nvpmodel = jetson.nvpmodel
            # Chek values
            assert nvpmodel["name"] == "TEST"
            assert nvpmodel["mode"] == 0
Ejemplo n.º 4
0
def test_fans():
    # Load tegracontroller
    with jtop.Tegrastats() as jetson:
        for x in range(5):
            fans = jetson.fans
            if fans:
                assert isinstance(fans, list)
            assert True
Ejemplo n.º 5
0
def test_open():
    # Initialize object
    jetson = jtop.Tegrastats()
    # Open data
    jetson.open()
    # Close connection
    jetson.close()
    assert True
Ejemplo n.º 6
0
def test_nvp():
    # Load tegracontroller
    with jtop.Tegrastats() as tegra:
        for x in range(5):
            stat = tegra.read
            # Check NVPmodel
            assert "NVPMODEL" in stat
            # Chek values
            assert stat["NVPMODEL"]["name"] == "TEST"
            assert stat["NVPMODEL"]["mode"] == 0
Ejemplo n.º 7
0
def test_stats():
    # Load tegracontroller
    with jtop.Tegrastats() as jetson:
        for x in range(5):
            # Check if is correctly written the variable
            assert "RAM" in jetson.stats
            variable = jetson.stats["RAM"]
            assert "RAM" in variable
            variable = jetson.stats["RAM"]["RAM"]
            # Check if ram["used"] is a list
            assert isinstance(variable["used"], list)
            # Check if last value is the same send
            assert variable["used"][-1] == 4722
Ejemplo n.º 8
0
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import jtop
import time

if __name__ == "__main__":

    print("Simple Tegrastats reader")

    with jtop.Tegrastats() as jetson:
        while True:
            # Read tegra stats
            print(jetson.stats)
            # Status disk
            print(jetson.disk)
            # Status fans
            print(jetson.fans)
            # uptime
            print(jetson.uptime)
            # nvpmodel
            print(jetson.nvpmodel)
            # local interfaces
            print(jetson.local_interfaces)
            # boards
            print(jetson.boards)
Ejemplo n.º 9
0
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import jtop
import time

if __name__ == "__main__":

    print("Simple Tegrastats reader")

    with jtop.Tegrastats() as tegra:
        while True:
            # Read tegra stats
            print(tegra.read)
            # Sleep before send new stat
            time.sleep(1)
# EOF