Logo ROOT  
Reference Guide
TUUID.cxx
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Fons Rademakers 30/9/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TUUID
13\ingroup Base
14
15This class defines a UUID (Universally Unique IDentifier), also
16known as GUIDs (Globally Unique IDentifier). A UUID is 128 bits
17long, and if generated according to this algorithm, is either
18guaranteed to be different from all other UUIDs/GUIDs generated
19until 3400 A.D. or extremely likely to be different. UUIDs were
20originally used in the Network Computing System (NCS) and
21later in the Open Software Foundation's (OSF) Distributed Computing
22Environment (DCE).
23
24Structure of universal unique IDs (UUIDs).
25
26Depending on the network data representation, the multi-
27octet unsigned integer fields are subject to byte swapping
28when communicated between dissimilar endian machines.
29~~~ {.cpp}
30+-----------------------------------+
31| low 32 bits of time | 0-3 .fTimeLow
32+-------------------------------+----
33| mid 16 bits of time | 4-5 .fTimeMid
34+-------+-----------------------+
35| vers. | hi 12 bits of time | 6-7 .fTimeHiAndVersion
36+-------+-------+---------------+
37|Res | clkSeqHi | 8 .fClockSeqHiAndReserved
38+---------------+
39| clkSeqLow | 9 .fClockSeqLow
40+---------------+------------------+
41| node ID | 10-15 .fNode
42+----------------------------------+
43~~~
44
45The adjusted time stamp is split into three fields, and the
46clockSeq is split into two fields.
47
48The timestamp is a 60-bit value. For UUID version 1, this
49is represented by Coordinated Universal Time (UTC/GMT) as
50a count of 100-nanosecond intervals since 00:00:00.00,
5115 October 1582 (the date of Gregorian reform to the
52Christian calendar).
53
54The version number is multiplexed in the 4 most significant
55bits of the 'fTimeHiAndVersion' field. There are two defined
56versions:
57~~~ {.cpp}
58 MSB <---
59Version 4-Bit Code Description
60------------------------------------------------------------
61| 1 0 0 0 1 DCE version, as specified herein.
62| 2 0 0 1 0 DCE Security version, with
63| embedded POSIX UIDs.
64| 3 0 0 1 1 node id is a random value
65------------------------------------------------------------
66~~~
67
68## Clock Sequence
69
70The clock sequence value must be changed whenever:
71
72 The UUID generator detects that the local value of UTC
73 has gone backward; this may be due to re-syncing of the system
74 clock.
75
76While a node is operational, the UUID service always saves
77the last UTC used to create a UUID. Each time a new UUID
78is created, the current UTC is compared to the saved value
79and if either the current value is less or the saved value
80was lost, then the clock sequence is incremented modulo
8116,384, thus avoiding production of duplicated UUIDs.
82
83The clock sequence must be initialized to a random number
84to minimize the correlation across system. This provides
85maximum protection against node identifiers that may move
86or switch from system to system rapidly.
87
88## Clock Adjustment
89
90UUIDs may be created at a rate greater than the system clock
91resolution. Therefore, the system must also maintain an
92adjustment value to be added to the lower-order bits of the
93time. Logically, each time the system clock ticks, the
94adjustment value is cleared. Every time a UUID is generated,
95the current adjustment value is read and incremented, and
96then added to the UTC time field of the UUID.
97
98## Clock Overrun
99
100The 100-nanosecond granularity of time should prove sufficient
101even for bursts of UUID production in the next generation of
102high-performance multiprocessors. If a system overruns the
103clock adjustment by requesting too many UUIDs within a single
104system clock tick, the UUID generator will stall until the
105system clock catches up.
106*/
107
108#include "TROOT.h"
109#include "TDatime.h"
110#include "TUUID.h"
111#include "TBuffer.h"
112#include "TError.h"
113#include "TSystem.h"
114#include "TInetAddress.h"
115#include "TMD5.h"
116#include "Bytes.h"
117#include "TVirtualMutex.h"
118#include "ThreadLocalStorage.h"
119#include <string.h>
120#include <stdlib.h>
121#ifdef R__WIN32
122#include "Windows4Root.h"
123#include <Iphlpapi.h>
124#include <process.h>
125#define getpid() _getpid()
126#define srandom(seed) srand(seed)
127#define random() rand()
128#else
129#include <unistd.h>
130#include <sys/time.h>
131#if defined(R__LINUX) && !defined(R__WINGCC)
132#include <sys/sysinfo.h>
133#endif
134#include <ifaddrs.h>
135#include <netinet/in.h>
136#endif
137#include <chrono>
138
140
141////////////////////////////////////////////////////////////////////////////////
142/// Create a UUID.
143
145{
146 TTHREAD_TLS(uuid_time_t) time_last;
147 TTHREAD_TLS(UShort_t) clockseq(0);
148 TTHREAD_TLS(Bool_t) firstTime(kTRUE);
149 uuid_time_t *time_last_ptr = TTHREAD_TLS_PTR(time_last);
150
151 if (firstTime) {
152 R__LOCKGUARD(gROOTMutex); // rand and random are not thread safe.
153
154 UInt_t seed;
155 if (gSystem) {
156 // try to get a unique seed per process
157 seed = (UInt_t)(Long64_t(gSystem->Now()) + gSystem->GetPid());
158 } else {
159 using namespace std::chrono;
160 system_clock::time_point today = system_clock::now();
161 seed = (UInt_t)(system_clock::to_time_t ( today )) + ::getpid();
162 }
163 srandom(seed);
164 GetCurrentTime(time_last_ptr);
165 clockseq = 1+(UShort_t)(65536*random()/(RAND_MAX+1.0));
166 firstTime = kFALSE;
167 }
168
169 uuid_time_t timestamp;
170
171 // get current time
172 GetCurrentTime(&timestamp);
173
174 // if clock went backward change clockseq
175 if (CmpTime(&timestamp, time_last_ptr) == -1) {
176 clockseq = (clockseq + 1) & 0x3FFF;
177 if (clockseq == 0) clockseq++;
178 }
179
180 Format(clockseq, timestamp);
181
182 time_last = timestamp;
183 fUUIDIndex = 1<<30;
184}
185
186////////////////////////////////////////////////////////////////////////////////
187/// delete this TUUID
188
190{
191 //gROOT->GetUUIDs()->RemoveUUID(fUUIDIndex);
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Compare two time values.
196
198{
199 if (t1->high < t2->high) return -1;
200 if (t1->high > t2->high) return 1;
201 if (t1->low < t2->low) return -1;
202 if (t1->low > t2->low) return 1;
203 return 0;
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Set this UUID to the value specified in uuid ((which must be in
208/// TUUID::AsString() format).
209
210void TUUID::SetFromString(const char *uuid)
211{
212 // Format is tttttttt-tttt-cccc-cccc-nnnnnnnnnnnn.
213 Long_t timeLo;
214 int timeMid;
215 int timeHiAndVersion;
216 int clockSeqHiAndRes;
217 int clockSeqLo;
218 int node[6];
219
220 sscanf(uuid, "%8lx-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x",
221 &timeLo,
222 &timeMid,
223 &timeHiAndVersion,
224 &clockSeqHiAndRes,
225 &clockSeqLo,
226 &node[0], &node[1], &node[2], &node[3], &node[4], &node[5]);
227
228 // Note that we're going through this agony because scanf is
229 // defined to know only to scan into "int"s or "long"s.
230 fTimeLow = (UInt_t) timeLo;
231 fTimeMid = (UShort_t) timeMid;
232 fTimeHiAndVersion = (UShort_t) timeHiAndVersion;
233 fClockSeqHiAndReserved = (UChar_t) clockSeqHiAndRes;
234 fClockSeqLow = (UChar_t) clockSeqLo;
235 fNode[0] = (UChar_t) node[0];
236 fNode[1] = (UChar_t) node[1];
237 fNode[2] = (UChar_t) node[2];
238 fNode[3] = (UChar_t) node[3];
239 fNode[4] = (UChar_t) node[4];
240 fNode[5] = (UChar_t) node[5];
241 fUUIDIndex = 1<<30;
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Initialize a TUUID with uuid (which must be in TUUID::AsString() format).
246
247TUUID::TUUID(const char *uuid)
248{
249 fTimeLow = 0;
250 fTimeMid = 0;
253 fClockSeqLow = 0;
254 fNode[0] = 0;
255 fUUIDIndex = 0;
256
257 if (!uuid || !*uuid)
258 Error("TUUID", "null string not allowed");
259 else
260 SetFromString(uuid);
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Stream UUID into output buffer.
265
266void TUUID::FillBuffer(char *&buffer)
267{
268 Version_t version = TUUID::Class_Version();
269 tobuf(buffer, version);
270 tobuf(buffer, fTimeLow);
271 tobuf(buffer, fTimeMid);
272 tobuf(buffer, fTimeHiAndVersion);
274 tobuf(buffer, fClockSeqLow);
275 for (Int_t i = 0; i < 6; i++)
276 tobuf(buffer, fNode[i]);
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Stream UUID from input buffer.
281
282void TUUID::ReadBuffer(char *&buffer)
283{
284 Version_t version;
285 frombuf(buffer, &version);
286 frombuf(buffer, &fTimeLow);
287 frombuf(buffer, &fTimeMid);
288 frombuf(buffer, &fTimeHiAndVersion);
290 frombuf(buffer, &fClockSeqLow);
291 for (Int_t i = 0; i < 6; i++)
292 frombuf(buffer, &fNode[i]);
293}
294
295////////////////////////////////////////////////////////////////////////////////
296/// Stream UUID from input buffer.
297/// This function is for the exclusive use of TDirectory::Streamer() to
298/// read a non-versioned version of TUUID.
299
301{
302 b >> fTimeLow;
303 b >> fTimeMid;
306 b >> fClockSeqLow;
307 for (UInt_t i = 0; i < 6; i++) {
308 b >> fNode[i];
309 }
310}
311
312////////////////////////////////////////////////////////////////////////////////
313/// Make a UUID from timestamp, clockseq and node id.
314
316{
317 fTimeLow = ts.low;
318 fTimeMid = (UShort_t)(ts.high & 0xFFFF);
319 fTimeHiAndVersion = (UShort_t)((ts.high >> 16) & 0x0FFF);
320 fTimeHiAndVersion |= (1 << 12);
321 fClockSeqLow = clockseq & 0xFF;
322 fClockSeqHiAndReserved = (clockseq & 0x3F00) >> 8;
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Get current time as 60 bit 100ns ticks since whenever.
329/// Compensate for the fact that real clock resolution is less
330/// than 100ns.
331
333{
334 const UShort_t uuids_per_tick = 1024;
335
336 TTHREAD_TLS(uuid_time_t) time_last;
337 TTHREAD_TLS(UShort_t) uuids_this_tick(0);
338 TTHREAD_TLS(Bool_t) init(kFALSE);
339
340 uuid_time_t *time_last_ptr = TTHREAD_TLS_PTR(time_last);
341
342 if (!init) {
343 GetSystemTime(time_last_ptr);
344 uuids_this_tick = uuids_per_tick;
345 init = kTRUE;
346 }
347
348 uuid_time_t time_now;
349
350 while (1) {
351 GetSystemTime(&time_now);
352
353 // if clock reading changed since last UUID generated
354 if (CmpTime(time_last_ptr, &time_now)) {
355 // reset count of uuid's generated with this clock reading
356 uuids_this_tick = 0;
357 break;
358 }
359 if (uuids_this_tick < uuids_per_tick) {
360 uuids_this_tick++;
361 break;
362 }
363 // going too fast for our clock; spin
364 }
365
366 time_last = time_now;
367
368 if (uuids_this_tick != 0) {
369 if (time_now.low & 0x80000000) {
370 time_now.low += uuids_this_tick;
371 if (!(time_now.low & 0x80000000))
372 time_now.high++;
373 } else
374 time_now.low += uuids_this_tick;
375 }
376
377 timestamp->high = time_now.high;
378 timestamp->low = time_now.low;
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Get system time with 100ns precision. Time is since Oct 15, 1582.
383
385{
386#ifdef R__WIN32
387 ULARGE_INTEGER time;
388 GetSystemTimeAsFileTime((FILETIME *)&time);
389 // NT keeps time in FILETIME format which is 100ns ticks since
390 // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
391 // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
392 // + 18 years and 5 leap days.
393 time.QuadPart +=
394 (unsigned __int64) (1000*1000*10) // seconds
395 * (unsigned __int64) (60 * 60 * 24) // days
396 * (unsigned __int64) (17+30+31+365*18+5); // # of days
397
398 timestamp->high = time.HighPart;
399 timestamp->low = time.LowPart;
400#else
401 struct timeval tp;
402 gettimeofday(&tp, 0);
403 // Offset between UUID formatted times and Unix formatted times.
404 // UUID UTC base time is October 15, 1582.
405 // Unix base time is January 1, 1970.
406 ULong64_t uuid_time = ((ULong64_t)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
407 0x01B21DD213814000LL;
408 timestamp->high = (UInt_t) (uuid_time >> 32);
409 timestamp->low = (UInt_t) (uuid_time & 0xFFFFFFFF);
410#endif
411}
412
413////////////////////////////////////////////////////////////////////////////////
414/// Get node identifier. Try first to get network address, if no
415/// network interface try random info based on some machine parameters.
416
418{
419 static UInt_t adr = 0;
420
421 if (gSystem) {
422#ifndef R__WIN32
423 if (!adr) {
424 UInt_t addr = 0;
425
426 struct ifaddrs *ifAddrStruct = nullptr;
427 struct ifaddrs *ifa = nullptr;
428
429 if (getifaddrs(&ifAddrStruct) != 0) {
430 adr = 1;
431 } else {
432 for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
433 if (!ifa->ifa_addr) {
434 continue;
435 }
436 if (ifa->ifa_addr->sa_family != AF_INET) { // check only IP4
437 continue;
438 }
439 if (strncmp(ifa->ifa_name,"lo",2) == 0) { // skip loop back.
440 continue;
441 }
442 addr = ntohl(((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr);
443 break;
444 }
445 }
446
447 if (ifAddrStruct != nullptr)
448 freeifaddrs(ifAddrStruct);
449
450 if (addr)
451 adr = addr;
452 else
453 adr = 1; // illegal address
454 }
455#else
456 // this way to get the machine's IP address is needed because
457 // GetHostByName() on Win32 contacts the DNS which we don't want
458 // as firewall tools like ZoneAlarm are likely to catch it and
459 // alarm the user
460 if (!adr) {
461 PIP_ADAPTER_INFO ainfo = (PIP_ADAPTER_INFO) malloc(sizeof(IP_ADAPTER_INFO));
462 ULONG buflen = sizeof(IP_ADAPTER_INFO);
463 DWORD stat = GetAdaptersInfo(ainfo, &buflen);
464 if (stat == ERROR_BUFFER_OVERFLOW) {
465 free(ainfo);
466 ainfo = (PIP_ADAPTER_INFO) malloc(buflen);
467 stat = GetAdaptersInfo(ainfo, &buflen);
468 }
469 if (stat != ERROR_SUCCESS)
470 adr = 1; // illegal address
471 else {
472 // take address of first adapter
473 PIP_ADAPTER_INFO adapter = ainfo;
474 int a, b, c, d;
475 sscanf(adapter->IpAddressList.IpAddress.String, "%d.%d.%d.%d",
476 &a, &b, &c, &d);
477 adr = (a << 24) | (b << 16) | (c << 8) | d;
478 }
479 free(ainfo);
480 }
481#endif
482 if (adr > 2) {
483 memcpy(fNode, &adr, 4);
484 fNode[4] = 0xbe;
485 fNode[5] = 0xef;
486 return;
487 }
488 }
489 static UChar_t seed[16];
490 if (adr < 2) {
491 GetRandomInfo(seed);
492 seed[0] |= 0x80;
493 if (gSystem) adr = 2; // illegal address
494 }
495 memcpy(fNode, seed, sizeof(fNode));
496 fTimeHiAndVersion |= (3 << 12); // version == 3: random node info
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Get random info based on some machine parameters.
501
503{
504#ifdef R__WIN32
505 struct randomness {
506 MEMORYSTATUS m;
507 SYSTEM_INFO s;
508 FILETIME t;
509 LARGE_INTEGER pc;
510 DWORD tc;
511 DWORD l;
512 char hostname[MAX_COMPUTERNAME_LENGTH + 1];
513 };
514 randomness r;
515 memset(&r, 0, sizeof(r)); // zero also padding bytes
516
517 // memory usage stats
518 GlobalMemoryStatus(&r.m);
519 // random system stats
520 GetSystemInfo(&r.s);
521 // 100ns resolution time of day
522 GetSystemTimeAsFileTime(&r.t);
523 // high resolution performance counter
524 QueryPerformanceCounter(&r.pc);
525 // milliseconds since last boot
526 r.tc = GetTickCount();
527 r.l = MAX_COMPUTERNAME_LENGTH + 1;
528 GetComputerName(r.hostname, &r.l);
529#else
530 struct randomness {
531#if defined(R__LINUX) && !defined(R__WINGCC)
532 struct sysinfo s;
533#endif
534 struct timeval t;
535 char hostname[257];
536 };
537 randomness r;
538 memset(&r, 0, sizeof(r)); // zero also padding bytes
539
540#if defined(R__LINUX) && !defined(R__WINGCC)
541 sysinfo(&r.s);
542#endif
543 gettimeofday(&r.t, 0);
544 gethostname(r.hostname, 256);
545#endif
546 TMD5 md5;
547 md5.Update((UChar_t *)&r, sizeof(randomness));
548 md5.Final(seed);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Print UUID.
553
554void TUUID::Print() const
555{
556 printf("%s\n", AsString());
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Return UUID as string. Copy string immediately since it will be reused.
561
562const char *TUUID::AsString() const
563{
564 static char uuid[40];
565
566 snprintf(uuid,40, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
568 fClockSeqLow, fNode[0], fNode[1], fNode[2], fNode[3], fNode[4],
569 fNode[5]);
570
571 return uuid;
572}
573
574////////////////////////////////////////////////////////////////////////////////
575/// Compute 16-bit hash value of the UUID.
576
578{
579 Short_t c0 = 0, c1 = 0, x, y;
580 char *c = (char *) &fTimeLow;
581
582 // For speed lets unroll the following loop:
583 // for (i = 0; i < 16; i++) {
584 // c0 += *c++;
585 // c1 += c0;
586 // }
587
588 c0 += *c++; c1 += c0;
589 c0 += *c++; c1 += c0;
590 c0 += *c++; c1 += c0;
591 c0 += *c++; c1 += c0;
592
593 c0 += *c++; c1 += c0;
594 c0 += *c++; c1 += c0;
595 c0 += *c++; c1 += c0;
596 c0 += *c++; c1 += c0;
597
598 c0 += *c++; c1 += c0;
599 c0 += *c++; c1 += c0;
600 c0 += *c++; c1 += c0;
601 c0 += *c++; c1 += c0;
602
603 c0 += *c++; c1 += c0;
604 c0 += *c++; c1 += c0;
605 c0 += *c++; c1 += c0;
606 c0 += *c++; c1 += c0;
607
608 // Calculate the value for "First octet" of the hash
609 x = -c1 % 255;
610 if (x < 0)
611 x += 255;
612
613 // Calculate the value for "second octet" of the hash
614 y = (c1 - c0) % 255;
615 if (y < 0)
616 y += 255;
617
618 return UShort_t((y << 8) + x);
619}
620
621////////////////////////////////////////////////////////////////////////////////
622/// Compare two UUIDs "lexically" and return
623/// - -1 this is lexically before u
624/// - 0 this is equal to u
625/// - 1 this is lexically after u
626
628{
629#define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
635 for (int i = 0; i < 6; i++) {
636 if (fNode[i] < u.fNode[i])
637 return -1;
638 if (fNode[i] > u.fNode[i])
639 return 1;
640 }
641 return 0;
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// Get address of host encoded in UUID. If host id is not an ethernet
646/// address, but random info, then the returned TInetAddress is not valid.
647
649{
650 if ((fTimeHiAndVersion >> 12) == 1) {
651 UInt_t addr;
652 memcpy(&addr, fNode, 4);
653 return TInetAddress("????", addr, 0);
654 }
655 return TInetAddress();
656}
657
658////////////////////////////////////////////////////////////////////////////////
659/// Get time from UUID.
660
662{
663 TDatime dt;
664 uuid_time_t ts;
665
666 ts.low = fTimeLow;
667 ts.high = (UInt_t)fTimeMid;
668 ts.high |= (UInt_t)((fTimeHiAndVersion & 0x0FFF) << 16);
669
670 // Offset between UUID formatted times and Unix formatted times.
671 // UUID UTC base time is October 15, 1582.
672 // Unix base time is January 1, 1970.
673 ULong64_t high = ts.high;
674 ULong64_t uuid_time = (high << 32) + ts.low;
675 uuid_time -= 0x01B21DD213814000LL;
676 uuid_time /= 10000000LL;
677 UInt_t tt = (UInt_t) uuid_time;
678 dt.Set(tt);
679
680 return dt;
681}
682
683////////////////////////////////////////////////////////////////////////////////
684/// Return uuid in specified buffer (16 byte = 128 bits).
685
686void TUUID::GetUUID(UChar_t uuid[16]) const
687{
688 memcpy(uuid, &fTimeLow, 16);
689}
690
691////////////////////////////////////////////////////////////////////////////////
692/// Set this UUID to the value specified in uuid ((which must be in
693/// TUUID::AsString() format).
694
695void TUUID::SetUUID(const char *uuid)
696{
697 if (!uuid || !*uuid)
698 Error("SetUUID", "null string not allowed");
699 else
700 SetFromString(uuid);
701}
702
703////////////////////////////////////////////////////////////////////////////////
704/// Input operator. Delegate to Streamer.
705
706TBuffer &operator<<(TBuffer &buf, const TUUID &uuid)
707{
708 R__ASSERT( buf.IsWriting() );
709
710 const_cast<TUUID&>(uuid).Streamer(buf);
711 return buf;
712}
void frombuf(char *&buf, Bool_t *x)
Definition: Bytes.h:280
void tobuf(char *&buf, Bool_t x)
Definition: Bytes.h:57
ROOT::R::TRInterface & r
Definition: Object.C:4
#define d(i)
Definition: RSha256.hxx:102
#define b(i)
Definition: RSha256.hxx:100
#define c(i)
Definition: RSha256.hxx:101
unsigned short UShort_t
Definition: RtypesCore.h:38
short Version_t
Definition: RtypesCore.h:63
unsigned char UChar_t
Definition: RtypesCore.h:36
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
short Short_t
Definition: RtypesCore.h:37
long long Long64_t
Definition: RtypesCore.h:71
unsigned long long ULong64_t
Definition: RtypesCore.h:72
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
#define R__ASSERT(e)
Definition: TError.h:96
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:59
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
#define CHECK(f1, f2)
TBuffer & operator<<(TBuffer &buf, const TUUID &uuid)
Input operator. Delegate to Streamer.
Definition: TUUID.cxx:706
#define R__LOCKGUARD(mutex)
#define free
Definition: civetweb.c:1539
#define snprintf
Definition: civetweb.c:1540
#define malloc
Definition: civetweb.c:1536
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
Bool_t IsWriting() const
Definition: TBuffer.h:86
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
void Set()
Set Date/Time to current time as reported by the system.
Definition: TDatime.cxx:288
This class represents an Internet Protocol (IP) address.
Definition: TInetAddress.h:36
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:44
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
Definition: TMD5.cxx:108
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Definition: TMD5.cxx:167
virtual int GetPid()
Get process id.
Definition: TSystem.cxx:705
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:461
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition: TUUID.h:42
UChar_t fClockSeqLow
Definition: TUUID.h:50
UChar_t fClockSeqHiAndReserved
Definition: TUUID.h:49
UChar_t fNode[6]
Definition: TUUID.h:51
void GetCurrentTime(uuid_time_t *timestamp)
Get current time as 60 bit 100ns ticks since whenever.
Definition: TUUID.cxx:332
Int_t CmpTime(uuid_time_t *t1, uuid_time_t *t2)
Compare two time values.
Definition: TUUID.cxx:197
void GetSystemTime(uuid_time_t *timestamp)
Get system time with 100ns precision. Time is since Oct 15, 1582.
Definition: TUUID.cxx:384
virtual ~TUUID()
delete this TUUID
Definition: TUUID.cxx:189
void ReadBuffer(char *&buffer)
Stream UUID from input buffer.
Definition: TUUID.cxx:282
void SetFromString(const char *uuid_str)
Set this UUID to the value specified in uuid ((which must be in TUUID::AsString() format).
Definition: TUUID.cxx:210
void Format(UShort_t clockseq, uuid_time_t ts)
Make a UUID from timestamp, clockseq and node id.
Definition: TUUID.cxx:315
TDatime GetTime() const
Get time from UUID.
Definition: TUUID.cxx:661
UInt_t fTimeLow
index in the list of UUIDs in TProcessUUID
Definition: TUUID.h:46
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
Definition: TUUID.cxx:562
void GetUUID(UChar_t uuid[16]) const
Return uuid in specified buffer (16 byte = 128 bits).
Definition: TUUID.cxx:686
TInetAddress GetHostAddress() const
Get address of host encoded in UUID.
Definition: TUUID.cxx:648
void SetUUID(const char *uuid_str)
Set this UUID to the value specified in uuid ((which must be in TUUID::AsString() format).
Definition: TUUID.cxx:695
UShort_t Hash() const
Compute 16-bit hash value of the UUID.
Definition: TUUID.cxx:577
UShort_t fTimeHiAndVersion
Definition: TUUID.h:48
TUUID()
Create a UUID.
Definition: TUUID.cxx:144
UShort_t fTimeMid
Definition: TUUID.h:47
UInt_t fUUIDIndex
Definition: TUUID.h:45
void GetRandomInfo(UChar_t seed[16])
Get random info based on some machine parameters.
Definition: TUUID.cxx:502
void Print() const
Print UUID.
Definition: TUUID.cxx:554
Int_t Compare(const TUUID &u) const
Compare two UUIDs "lexically" and return.
Definition: TUUID.cxx:627
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
Definition: TUUID.cxx:266
void GetNodeIdentifier()
Get node identifier.
Definition: TUUID.cxx:417
void StreamerV1(TBuffer &b)
Stream UUID from input buffer.
Definition: TUUID.cxx:300
return c1
Definition: legend1.C:41
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
EvaluateInfo init(std::vector< RooRealProxy > parameters, std::vector< ArrayWrapper * > wrappers, std::vector< double * > arrays, size_t begin, size_t batchSize)
static constexpr double s
static constexpr double pc
UInt_t low
Definition: TUUID.h:55
UInt_t high
Definition: TUUID.h:54
auto * m
Definition: textangle.C:8
auto * tt
Definition: textangle.C:16
auto * l
Definition: textangle.C:4
auto * a
Definition: textangle.C:12
auto * t1
Definition: textangle.C:20