Namespace for platform-dependent functions. More...
Functions | |
| bool | isDirectoryExist (const String &dir_name, bool &can_create) |
| void | platformInitialize () |
| Platform-specific initialization. | |
| void | platformInitialize (bool enable_fpe) |
| Platform-specific initialization. | |
| void | platformTerminate () |
| Platform-specific program termination routines. | |
| String | getCurrentDate () |
| Current date. | |
| long | getCurrentTime () |
| Current time. | |
| Int64 | getRealTimeNS () |
| Clock time in nanoseconds. | |
| String | getCurrentDateTime () |
| Current date and time in ISO 8601 format. | |
| String | getHostName () |
| Name of the machine running the process. | |
| String | getCurrentDirectory () |
| Current directory path. | |
| int | getProcessId () |
| Process ID. | |
| String | getUserName () |
| Username. | |
| String | getHomeDirectory () |
| Directory containing user documents. | |
| long unsigned int | getFileLength (const String &filename) |
| Length of the file filename. If the file is not readable or does not exist, returns 0. | |
| String | getEnvironmentVariable (const String &name) |
| Environment variable named name. | |
| bool | recursiveCreateDirectory (const String &dir_name) |
| Create a directory. | |
| bool | createDirectory (const String &dir_name) |
| Create a directory. | |
| bool | removeFile (const String &file_name) |
| Delete the file file_name. | |
| bool | isFileReadable (const String &file_name) |
| Checks if the file file_name is accessible and readable. | |
| String | getFileDirName (const String &file_name) |
| Returns the directory name of a file. | |
| void | stdMemcpy (void *to, const void *from, ::size_t len) |
| Memory block copy. | |
| double | getMemoryUsed () |
| Memory used in bytes. | |
| Int64 | getCPUTime () |
| CPU time used in microseconds. | |
| Real | getRealTime () |
| Real time used in seconds. | |
| String | timeToHourMinuteSecond (Real t) |
| Returns time in hours, minutes, and seconds format. | |
| bool | isDenormalized (Real v) |
| Returns true if v is denormalized (invalid float). | |
| IStackTraceService * | getStackTraceService () |
| Service used to obtain the call stack. | |
| IStackTraceService * | setStackTraceService (IStackTraceService *service) |
| Sets the service used to obtain the call stack. | |
| String | getStackTrace () |
| Returns a string containing the call stack. | |
| ISymbolizerService * | getSymbolizerService () |
| Service used to obtain information about source code symbols. | |
| ISymbolizerService * | setSymbolizerService (ISymbolizerService *service) |
| Sets the service to obtain information about source code symbols. | |
| void | safeStringCopy (char *output, Integer output_len, const char *input) |
| void | sleep (Integer nb_second) |
| Puts the process to sleep for nb_second seconds. | |
| void | enableFloatingException (bool active) |
| Enables or disables exceptions during a floating-point calculation. This operation is not supported on all platforms. If it is not supported, nothing happens. | |
| bool | isFloatingExceptionEnabled () |
| Indicates if processor floating exceptions are enabled. | |
| void | raiseFloatingException () |
| Raises a floating exception. | |
| bool | hasFloatingExceptionSupport () |
| Indicates if the implementation allows modifying the floating exception activation state. | |
| void | dumpStackTrace (std::ostream &ostr) |
| Dumps the call stack to the stream ostr. | |
| bool | getConsoleHasColor () |
| Indicates if the console supports colors. | |
| String | getCompilerId () |
| Character string used to identify the compiler used to compile Arccore. | |
| Int64 | getPageSize () |
| Host system page size in bytes. | |
| String | getLoadedSharedLibraryFullPath (const String &dll_name) |
| Returns the full path of a loaded dynamic library. | |
Variables | |
| IStackTraceService * | global_stack_trace_service = nullptr |
| ISymbolizerService * | global_symbolizer_service = nullptr |
| bool | global_has_color_console = false |
Namespace for platform-dependent functions.
This namespace contains all platform-dependent functions.
| bool Arcane::Platform::createDirectory | ( | const String & | dir_name | ) |
Create a directory.
Creates a directory named dir_name. This function assumes that the parent directory already exists.
| true | in case of failure, |
| false | in case of success or if the directory already exists. |
Definition at line 325 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::String::localstr().
| void Arcane::Platform::dumpStackTrace | ( | std::ostream & | ostr | ) |
Dumps the call stack to the stream ostr.
Definition at line 652 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References getStackTraceService(), Arcane::IStackTraceService::stackTrace(), and Arcane::StackTrace::toString().
| void Arcane::Platform::enableFloatingException | ( | bool | active | ) |
Enables or disables exceptions during a floating-point calculation. This operation is not supported on all platforms. If it is not supported, nothing happens.
Definition at line 680 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by platformInitialize().
| String Arcane::Platform::getCompilerId | ( | ) |
Character string used to identify the compiler used to compile Arccore.
Definition at line 889 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::StringBuilder::toString().
| bool Arcane::Platform::getConsoleHasColor | ( | ) |
Indicates if the console supports colors.
Definition at line 824 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| Int64 Arcane::Platform::getCPUTime | ( | ) |
CPU time used in microseconds.
The origin of the CPU time is taken when calling platformInitialize().
Definition at line 560 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by platformInitialize().
| String Arcane::Platform::getCurrentDate | ( | ) |
Current date.
The string is returned in the format day/month/year.
Definition at line 101 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getCurrentDateTime | ( | ) |
Current date and time in ISO 8601 format.
The string is returned in the format YYYY-MM-DDTHH:MM:SS.
Definition at line 129 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getCurrentDirectory | ( | ) |
Current directory path.
Definition at line 218 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| long Arcane::Platform::getCurrentTime | ( | ) |
Current time.
Returns the current date, expressed in seconds elapsed since January 1, 1970.
Definition at line 118 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Environment variable named name.
If no variable named name is defined, an empty string is returned.
Definition at line 255 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::String::localstr().
Referenced by platformInitialize(), and Arcane::Convert::ScalarType< T >::tryParseFromEnvironment().
Returns the directory name of a file.
Returns the directory name where the file named file_name is located. For example, if file_name is "/tmp/toto.cc", it returns "/tmp". If the file does not contain directories, it returns ".".
Definition at line 351 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| long unsigned int Arcane::Platform::getFileLength | ( | const String & | filename | ) |
Length of the file filename. If the file is not readable or does not exist, returns 0.
Definition at line 242 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getHomeDirectory | ( | ) |
Directory containing user documents.
This corresponds to the HOME environment variable on Unix, or the 'My Documents' directory under Win32.
Definition at line 191 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getHostName | ( | ) |
Name of the machine running the process.
Definition at line 147 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by Arcane::arccoreDebugPause().
Returns the full path of a loaded dynamic library.
Returns the full path of the dynamic library named dll_name. dll_name must only contain the library name without platform-specific extensions. For example, on Linux, do not use 'libtoto.so' but just 'toto'.
Returns a null string if the full path cannot be determined.
Definition at line 833 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::String::endsWith(), Arcane::String::localstr(), Arcane::String::null(), and Arcane::SpanImpl< T, SizeType, Extent >::size().
| double Arcane::Platform::getMemoryUsed | ( | ) |
Memory used in bytes.
Definition at line 542 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| Int64 Arcane::Platform::getPageSize | ( | ) |
Host system page size in bytes.
Definition at line 736 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| int Arcane::Platform::getProcessId | ( | ) |
Process ID.
Definition at line 233 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by Arcane::arccoreDebugPause().
| Real Arcane::Platform::getRealTime | ( | ) |
Real time used in seconds.
Definition at line 597 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| Int64 Arcane::Platform::getRealTimeNS | ( | ) |
Clock time in nanoseconds.
Definition at line 723 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getStackTrace | ( | ) |
Returns a string containing the call stack.
If no call stack management service is present (getStackTraceService()==0), the returned string is null.
Definition at line 448 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References getStackTraceService(), Arcane::IStackTraceService::stackTrace(), and Arcane::StackTrace::toString().
| IStackTraceService * Arcane::Platform::getStackTraceService | ( | ) |
Service used to obtain the call stack.
May return null if no service is available.
Definition at line 428 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by dumpStackTrace(), and getStackTrace().
| ISymbolizerService * Arcane::Platform::getSymbolizerService | ( | ) |
Service used to obtain information about source code symbols.
May return null if no service is available.
Definition at line 462 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| String Arcane::Platform::getUserName | ( | ) |
Username.
Definition at line 167 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::hasFloatingExceptionSupport | ( | ) |
Indicates if the implementation allows modifying the floating exception activation state.
If this method returns false, then the methods enableFloatingException() and isFloatingExceptionEnabled() have no effect.
Definition at line 670 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::isDenormalized | ( | Real | v | ) |
Returns true if v is denormalized (invalid float).
If the platform does not support this concept, it always returns false.
Definition at line 418 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::isDirectoryExist | ( | const String & | dir_name, |
| bool & | can_create ) |
Definition at line 270 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::isFileReadable | ( | const String & | file_name | ) |
Checks if the file file_name is accessible and readable.
| true | if the file is readable, |
| false | otherwise. |
Definition at line 397 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::String::localstr().
| bool Arcane::Platform::isFloatingExceptionEnabled | ( | ) |
Indicates if processor floating exceptions are enabled.
Definition at line 697 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| void Arcane::Platform::platformInitialize | ( | ) |
Platform-specific initialization.
This routine is called when the architecture is initialized. It allows certain operations that depend on the platform to be performed.
Activates floating exceptions if they are available.
Definition at line 807 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References platformInitialize().
Referenced by platformInitialize(), and Arcane::platform::platformInitialize().
| void Arcane::Platform::platformInitialize | ( | bool | enable_fpe | ) |
Platform-specific initialization.
This routine is called when the architecture is initialized. It allows certain operations that depend on the platform to be performed.
If enable_fpe is true, floating exceptions are enabled if they are available (via the call to enableFloatingException().
Definition at line 784 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References enableFloatingException(), getCPUTime(), and getEnvironmentVariable().
| void Arcane::Platform::platformTerminate | ( | ) |
Platform-specific program termination routines.
Cette routine is called just before exiting the program.
Definition at line 816 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by Arcane::platform::platformTerminate().
| void Arcane::Platform::raiseFloatingException | ( | ) |
Raises a floating exception.
This method does nothing if hasFloatingExceptionSupport()==false. Generally under Linux, this translates to sending a signal of type SIGFPE. By default, Arccore catches this signal and raises an 'ArithmeticException'.
Definition at line 710 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::recursiveCreateDirectory | ( | const String & | dir_name | ) |
Create a directory.
Creates the directory named dir_name. If necessary, creates the required parent directories.
| true | in case of failure, |
| false | in case of success or if the directory already exists. |
Definition at line 290 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| bool Arcane::Platform::removeFile | ( | const String & | file_name | ) |
Delete the file file_name.
| true | in case of failure, |
| false | in case of success or if the file does not exist. |
Definition at line 384 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Referenced by Arcane::TraceMng::finishInitialize().
| void Arcane::Platform::safeStringCopy | ( | char * | output, |
| Integer | output_len, | ||
| const char * | input ) |
Definition at line 482 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| IStackTraceService * Arcane::Platform::setStackTraceService | ( | IStackTraceService * | service | ) |
Sets the service used to obtain the call stack.
Returns the previously used service.
Definition at line 437 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| ISymbolizerService * Arcane::Platform::setSymbolizerService | ( | ISymbolizerService * | service | ) |
Sets the service to obtain information about source code symbols.
Returns the previously used service.
Definition at line 471 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| void Arcane::Platform::sleep | ( | Integer | nb_second | ) |
Puts the process to sleep for nb_second seconds.
Definition at line 636 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References sleep().
Referenced by sleep().
| void Arcane::Platform::stdMemcpy | ( | void * | to, |
| const void * | from, | ||
| ::size_t | len ) |
Memory block copy.
Copies len bytes from address from to address to.
Definition at line 409 of file arccore/src/base/arccore/base/PlatformUtils.cc.
Returns time in hours, minutes, and seconds format.
Converts t, expressed in seconds, into the format AhBmCs where A is hours, B is minutes, and C is seconds. For example, 3732 becomes 1h2m12s.
Definition at line 610 of file arccore/src/base/arccore/base/PlatformUtils.cc.
References Arcane::StringBuilder::toString().
| bool Arcane::Platform::global_has_color_console = false |
Definition at line 95 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| IStackTraceService* Arcane::Platform::global_stack_trace_service = nullptr |
Definition at line 93 of file arccore/src/base/arccore/base/PlatformUtils.cc.
| ISymbolizerService* Arcane::Platform::global_symbolizer_service = nullptr |
Definition at line 94 of file arccore/src/base/arccore/base/PlatformUtils.cc.