Elapsed time of entire execution, summed over all executions, for the current thread,
if it has executed the kernel on the device assigned to this KernelDeviceProfile instance.
435540
public double getCumulativeElapsedTimeAllCurrentThread() {
	  double sum = 0;
	  
	  Accumulator acc = getAccForThread();
	  if (acc == null) {
		  return sum;
	  }

      for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
         sum += acc.accumulatedTimes[i];
      }
      
      return sum;
   }
570020
private boolean getNextEviction() {
		long nowTime = System.currentTimeMillis();
		final long sleepEndTime = nowTime + evictionInverval;

		while (nowTime < sleepEndTime) {
			final long toSleep = Math.max(100, sleepEndTime - nowTime);
			synchronized (this) {
				if (terminate)
					return false;
				try {
					wait(toSleep);
				} catch (InterruptedException e) {
					// ignore
				}
			}
			nowTime = System.currentTimeMillis();
		}
		return true;
	}
602337
public long getElapsedMilliseconds() {
		long elapsed;
		if (running) {
			elapsed = (System.nanoTime() - startTime);
		} else {
			elapsed = (stopTime - startTime);
		}
		return elapsed / nsPerMs;
	}
794313
def _timed_process(self, *args, **kwargs):
        """"""
        for processor in self._processors:
            start_time = _time.process_time()
            processor.process(*args, **kwargs)
            process_time = int(round((_time.process_time() - start_time) * 1000, 2))
            self.process_times[processor.__class__.__name__] = process_time
1372276
@Override
    public void synchronizeToHost(AllocationPoint point) {

        if (!point.isActualOnHostSide()) {
            CudaContext context = (CudaContext) allocator.getDeviceContext().getContext();

            if (!point.isConstant())
                waitTillFinished(point);

            //  log.info("Synchronization started... " + point.getShape());

            // if this piece of memory is device-dependant, we'll also issue copyback once
            if (point.getAllocationStatus() == AllocationStatus.DEVICE && !point.isActualOnHostSide()) {

                long perfD = PerformanceTracker.getInstance().helperStartTransaction();

                if (nativeOps.memcpyAsync(point.getHostPointer(), point.getDevicePointer(), AllocationUtils.getRequiredMemory(point.getShape()), CudaConstants.cudaMemcpyDeviceToHost, context.getSpecialStream()) == 0)
                    throw new IllegalStateException("MemcpyAsync failed: " + point.getShape());

                commitTransfer(context.getSpecialStream());

                PerformanceTracker.getInstance().helperRegisterTransaction(point.getDeviceId(), perfD, point.getNumberOfBytes(), MemcpyDirection.DEVICE_TO_HOST);
            } // else log.info("Not [DEVICE] memory, skipping...");


            // updating host read timer
            point.tickHostRead();
            //log.info("After sync... isActualOnHostSide: {}", point.isActualOnHostSide());
        } // else log.info("Point is actual on host side! " + point.getShape());
    }
402280
public boolean computeScroll() {
        if (finished) {
            return false;
        }

        long elapsed = SystemClock.elapsedRealtime() - startRtc;
        if (elapsed >= duration) {
            finished = true;
            currValue = finalValue;
            return false;
        }

        float time = interpolator.getInterpolation((float) elapsed / duration);
        currValue = interpolate(startValue, finalValue, time);
        return true;
    }
