aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llsys.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/llsys.h')
-rw-r--r--linden/indra/llcommon/llsys.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llsys.h b/linden/indra/llcommon/llsys.h
new file mode 100644
index 0000000..7753adb
--- /dev/null
+++ b/linden/indra/llcommon/llsys.h
@@ -0,0 +1,110 @@
1/**
2 * @file llsys.h
3 * @brief System information debugging classes.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_SYS_H
29#define LL_SYS_H
30
31//
32// The LLOSInfo, LLCPUInfo, and LLMemoryInfo classes are essentially
33// the same, but query different machine subsystems. Here's how you
34// use an LLCPUInfo object:
35//
36// LLCPUInfo info;
37// llinfos << info << llendl;
38//
39
40#include <iosfwd>
41#include <string>
42
43class LLOSInfo
44{
45public:
46 LLOSInfo();
47 void stream(std::ostream& s) const;
48
49 const std::string& getOSString() const;
50
51 S32 mMajorVer;
52 S32 mMinorVer;
53 S32 mBuild;
54
55#ifndef LL_WINDOWS
56 static S32 getMaxOpenFiles();
57#endif
58
59 static U32 getProcessVirtualSizeKB();
60 static U32 getProcessResidentSizeKB();
61private:
62 std::string mOSString;
63};
64
65
66class LLCPUInfo
67{
68public:
69 LLCPUInfo();
70 void stream(std::ostream& s) const;
71
72 std::string getCPUString() const;
73 std::string getCPUStringTerse() const;
74
75 BOOL hasSSE() const { return mHasSSE; }
76 BOOL hasSSE2() const { return mHasSSE2; }
77 S32 getMhz() const { return mCPUMhz; }
78
79 // Family is "AMD Duron" or "Intel Pentium Pro"
80 const std::string& getFamily() const { return mFamily; }
81
82private:
83 BOOL mHasSSE;
84 BOOL mHasSSE2;
85 S32 mCPUMhz;
86 std::string mFamily;
87};
88
89class LLMemoryInfo
90{
91public:
92 LLMemoryInfo();
93 void stream(std::ostream& s) const;
94
95 U32 getPhysicalMemory() const;
96};
97
98
99std::ostream& operator<<(std::ostream& s, const LLOSInfo& info);
100std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info);
101std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info);
102
103// gunzip srcfile into dstfile. Returns FALSE on error.
104BOOL gunzip_file(const char *srcfile, const char *dstfile);
105// gzip srcfile into dstfile. Returns FALSE on error.
106BOOL gzip_file(const char *srcfile, const char *dstfile);
107
108extern LLCPUInfo gSysCPU;
109
110#endif // LL_LLSYS_H