summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llsdserialize_xml.cpp35
-rw-r--r--indra/llcommon/llsys.cpp92
-rwxr-xr-xindra/llcommon/llversionviewer.h2
3 files changed, 106 insertions, 23 deletions
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index c5a7c6fc15..bf216d41bf 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -354,6 +354,7 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize)
return count;
}
+LLFastTimer::DeclareTimer FTM_SD_PARSE_READ_STREAM("LLSD Read Stream");
S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)
{
XML_Status status;
@@ -373,10 +374,13 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)
{
break;
}
- count = get_till_eol(input, (char *)buffer, BUFFER_SIZE);
- if (!count)
- {
- break;
+ { LLFastTimer _(FTM_SD_PARSE_READ_STREAM);
+
+ count = get_till_eol(input, (char *)buffer, BUFFER_SIZE);
+ if (!count)
+ {
+ break;
+ }
}
status = XML_ParseBuffer(mParser, count, false);
@@ -716,6 +720,7 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
case ELEMENT_INTEGER:
{
S32 i;
+ // sscanf okay here with different locales - ints don't change for different locale settings like floats do.
if ( sscanf(mCurrentContent.c_str(), "%d", &i ) == 1 )
{ // See if sscanf works - it's faster
value = i;
@@ -729,15 +734,19 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
case ELEMENT_REAL:
{
- F64 r;
- if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 )
- { // See if sscanf works - it's faster
- value = r;
- }
- else
- {
- value = LLSD(mCurrentContent).asReal();
- }
+ value = LLSD(mCurrentContent).asReal();
+ // removed since this breaks when locale has decimal separator that isn't '.'
+ // investigated changing local to something compatible each time but deemed higher
+ // risk that just using LLSD.asReal() each time.
+ //F64 r;
+ //if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 )
+ //{ // See if sscanf works - it's faster
+ // value = r;
+ //}
+ //else
+ //{
+ // value = LLSD(mCurrentContent).asReal();
+ //}
}
break;
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 8807bf1bf8..d781687175 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -68,9 +68,11 @@ using namespace llsd;
# include <sys/utsname.h>
# include <stdint.h>
# include <Carbon/Carbon.h>
-# include <sys/wait.h>
-# include <string.h>
# include <stdexcept>
+# include <mach/host_info.h>
+# include <mach/mach_host.h>
+# include <mach/task.h>
+# include <mach/task_info.h>
#elif LL_LINUX
# include <errno.h>
# include <sys/utsname.h>
@@ -990,17 +992,89 @@ LLSD LLMemoryInfo::loadStatsMap()
stats.add("PrivateUsage KB", pmem.PrivateUsage/1024);
#elif LL_DARWIN
- uint64_t phys = 0;
- size_t len = sizeof(phys);
+ const vm_size_t pagekb(vm_page_size / 1024);
+
+ //
+ // Collect the vm_stat's
+ //
- if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0)
{
- stats.add("Total Physical KB", phys/1024);
- }
- else
+ vm_statistics_data_t vmstat;
+ mach_msg_type_number_t vmstatCount = HOST_VM_INFO_COUNT;
+
+ if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t) &vmstat, &vmstatCount) != KERN_SUCCESS)
{
- LL_WARNS("LLMemoryInfo") << "Unable to collect hw.memsize memory information" << LL_ENDL;
+ LL_WARNS("LLMemoryInfo") << "Unable to collect memory information" << LL_ENDL;
+ }
+ else
+ {
+ stats.add("Pages free KB", pagekb * vmstat.free_count);
+ stats.add("Pages active KB", pagekb * vmstat.active_count);
+ stats.add("Pages inactive KB", pagekb * vmstat.inactive_count);
+ stats.add("Pages wired KB", pagekb * vmstat.wire_count);
+
+ stats.add("Pages zero fill", vmstat.zero_fill_count);
+ stats.add("Page reactivations", vmstat.reactivations);
+ stats.add("Page-ins", vmstat.pageins);
+ stats.add("Page-outs", vmstat.pageouts);
+
+ stats.add("Faults", vmstat.faults);
+ stats.add("Faults copy-on-write", vmstat.cow_faults);
+
+ stats.add("Cache lookups", vmstat.lookups);
+ stats.add("Cache hits", vmstat.hits);
+
+ stats.add("Page purgeable count", vmstat.purgeable_count);
+ stats.add("Page purges", vmstat.purges);
+
+ stats.add("Page speculative reads", vmstat.speculative_count);
+ }
+ }
+
+ //
+ // Collect the misc task info
+ //
+
+ {
+ task_events_info_data_t taskinfo;
+ unsigned taskinfoSize = sizeof(taskinfo);
+
+ if (task_info(mach_task_self(), TASK_EVENTS_INFO, (task_info_t) &taskinfo, &taskinfoSize) != KERN_SUCCESS)
+ {
+ LL_WARNS("LLMemoryInfo") << "Unable to collect task information" << LL_ENDL;
+ }
+ else
+ {
+ stats.add("Task page-ins", taskinfo.pageins);
+ stats.add("Task copy-on-write faults", taskinfo.cow_faults);
+ stats.add("Task messages sent", taskinfo.messages_sent);
+ stats.add("Task messages received", taskinfo.messages_received);
+ stats.add("Task mach system call count", taskinfo.syscalls_mach);
+ stats.add("Task unix system call count", taskinfo.syscalls_unix);
+ stats.add("Task context switch count", taskinfo.csw);
+ }
+ }
+
+ //
+ // Collect the basic task info
+ //
+
+ {
+ task_basic_info_64_data_t taskinfo;
+ unsigned taskinfoSize = sizeof(taskinfo);
+
+ if (task_info(mach_task_self(), TASK_BASIC_INFO_64, (task_info_t) &taskinfo, &taskinfoSize) != KERN_SUCCESS)
+ {
+ LL_WARNS("LLMemoryInfo") << "Unable to collect task information" << LL_ENDL;
+ }
+ else
+ {
+ stats.add("Basic suspend count", taskinfo.suspend_count);
+ stats.add("Basic virtual memory KB", taskinfo.virtual_size / 1024);
+ stats.add("Basic resident memory KB", taskinfo.resident_size / 1024);
+ stats.add("Basic new thread policy", taskinfo.policy);
+ }
}
#elif LL_SOLARIS
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 7e4bad9ee3..fa2b3bff36 100755
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -29,7 +29,7 @@
const S32 LL_VERSION_MAJOR = 3;
const S32 LL_VERSION_MINOR = 0;
-const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Developer";