1277771
private void updateStats() {
    final ThreadMXBean bean = ManagementFactory.getThreadMXBean();
    if (bean.isThreadCpuTimeEnabled()) {
      // Update stats for all current threads
      final long[] ids = bean.getAllThreadIds();
      Arrays.sort(ids);
      long totalCpuTime = 0L;
      for (long id : ids) {
        long cpuTime = bean.getThreadCpuTime(id);
        if (cpuTime != -1) {
          totalCpuTime += cpuTime;
          CpuUsage usage = threadCpuUsages.get(id);
          if (usage == null) {
            final ThreadInfo info = bean.getThreadInfo(id);
            usage = new CpuUsage(id, info.getThreadName());
            threadCpuUsages.put(id, usage);
          }
          usage.update(cpuTime);
        }
      }

      // Update jvm cpu usage, if possible we query the operating system mxbean so we get
      // an accurate total including any threads that may have been started and stopped
      // between sampling. As a fallback we use the sum of the cpu time for all threads found
      // in this interval.
      //
      // Total cpu time can be found in:
      // http://docs.oracle.com/javase/7/docs/jre/api/management/extension/\
      // com/sun/management/OperatingSystemMXBean.html
      //
      // We use reflection to avoid direct dependency on com.sun.* classes.
      final OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
      try {
        final Method m = osBean.getClass().getMethod("getProcessCpuTime");
        final long jvmCpuTime = (Long) m.invoke(osBean);
        jvmCpuUsage.update((jvmCpuTime < 0) ? totalCpuTime : jvmCpuTime);
      } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        jvmCpuUsage.update(totalCpuTime);
      }

      // Handle ids in the map that no longer exist:
      // * Remove old entries if the last update time is over AGE_LIMIT
      // * Otherwise, update usage so rolling window is correct
      final long now = System.currentTimeMillis();
      final Iterator<Map.Entry<Long, CpuUsage>> iter = threadCpuUsages.entrySet().iterator();
      while (iter.hasNext()) {
        final Map.Entry<Long, CpuUsage> entry = iter.next();
        final long id = entry.getKey();
        final CpuUsage usage = entry.getValue();
        if (now - usage.getLastUpdateTime() > AGE_LIMIT) {
          iter.remove();
        } else if (Arrays.binarySearch(ids, id) < 0) {
          usage.updateNoValue();
        }
      }
    } else {
      LOGGER.debug("ThreadMXBean.isThreadCpuTimeEnabled() == false, cannot collect stats");
    }
  }
635771
private boolean doStart()
  {
    if (! _lifecycle.isActive()) {
      return false;
    }
    
    if (! isEnable()) {
      return false;
    }
    
    int startingCount = _startingCount.get();

    int threadCount = _threadCount.get() + startingCount;

    if (_threadMax < threadCount) {
      onThreadMax();
      
      return false;
    }
    else if (! isIdleTooLow(startingCount)) {
      return false;
    }
    
    _idleCount.incrementAndGet();

    startConnection();
      
    return true;
  }
600662
def main():
    
    start_time = datetime.now()

    for a_device in devices:
        my_thread = threading.Thread(target=show_version, args=(a_device,))
        my_thread.start()

    main_thread = threading.currentThread()
    for some_thread in threading.enumerate():
        if some_thread != main_thread:
            print(some_thread)
            some_thread.join()

    print("\nElapsed time: " + str(datetime.now() - start_time))
1132807
@Override
    public Thread newThread(final Runnable runnable) {
        int threadId = createdThreadCount.incrementAndGet();
        final String name = executorName + "-thread-" + threadId;
        // The AccessControlContext is implicitly copied from the creating
        // thread, so use doPrivileged to prevent that.
        return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
            @Override
            public Thread run() {
                final Thread thread;
                if (TRACE_ENABLED_AT_STARTUP) {
                    // We don't want a mixed pool of LibertyThreads and regular Threads, which
                    // could occur if a user were to change the trace settings after startup.
                    // Also, using the LibertyThread will have a (very) slight impact on 
                    // performance as it will require a check to the trace component and an
                    // additional method call.  As such, we will only use LibertyThreads if
                    // the trace was enabled at server startup - the user can subsequently
                    // disable the trace while the server is still up, which will stop the
                    // LibertyThreads from printing stack traces, but may still be slightly
                    // slower than using normal Threads.
                    thread = new LibertyThread(threadGroup, runnable, name);
                } else {
                    thread = new Thread(threadGroup, runnable, name);
                }
                // The daemon, priority, and context class loader are implicitly
                // copied from the creating thread, so reset them all.
                thread.setDaemon(true);
                thread.setPriority(Thread.NORM_PRIORITY);
                thread.setContextClassLoader(contextClassLoader);
                return thread;
            }
        });
    }
1194682
def getThroughput(self, instId: int) -> float:
        
        # We are using the instanceStarted time in the denominator instead of
        # a time interval. This is alright for now as all the instances on a
        # node are started at almost the same time.
        if instId not in self.instances.ids:
            return None
        perf_time = time.perf_counter()
        throughput = self.throughputs[instId].get_throughput(perf_time)
        return throughput
510436
public void run() {
        try {
            while (--expires >= 0) {
                sleep(sysInterval);
                synchronized (ThreadClockImpl.class) {
                    currentTimeMillis += sysInterval;
                }
            }
        } catch (InterruptedException e) {
            System.out.println("Clock thread interrupted");
        }
    }
1237782
def kernel():
	
	print('================================')
	print('  WARNING: upgrading the kernel')
	print('================================')
	time.sleep(5)

	print('-[kernel]----------')
	cmd('rpi-update', True)
	print(' >> You MUST reboot to load the new kernel <<')
