@@ -50,7 +50,7 @@ def update(self, value):
50
50
self .value = value
51
51
52
52
53
- def _watch_power (logfile : Path = None , sender : Connection = None , display : bool = True ):
53
+ def _watch_power (logfile : Path = None , sender : Connection = None , display : bool = False ):
54
54
"""
55
55
Poll GPU and log/display current power consumption.
56
56
Update frequency: every 1 second.
@@ -60,8 +60,6 @@ def _watch_power(logfile: Path = None, sender: Connection = None, display: bool
60
60
:param display: display consumption in terminal.
61
61
:return: None
62
62
"""
63
- if (logfile is None ) and (display is False ):
64
- raise ValueError ('You should log and/or display consumption' )
65
63
66
64
total = 0
67
65
killer = _GracefulKiller ()
@@ -79,6 +77,7 @@ def _watch_power(logfile: Path = None, sender: Connection = None, display: bool
79
77
if logfile is not None :
80
78
f .write (f'{ datetime .now ()} { power } \n ' )
81
79
time .sleep (1 )
80
+ print (total )
82
81
if display :
83
82
print ('' , end = '\n ' )
84
83
if sender is not None :
@@ -97,10 +96,10 @@ class PowerWatcher:
97
96
pw.total # get results
98
97
"""
99
98
100
- def __init__ (self , logfile : Path = None , display : bool = True ):
99
+ def __init__ (self , logfile : Path = None , display : bool = False ):
101
100
"""
102
101
:param logfile: logfile path.
103
- :param display: consumption display toggle .
102
+ :param display: display consumption in the terminal .
104
103
"""
105
104
self .logfile = logfile
106
105
self .display = display
@@ -130,4 +129,4 @@ def start(self):
130
129
def stop (self ):
131
130
"""Stop manually."""
132
131
self .watcher .terminate ()
133
- self .total .update (self .recv_end .recv ())
132
+ self .total .update (self .recv_end .recv ())
0 commit comments