diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llcommon/llmemory.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llcommon/llmemory.cpp')
-rw-r--r-- | linden/indra/llcommon/llmemory.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/linden/indra/llcommon/llmemory.cpp b/linden/indra/llcommon/llmemory.cpp index a03fe9d..a6de3d2 100644 --- a/linden/indra/llcommon/llmemory.cpp +++ b/linden/indra/llcommon/llmemory.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -38,7 +39,7 @@ | |||
38 | # include <sys/types.h> | 39 | # include <sys/types.h> |
39 | # include <mach/task.h> | 40 | # include <mach/task.h> |
40 | # include <mach/mach_init.h> | 41 | # include <mach/mach_init.h> |
41 | #elif defined(LL_LINUX) | 42 | #elif LL_LINUX || LL_SOLARIS |
42 | # include <unistd.h> | 43 | # include <unistd.h> |
43 | #endif | 44 | #endif |
44 | 45 | ||
@@ -388,6 +389,34 @@ bail: | |||
388 | return rss; | 389 | return rss; |
389 | } | 390 | } |
390 | 391 | ||
392 | #elif LL_SOLARIS | ||
393 | #include <sys/types.h> | ||
394 | #include <sys/stat.h> | ||
395 | #include <fcntl.h> | ||
396 | #define _STRUCTURED_PROC 1 | ||
397 | #include <sys/procfs.h> | ||
398 | |||
399 | U64 getCurrentRSS() | ||
400 | { | ||
401 | char path [LL_MAX_PATH]; /* Flawfinder: ignore */ | ||
402 | |||
403 | sprintf(path, "/proc/%d/psinfo", (int)getpid()); | ||
404 | int proc_fd = -1; | ||
405 | if((proc_fd = open(path, O_RDONLY)) == -1){ | ||
406 | llwarns << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << llendl; | ||
407 | return 0; | ||
408 | } | ||
409 | psinfo_t proc_psinfo; | ||
410 | if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ | ||
411 | llwarns << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << llendl; | ||
412 | close(proc_fd); | ||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | close(proc_fd); | ||
417 | |||
418 | return((U64)proc_psinfo.pr_rssize * 1024); | ||
419 | } | ||
391 | #else | 420 | #else |
392 | 421 | ||
393 | U64 getCurrentRSS() | 422 | U64 getCurrentRSS() |