305454
def run(self):
        
        ctx = FSM.Context(self.name, self.device)
        transition_counter = 0
        timeout = self.timeout
        self.log("{} Start".format(self.name))
        while transition_counter < self.max_transitions:
            transition_counter += 1
            try:
                start_time = time()
                if self.init_pattern is None:
                    ctx.event = self.ctrl.expect(self.events, searchwindowsize=self.searchwindowsize, timeout=timeout)
                else:
                    self.log("INIT_PATTERN={}".format(pattern_to_str(self.init_pattern)))
                    try:
                        ctx.event = self.events.index(self.init_pattern)
                    except ValueError:
                        self.log("INIT_PATTERN unknown.")
                        continue
                    finally:
                        self.init_pattern = None

                finish_time = time() - start_time
                key = (ctx.event, ctx.state)
                ctx.pattern = self.events[ctx.event]

                if key in self.transition_table:
                    transition = self.transition_table[key]
                    next_state, action_instance, next_timeout = transition
                    self.log("E={},S={},T={},RT={:.2f}".format(ctx.event, ctx.state, timeout, finish_time))
                    if callable(action_instance) and not isclass(action_instance):
                        if not action_instance(ctx):
                            self.log("Error: {}".format(ctx.msg))
                            return False
                    elif isinstance(action_instance, Exception):
                        self.log("A=Exception {}".format(action_instance))
                        raise action_instance
                    elif action_instance is None:
                        self.log("A=None")
                    else:
                        self.log("FSM Action is not callable: {}".format(str(action_instance)))
                        raise RuntimeWarning("FSM Action is not callable")

                    if next_timeout != 0:  # no change if set to 0
                        timeout = next_timeout
                    ctx.state = next_state
                    self.log("NS={},NT={}".format(next_state, timeout))

                else:
                    self.log("Unknown transition: EVENT={},STATE={}".format(ctx.event, ctx.state))
                    continue

            except EOF:
                raise ConnectionError("Session closed unexpectedly", self.ctrl.hostname)

            if ctx.finished or next_state == -1:
                self.log("{} Stop at E={},S={}".format(self.name, ctx.event, ctx.state))
                return True

        # check while else if even exists
        self.log("FSM looped. Exiting")
        return False
175173
def take(self):
        
        with self._lock:
            now = int(time.time())

            if now != self.this_sec:
                self.used_this_sec = 0
                self.this_sec = now

            if self.used_this_sec >= self.traces_per_sec:
                return False

            self.used_this_sec = self.used_this_sec + 1
            return True
169518
function() {
        if (process.platform !== 'win32') {
            return;
        }

        this._cpuConsole = child_process.spawn('typeperf', ['\\Processor(_Total)\\% Processor Time']);
        this._cpuConsole.stdout.on('data', _.bind(function(stdout) {

            stdout = stdout.toString();
            if (stdout && stdout.indexOf(',') === 0) {
                var cpu = parseFloat(stdout.substr(2, stdout.length - 3));
                this._cpuFrame(cpu);
            }
        }, this));
    }
184090
public boolean isRunning() {

        if (m_lastLogErrorTime <= 0) {
            m_lastLogErrorTime = System.currentTimeMillis();
            m_lastLogWarnTime = m_lastLogErrorTime;
        } else {
            long currentTime = System.currentTimeMillis();
            if ((currentTime - m_lastLogWarnTime) > 30000) {
                // write warning to log after 30 seconds
                if (LOG.isWarnEnabled()) {
                    LOG.warn(
                        Messages.get().getBundle().key(
                            Messages.LOG_WAITING_ABANDONED_THREADS_2,
                            new Integer(m_abandonedCounter),
                            new Integer((m_startedCounter - m_returnedCounter))));
                }
                m_lastLogWarnTime = currentTime;
            }
            if ((currentTime - m_lastLogErrorTime) > 600000) {
                // write error to log after 10 minutes
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.LOG_WAITING_ABANDONED_THREADS_2,
                        new Integer(m_abandonedCounter),
                        new Integer((m_startedCounter - m_returnedCounter))));
                m_lastLogErrorTime = currentTime;
            }
        }

        boolean result = (m_returnedCounter + m_abandonedCounter) < m_startedCounter;
        if (result && LOG.isInfoEnabled()) {
            // write a note to the log that all threads have finished
            LOG.info(Messages.get().getBundle().key(Messages.LOG_THREADS_FINISHED_0));
        }
        return result;
    }