#include <sstream>
-// on SunOS 4.x, getrusage is stated in the man pages and exists, but
-// is not declared in resource.h. declare it ourselves
-#ifdef NO_HAVE_GETRUSAGE
-extern "C" {
- int getrusage(int who, struct rusage* ru);
-}
-#endif
-
-// When modifying the prefix list, we need to lock it just in case
-// another thread tries to do the same.
DEAL_II_NAMESPACE_OPEN
namespace
{
prefixes.push("DEAL:");
std_out->setf(std::ios::showpoint | std::ios::left);
-#ifdef HAVE_TIMES
+#if defined(HAVE_UNISTD_H) && defined(HAVE_TIMES)
reference_time_val = 1./sysconf(_SC_CLK_TCK) * times(&reference_tms);
#endif
}
void
LogStream::print_line_head()
{
-#ifndef DEAL_II_MSVC
+#ifdef HAVE_SYS_RESOURCE_H
rusage usage;
double utime = 0.;
if (print_utime)
LogStream::timestamp ()
{
struct tms current_tms;
-#ifdef HAVE_TIMES
+#if defined(HAVE_UNISTD_H) && defined(HAVE_TIMES)
const clock_t tick = sysconf(_SC_CLK_TCK);
const double time = 1./tick * times(¤t_tms);
#else
#include <iostream>
#include <list>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
DEAL_II_NAMESPACE_OPEN
unsigned int this_thread_id ()
{
#ifdef SYS_gettid
- const int this_id = syscall(SYS_gettid);
-#elif HAVE_GETPID
+ const pid_t this_id = syscall(SYS_gettid);
+#elif defined(HAVE_UNISTD_H) && defined(HAVE_GETPID)
const pid_t this_id = getpid();
#else
-# ifdef DEAL_II_MSVC
const unsigned int this_id = 0;
-# else
- const pid_t this_id = 0;
-# endif
#endif
+
return static_cast<unsigned int>(this_id);
}