-
Notifications
You must be signed in to change notification settings - Fork 2
/
OS.h
38 lines (34 loc) · 1.23 KB
/
OS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues
#ifndef _OS_H_
#define _OS_H_
#include <string>
#include <stdio.h>
FILE *Fopen(const char *f, const char *mode);
const char *GetEnvironmentVar(const char *var);
void SetEnvironmentVar(const char *var, const char *val);
double GetTimeInSeconds();
void SleepInSeconds(double s);
void CheckResources();
double Cpu();
double TotalRam();
double TimeOfDay();
long GetMemoryUsage();
int GetProcessId();
std::string GetExecutableFileName();
std::string GetAbsolutePath(const std::string &fileName);
std::string GetHostName();
int UnlinkFile(const std::string &fileName);
int StatFile(const std::string &fileName);
int KillProcess(int pid);
int CreateSingleDir(const std::string &dirName);
void CreatePath(const std::string &fullPath);
int SystemCall(const std::string &command, bool blocking = false);
int SystemCallExe(const std::string &exe, const std::string &argsOrCommand,
bool blocking = false);
std::string GetCurrentWorkdir();
void RedirectIOToConsole();
void UnzipFile(const std::string &fileName, const std::string &prependDir = "");
#endif