Starts a profiling information gathering sequence for the current thread invoking this method
regarding the specified execution device.
@param device
199405
void onStart(Device device) {
	  KernelDeviceProfile currentDeviceProfile = deviceProfiles.get(device);
      if (currentDeviceProfile == null) {    	 
         currentDeviceProfile = new KernelDeviceProfile(this, kernelClass, device);
         KernelDeviceProfile existingProfile = deviceProfiles.putIfAbsent(device, currentDeviceProfile);
         if (existingProfile != null) {
        	 currentDeviceProfile = existingProfile;
         }
      }
      
      currentDeviceProfile.onEvent(ProfilingEvent.START);
      currentDevice.set(device);
   }
630719
public void loadProfile(Object key)
    {
        if (!isEnablePerThreadChanges())
        {
            throw new MetadataException("Can not load profile with disabled per thread mode");
        }
        DescriptorRepository rep = (DescriptorRepository) metadataProfiles.get(key);
        if (rep == null)
        {
            throw new MetadataException("Can not find profile for key '" + key + "'");
        }
        currentProfileKey.set(key);
        setDescriptor(rep);
    }
559931
def init_device(self):
        """"""
        start_time = time.time()
        Device.init_device(self)
        self._pb_id = ''
        LOG.debug('init PB device %s, time taken %.6f s (total: %.2f s)',
                  self.get_name(), (time.time() - start_time),
                  (time.time() - self._start_time))
        self.set_state(DevState.STANDBY)
1190396
def startMeasurement(self, measurementId, deviceId):
        
        am, handler = self.getDataHandler(measurementId, deviceId)
        if am is not None:
            am.status = MeasurementStatus.RECORDING
            am.updateDeviceStatus(deviceId, RecordStatus.RECORDING)
            handler.start(am.idAsPath)
            return True
        else:
            return False
621165
@SuppressWarnings({"WeakerAccess"})
    protected void initDeviceID() {
        getDeviceCachedInfo();  // put this here to avoid running on main thread

        // generate a provisional while we do the rest async
        generateProvisionalGUID();
        // grab and cache the googleAdID in any event if available
        // if we already have a deviceID we won't user ad id as the guid
        cacheGoogleAdID();

        // if we already have a device ID use it and just notify
        // otherwise generate one, either from ad id if available or the provisional
        String deviceID = getDeviceID();
        if (deviceID == null || deviceID.trim().length() <= 2) {
            generateDeviceID();
        }

    }
660109
protected void didInvokeUnit (Unit unit, long start)
    {
        // track some performance metrics
        if (PERF_TRACK) {
            long duration = System.currentTimeMillis() - start;
            Object key = unit.getClass();
            recordMetrics(key, duration);

            // report long runners
            long thresh = unit.getLongThreshold();
            if (thresh == 0) {
                thresh = _longThreshold;
            }
            if (duration > thresh) {
                StringBuilder msg = new StringBuilder();
                msg.append((duration >= 10*thresh) ? "Really long" : "Long");
                msg.append(" invoker unit [unit=").append(unit);
                msg.append(" (").append(key).append("), time=").append(duration).append("ms");
                if (unit.getDetail() != null) {
                    msg.append(", detail=").append(unit.getDetail());
                }
                log.warning(msg.append("].").toString());
            }
        }
    }
504890
protected void processUnit (Object unit)
    {
        long start = System.nanoTime();

        // keep track of the largest queue size we've seen
        int queueSize = _evqueue.size();
        if (queueSize > _current.maxQueueSize) {
            _current.maxQueueSize = queueSize;
        }

        try {
            if (unit instanceof Runnable) {
                // if this is a runnable, it's just an executable unit that should be invoked
                ((Runnable)unit).run();

            } else {
                DEvent event = (DEvent)unit;

                // if this event is on a proxied object, forward it to the owning manager
                ProxyReference proxy = _proxies.get(event.getTargetOid());
                if (proxy != null) {
                    // rewrite the oid into the originating manager's id space
                    event.setTargetOid(proxy.origObjectId);
                    // then pass it on to the originating manager to handle
                    proxy.origManager.postEvent(event);

                } else if (event instanceof CompoundEvent) {
                    processCompoundEvent((CompoundEvent)event);

                } else {
                    processEvent(event);
                }
            }

        } catch (VirtualMachineError e) {
            handleFatalError(unit, e);

        } catch (Throwable t) {
            log.warning("Execution unit failed", "unit", unit, t);
        }

        // compute the elapsed time in microseconds
        long elapsed = (System.nanoTime() - start)/1000;

        // report excessively long units
        if (elapsed > 500000 && !(unit instanceof LongRunnable)) {
            log.warning("Long dobj unit " + StringUtil.shortClassName(unit), "unit", unit,
                        "time", (elapsed/1000) + "ms");
        }

        // periodically sample and record the time spent processing a unit
        if (UNIT_PROF_ENABLED && _eventCount % _unitProfInterval == 0) {
            String cname;
            // do some jiggery pokery to get more fine grained profiling details on certain
            // "popular" unit types
            if (unit instanceof Interval.RunBuddy) {
                cname = StringUtil.shortClassName(
                    ((Interval.RunBuddy)unit).getIntervalClassName());
            } else if (unit instanceof InvocationRequestEvent) {
                InvocationRequestEvent ire = (InvocationRequestEvent)unit;
                Class<?> c = _invmgr.getDispatcherClass(ire.getInvCode());
                cname = (c == null) ? "dobj.InvocationRequestEvent:(no longer registered)" :
                    StringUtil.shortClassName(c) + ":" + ire.getMethodId();
            } else {
                cname = StringUtil.shortClassName(unit);
            }
            UnitProfile uprof = _profiles.get(cname);
            if (uprof == null) {
                _profiles.put(cname, uprof = new UnitProfile());
            }
            uprof.record(elapsed);
        }
    }
