[flang][runtime] MCLOCK library routine (#148960)
Add MCLOCK as an interface to std::clock().
This commit is contained in:
parent
52a46dc57f
commit
bbcdad1f8e
@ -27,10 +27,7 @@
|
||||
#include <thread>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
#include "flang/Common/windows-include.h"
|
||||
#include <synchapi.h>
|
||||
|
||||
inline void CtimeBuffer(char *buffer, size_t bufsize, const time_t cur_time,
|
||||
@ -309,6 +306,9 @@ void RTNAME(Perror)(const char *str) { perror(str); }
|
||||
// GNU extension function TIME()
|
||||
std::int64_t RTNAME(time)() { return time(nullptr); }
|
||||
|
||||
// MCLOCK: returns accumulated CPU time in ticks
|
||||
std::int32_t FORTRAN_PROCEDURE_NAME(mclock)() { return std::clock(); }
|
||||
|
||||
// Extension procedures related to I/O
|
||||
|
||||
namespace io {
|
||||
|
@ -709,8 +709,9 @@ CACHESIZE, EOF, FP_CLASS, INT_PTR_KIND, ISNAN, LOC
|
||||
MALLOC, FREE
|
||||
```
|
||||
|
||||
### Library subroutine
|
||||
### Library subroutines and functions
|
||||
```
|
||||
ticks = MCLOCK()
|
||||
CALL BACKTRACE()
|
||||
CALL FDATE(TIME)
|
||||
CALL GETLOG(USRNAME)
|
||||
|
@ -12,14 +12,12 @@
|
||||
#ifndef FORTRAN_RUNTIME_EXTENSIONS_H_
|
||||
#define FORTRAN_RUNTIME_EXTENSIONS_H_
|
||||
|
||||
#include "flang/Runtime/entry-names.h"
|
||||
|
||||
#define FORTRAN_PROCEDURE_NAME(name) name##_
|
||||
|
||||
#include "flang/Runtime/entry-names.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#define FORTRAN_PROCEDURE_NAME(name) name##_
|
||||
|
||||
#ifdef _WIN32
|
||||
// UID and GID don't exist on Windows, these exist to avoid errors.
|
||||
typedef std::uint32_t uid_t;
|
||||
@ -89,5 +87,8 @@ int FORTRAN_PROCEDURE_NAME(ierrno)();
|
||||
// GNU extension subroutine PERROR(STRING)
|
||||
void RTNAME(Perror)(const char *str);
|
||||
|
||||
// MCLOCK -- returns accumulated time in ticks
|
||||
int FORTRAN_PROCEDURE_NAME(mclock)();
|
||||
|
||||
} // extern "C"
|
||||
#endif // FORTRAN_RUNTIME_EXTENSIONS_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user