Esempio n. 1
0
    def __init__(self,
                 iterations,
                 track_time=True,
                 width=30,
                 bar_char='#',
                 stream=2,
                 title='',
                 monitor=False,
                 update_interval=None):
        Prog.__init__(self, iterations, track_time, stream, title, monitor,
                      update_interval)
        self.bar_width = width
        self._adjust_width()
        self.bar_char = bar_char
        self.last_progress = 0

        if monitor:
            try:
                self.process.cpu_percent()
                self.process.memory_percent()
            except AttributeError:  # old version of psutil
                self.process.get_cpu_percent()
                self.process.get_memory_percent()
        if self.item_id:
            self._cache_item_id()
Esempio n. 2
0
    def __init__(self,
                 iterations,
                 track_time=True,
                 width=30,
                 bar_char='#',
                 stream=2,
                 title='',
                 monitor=False,
                 update_interval=None):
        Prog.__init__(self, iterations, track_time, stream, title, monitor,
                      update_interval)

        # 进度条宽度(横向长度)
        self.bar_width = width()
        self._adjust_width()
        # 进度条使用的字符
        self.bar_char = bar_char
        # 保存上一进度条的字符数
        self.last_progress = 0
        self._print_labels()
        self._print_progress_bar(0)
        if monitor:
            try:
                self.process.cpu_percent()
                self.process.memory_percent()
            except AttributeError:
                self.process.get_cpu_percent()
                self.process.get_memory_percent()
        if self.item_id:
            self._print_item_id()
Esempio n. 3
0
 def __init__(self,
              iterations,
              track_time=True,
              width=30,
              bar_char='#',
              stream=2,
              title='',
              monitor=False,
              timeformat="sec"):
     Prog.__init__(self, iterations, track_time, stream, title, monitor,
                   timeformat)
     self.bar_width = width
     self._adjust_width()
     self.bar_char = bar_char
     self.last_progress = 0
     self._print_labels()
     self._print_progress_bar(0)
     if monitor:
         try:
             self.process.cpu_percent()
             self.process.memory_percent()
         except AttributeError:  # old version of psutil
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
     if self.item_id:
         self._print_item_id()
Esempio n. 4
0
 def __init__(self, iterations, track_time=True, stream=2, title='', monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.perc = 0
     self._print_update()
     if monitor:
         self.process.cpu_percent()
         self.process.memory_percent()
Esempio n. 5
0
 def __init__(self, iterations, track_time=True, width=30, stream=2, title=''):
     Prog.__init__(self, iterations, track_time, stream, title)
     self.bar_width = width
     self._adjust_width()
     self.last_progress = 0
     self._print_labels()
     self._print_progress_bar(0)
Esempio n. 6
0
 def __init__(self, iterations, track_time=True, width=30, stream=2, title='', monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.bar_width = width
     self._adjust_width()
     self.last_progress = 0
     self._print_labels()
     self._print_progress_bar(0)
     if monitor:
         self.process.cpu_percent()
         self.process.memory_percent()
Esempio n. 7
0
 def __init__(self, iterations, track_time=True, stream=2, title="", monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.last_progress = 0
     self._print()
     if monitor:
         try:
             self.process.cpu_percent()
             self.process.memory_percent()
         except AttributeError:  # old version of psutil
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
Esempio n. 8
0
 def __init__(self, iterations, track_time=True, stream=2, title='', monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.perc = 0
     self._print_update()
     if monitor:
         try:
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
         except AttributeError: # old version of psutil
             cpu_total = self.process.cpu_percent()
             mem_total = self.process.memory_percent()   
Esempio n. 9
0
 def __init__(self, iterations, track_time=True,
              stream=2, title='', monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.last_progress = 0
     self._print()
     if monitor:
         try:
             self.process.cpu_percent()
             self.process.memory_percent()
         except AttributeError:  # old version of psutil
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
Esempio n. 10
0
 def __init__(self, iterations, track_time=True, width=30, stream=2, title='', monitor=False):
     Prog.__init__(self, iterations, track_time, stream, title, monitor)
     self.bar_width = width
     self._adjust_width()
     self.last_progress = 0
     self._print_labels()
     self._print_progress_bar(0)
     if monitor:
         try:
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
         except AttributeError: # old version of psutil
             cpu_total = self.process.cpu_percent()
             mem_total = self.process.memory_percent()   
Esempio n. 11
0
    def __init__(self, iterations, track_time=True, width=30, bar_char='#',
                 stream=2, title='', monitor=False, update_interval=None):
        Prog.__init__(self, iterations, track_time,
                      stream, title, monitor, update_interval)
        self.bar_width = width
        self._adjust_width()
        self.bar_char = bar_char
        self.last_progress = 0

        if monitor:
            try:
                self.process.cpu_percent()
                self.process.memory_percent()
            except AttributeError:  # old version of psutil
                self.process.get_cpu_percent()
                self.process.get_memory_percent()
        if self.item_id:
            self._cache_item_id()
Esempio n. 12
0
 def __init__(self, iterations, track_time=True, width=30, bar_char='#',
              stream=2, title='', monitor=False, timeformat="sec"):
     Prog.__init__(self, iterations, track_time, stream, title, monitor, timeformat)
     self.bar_width = width
     self._adjust_width()
     self.bar_char = bar_char
     self.last_progress = 0
     self._print_labels()
     self._print_progress_bar(0)
     if monitor:
         try:
             self.process.cpu_percent()
             self.process.memory_percent()
         except AttributeError:  # old version of psutil
             self.process.get_cpu_percent()
             self.process.get_memory_percent()
     if self.item_id:
         self._print_item_id()
Esempio n. 13
0
    def __init__(self,
                 iterations,
                 track_time=True,
                 stream=2,
                 title='',
                 monitor=False,
                 update_interval=None):
        Prog.__init__(self, iterations, track_time, stream, title, monitor,
                      update_interval)

        # 保存上一进度百分比
        self.last_progress = 0
        self._print()
        if monitor:
            try:
                self.process.cpu_percent()
                self.process.memory_percent()
            except AttributeError:
                self.process.get_cpu_percent()
                self.process.get_memory_percent()
Esempio n. 14
0
 def __init__(self, iterations, track_time=True, stream=2):
     Prog.__init__(self, iterations, track_time, stream)
     self.perc = 0
     self.max_iter = float(self.max_iter) # accommodation for Python 2.x users
     self._print_update()
Esempio n. 15
0
 def __init__(self, iterations, track_time=True, width=50, stream=2):
     Prog.__init__(self, iterations, track_time, stream)
     self.bar_width = width
     self._adjust_width()
     self.bar_interv = self.max_iter // self.bar_width
     self._init_bar()
Esempio n. 16
0
 def __init__(self, iterations, track_time=True, stream=2, title=''):
     Prog.__init__(self, iterations, track_time, stream, title)
     self.perc = 0
     self._print_update()