571181
void setDeviceId(int nDeviceId) {
        synchronized (LOCK) {
            // Move this instance inside the HashMaps
            INSTANCES.get(connection()).remove(getDeviceId());
            INSTANCES.get(connection()).put(nDeviceId, this);

            this.deviceId = nDeviceId;
        }
    }
156762
public void checkpointStart()
  {
    if (_isWhileCheckpoint) {
      throw new IllegalStateException();
    }
    
    _isWhileCheckpoint = true;
    
    long sequence = ++_sequence;
    
    setSequence(sequence);
    
    byte []headerBuffer = _headerBuffer;
    BitsUtil.writeInt16(headerBuffer, 0, CHECKPOINT_START);
    writeImpl(headerBuffer, 0, 2);
    
    _lastCheckpointStart = _index - _startAddress;
  }
1105539
@Override
    public void attachThreadToDevice(Thread thread, Integer deviceId) {
        attachThreadToDevice(thread.getId(), deviceId);
    }
535468
static DeviceInfo initialize(Context context) {
        if (thisInstance_ == null) {
            thisInstance_ = new DeviceInfo(context);
        }
        return thisInstance_;
    }
827299
public synchronized void start() {
		if ((todoFlags & RECORD_CPUTIME) != 0) {
			currentStartCpuTime = getThreadCpuTime(threadId);
		} else {
			currentStartCpuTime = -1;
		}
		if ((todoFlags & RECORD_WALLTIME) != 0) {
			currentStartWallTime = System.nanoTime();
		} else {
			currentStartWallTime = -1;
		}
		isRunning = true;
	}
1320425
@Override
    public void applicationStarted(ApplicationInfo appInfo) throws StateChangeException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "application started : " + appInfo.getName());

        runFutureGeneratePluginTask();

    }
571501
async def start(self):
        """"""
        if self.connection.connected:
            return

        await self.connection.connect()

        # In case credentials have been given externally (i.e. not by pairing
        # with a device), then use that client id
        if self.service.device_credentials:
            self.srp.pairing_id = Credentials.parse(
                self.service.device_credentials).client_id

        # The first message must always be DEVICE_INFORMATION, otherwise the
        # device will not respond with anything
        msg = messages.device_information(
            'pyatv', self.srp.pairing_id.decode())
        await self.send_and_receive(msg)
        self._initial_message_sent = True

        # This should be the first message sent after encryption has
        # been enabled
        await self.send(messages.set_ready_state())

        async def _wait_for_updates(_, semaphore):
            # Use a counter here whenever more than one message is expected
            semaphore.release()

        # Wait for some stuff to arrive before returning
        semaphore = asyncio.Semaphore(value=0, loop=self.loop)
        self.add_listener(_wait_for_updates,
                          protobuf.SET_STATE_MESSAGE,
                          data=semaphore,
                          one_shot=True)

        # Subscribe to updates at this stage
        await self.send(messages.client_updates_config())
        await self.send(messages.wake_device())

        try:
            await asyncio.wait_for(
                semaphore.acquire(), 1, loop=self.loop)
        except asyncio.TimeoutError:
            # This is not an issue itself, but I should do something better.
            # Basically this gives the device about one second to respond with
            # some metadata before continuing.
            pass
987304
public synchronized void start() {
        if (monitorActive) {
            return;
        }
        lastTime.set(milliSecondFromNano());
        long localCheckInterval = checkInterval.get();
        // if executor is null, it means it is piloted by a GlobalChannelTrafficCounter, so no executor
        if (localCheckInterval > 0 && executor != null) {
            monitorActive = true;
            monitor = new TrafficMonitoringTask();
            scheduledFuture =
                executor.schedule(monitor, localCheckInterval, TimeUnit.MILLISECONDS);
        }
    }
1176792
public void initTraceState(Map<String, Object> state) {
        Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID);
        Object transaction = state.get(Constants.HAWKULAR_APM_TXN);
        Object level = state.get(Constants.HAWKULAR_APM_LEVEL);
        if (traceId != null) {
            setTraceId(traceId.toString());
        } else {
            log.severe("Trace id has not been propagated");
        }
        if (transaction != null) {
            setTransaction(transaction.toString());
        }
        if (level != null) {
            setReportingLevel(ReportingLevel.valueOf(level.toString()));
        }
    }
991506
def _trigger_rpc(self, device_info):
        """"""

        method = device_info.rpc_trigger
        if isinstance(method, devices.RPCTriggerViaSWI):
            self._jlink.memory_write32(method.register, [1 << method.bit])
        else:
            raise HardwareError("Unknown RPC trigger method", method=method)