Return a string encoding the ID of the process, instance and thread.
        This disambiguates legitimate wake-ups, accidental writes to the FD,
        and buggy internal FD sharing.
352732
def _make_cookie(self):
        
        return struct.pack(self.COOKIE_FMT, self.COOKIE_MAGIC,
                           os.getpid(), id(self), thread.get_ident())
1052207
def id
      parts = socket.object_id.to_s.split("")
      parts = parts.each_slice(parts.length / 2).to_a

      [parts.first.join(""), parts.last.join("")].join(".")
    end
1368727
public String getFbtraceId() {
    if (getRawErrorJson() != null && getRawErrorJson().get("error").isObject()) {
      JsonObject errorJson = getRawErrorJson().get("error").asObject();
      return errorJson.getString("fbtrace_id", "");
    }

    return "";
  }
669091
public static final long generateId() {
        long id = 0;
        // add new seed material from current time
        random.addSeedMaterial(ThreadLocalRandom.current().nextLong());
        // get a new id
        byte[] bytes = new byte[16];
        // get random bytes
        random.nextBytes(bytes);
        for (int i = 0; i < bytes.length; i++) {
            id += ((long) bytes[i] & 0xffL) << (8 * i);
        }
        //System.out.println("Id: " + id);
        return id;
    }
690100
public static long getThreadId() {
        final Long threadId = THREAD_LOCAL.get();
        if (threadId != null) {
            return threadId;
        }
        return Thread.currentThread().getId();
    }
1051900
def _printable_id_code(self):
        
        code = str(self.id_code)
        while len(code) < self._code_size:
            code = '0' + code

        return code
101309
def process_info(pid=None):
    '''
    '''
    if psutil is None:  # pragma    nocover
        return {}
    pid = pid or os.getpid()
    try:
        p = psutil.Process(pid)
    # this fails on platforms which don't allow multiprocessing
    except psutil.NoSuchProcess:  # pragma    nocover
        return {}
    else:
        mem = p.memory_info()
        return {'memory': convert_bytes(mem.rss),
                'memory_virtual': convert_bytes(mem.vms),
                'cpu_percent': p.cpu_percent(),
                'nice': p.nice(),
                'num_threads': p.num_threads()}
120385
public long getInstanceId() {
        HprofByteBuffer dumpBuffer = classDump.getHprofBuffer();
        return dumpBuffer.getID(fileOffset + classDump.classDumpSegment.fieldValueOffset);
    }
714594
def GetSessionId(self):
        ''''''
        sid = c_void_p()
        ret = vmGuestLib.VMGuestLib_GetSessionId(self.handle.value, byref(sid))
        if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
        return sid
356723
def __get_pid_and_tid(self):
        ""
        self.dwThreadId, self.dwProcessId = \
                            win32.GetWindowThreadProcessId(self.get_handle())
1182618
def status(self):
        

        if self.pid is None:
            self.pid = self.read_pid()
        if self.pid is None:
            sp = BackgroundProcess.objects.filter(pk=1).first()
            if sp:
                self.pid = sp.pid
        if self.pid is None or self.pid == 0:
            self.stderr.write("%s: can't determine process id exiting.\n" % datetime.now().isoformat(' '))
            return False
        if self.pid != getpid():
            # calling from outside the daemon instance
            try:
                kill(self.pid, signal.SIGUSR2)
                return True
            except OSError as e:
                if e.errno == errno.ESRCH:
                    return False
                else:
                    return False

        process_list = []
        for process in BackgroundProcess.objects.filter(parent_process__pk=self.process_id):
            process_list.append(process)
            process_list += list(process.backgroundprocess_set.filter())
        for process in process_list:
            logger.debug('%s, parrent process_id %d' % (self.label, process.parent_process.pk))
            logger.debug('%s, process_id %d' % (self.label, self.process_id))
200739
def read_pid_status(pid="self"):
    
    data = {}
    with open("/proc/%s/status" % (pid,), "rb") as status_file:
        for row in status_file:
            fields = row.split()
            if fields and fields[0] in [b"VmRSS:", b"Threads:", b"FDSize:"]:
                try:
                    data[fields[0].decode("ascii")[:-1]] = int(fields[1])
                except ValueError:
                    data[fields[0].decode("ascii")[:-1]] = fields[1].decode("ascii")
    return data
1141398
public String id() {
        if (null == _id) {
            _id = conf().get(RythmConfigurationKey.ENGINE_ID);
        }
        return _id;
    }
1050843
def get_instance_id():
    
    log = logging.getLogger(mod_logger + '.get_instance_id')

    # Exit if not running on AWS
    if not is_aws():
        log.info('This machine is not running in AWS, exiting...')
        return

    instance_id_url = metadata_url + 'instance-id'
    try:
        response = urllib.urlopen(instance_id_url)
    except(IOError, OSError) as ex:
        msg = 'Unable to query URL to get instance ID: {u}\n{e}'. \
            format(u=instance_id_url, e=ex)
        log.error(msg)
        return

    # Check the code
    if response.getcode() != 200:
        msg = 'There was a problem querying url: {u}, returned code: {c}, unable to get the instance-id'.format(
                u=instance_id_url, c=response.getcode())
        log.error(msg)
        return
    instance_id = response.read()
    return instance_id
243222
public long getId()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getId");
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getId", ""+messageProcessorId);
      return messageProcessorId;
   }
336843
public static String getThreadDefaultTzid() throws TimezonesException {
    final String id = threadTzid.get();

    if (id != null) {
      return id;
    }
    return getSystemDefaultTzid();
  }
499014
public static synchronized String getNewId() {
		// unique across JVMs as long as each has a different workerID
		// based on Twitter's Snowflake algorithm
		long timestamp = timestamp();

		if (lastTimestamp == timestamp) {
			sequence = (sequence + 1) & SEQUENCE_MASK;
			if (sequence == 0) {
				timestamp = tilNextMillis(lastTimestamp);
			}
		} else {
			sequence = 0;
		}

		if (timestamp < lastTimestamp) {
			throw new IllegalStateException(String.format("Clock moved backwards.  "
					+ "Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
		}

		lastTimestamp = timestamp;
		return Long.toString(((timestamp - TIMER_OFFSET) << TIMESTAMP_LEFT_SHIFT) |
											(dataCenterId << DATACENTER_ID_SHIFT) |
													(workerId << WORKER_ID_SHIFT) |
																	(sequence));

	}