OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // We'll write the protobuf version in RecordEnvironmentProto(). | 663 // We'll write the protobuf version in RecordEnvironmentProto(). |
664 bool write_as_xml = true; | 664 bool write_as_xml = true; |
665 WritePluginList(plugin_list, write_as_xml); | 665 WritePluginList(plugin_list, write_as_xml); |
666 | 666 |
667 WriteStabilityElement(plugin_list, pref); | 667 WriteStabilityElement(plugin_list, pref); |
668 | 668 |
669 { | 669 { |
670 // Write the XML version. | 670 // Write the XML version. |
671 // We'll write the protobuf version in RecordEnvironmentProto(). | 671 // We'll write the protobuf version in RecordEnvironmentProto(). |
672 OPEN_ELEMENT_FOR_SCOPE("cpu"); | 672 OPEN_ELEMENT_FOR_SCOPE("cpu"); |
673 WriteAttribute("arch", base::SysInfo::CPUArchitecture()); | 673 WriteAttribute("arch", base::SysInfo::OperatingSystemArchitecture()); |
674 } | 674 } |
675 | 675 |
676 { | 676 { |
677 // Write the XML version. | 677 // Write the XML version. |
678 // We'll write the protobuf version in RecordEnvironmentProto(). | 678 // We'll write the protobuf version in RecordEnvironmentProto(). |
679 OPEN_ELEMENT_FOR_SCOPE("memory"); | 679 OPEN_ELEMENT_FOR_SCOPE("memory"); |
680 WriteIntAttribute("mb", base::SysInfo::AmountOfPhysicalMemoryMB()); | 680 WriteIntAttribute("mb", base::SysInfo::AmountOfPhysicalMemoryMB()); |
681 #if defined(OS_WIN) | 681 #if defined(OS_WIN) |
682 WriteIntAttribute("dllbase", reinterpret_cast<int>(&__ImageBase)); | 682 WriteIntAttribute("dllbase", reinterpret_cast<int>(&__ImageBase)); |
683 #endif | 683 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 int install_date; | 758 int install_date; |
759 bool success = base::StringToInt(GetInstallDate(GetPrefService()), | 759 bool success = base::StringToInt(GetInstallDate(GetPrefService()), |
760 &install_date); | 760 &install_date); |
761 DCHECK(success); | 761 DCHECK(success); |
762 system_profile->set_install_date(install_date); | 762 system_profile->set_install_date(install_date); |
763 | 763 |
764 system_profile->set_application_locale( | 764 system_profile->set_application_locale( |
765 content::GetContentClient()->browser()->GetApplicationLocale()); | 765 content::GetContentClient()->browser()->GetApplicationLocale()); |
766 | 766 |
767 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 767 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
768 hardware->set_cpu_architecture(base::SysInfo::CPUArchitecture()); | 768 hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); |
769 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); | 769 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); |
770 #if defined(OS_WIN) | 770 #if defined(OS_WIN) |
771 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); | 771 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); |
772 #endif | 772 #endif |
773 | 773 |
774 SystemProfileProto::OS* os = system_profile->mutable_os(); | 774 SystemProfileProto::OS* os = system_profile->mutable_os(); |
775 std::string os_name = base::SysInfo::OperatingSystemName(); | 775 std::string os_name = base::SysInfo::OperatingSystemName(); |
776 #if defined(OS_WIN) | 776 #if defined(OS_WIN) |
777 // TODO(mad): This only checks whether the main process is a Metro process at | 777 // TODO(mad): This only checks whether the main process is a Metro process at |
778 // upload time; not whether the collected metrics were all gathered from | 778 // upload time; not whether the collected metrics were all gathered from |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 859 } |
860 | 860 |
861 void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, | 861 void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, |
862 const DictionaryValue& profile_metrics) { | 862 const DictionaryValue& profile_metrics) { |
863 OPEN_ELEMENT_FOR_SCOPE("userprofile"); | 863 OPEN_ELEMENT_FOR_SCOPE("userprofile"); |
864 WriteAttribute("profileidhash", profileidhash); | 864 WriteAttribute("profileidhash", profileidhash); |
865 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); | 865 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); |
866 i != profile_metrics.end_keys(); ++i) { | 866 i != profile_metrics.end_keys(); ++i) { |
867 const Value* value; | 867 const Value* value; |
868 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { | 868 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { |
869 DCHECK(*i != "id"); | 869 DCHECK_NE(*i, "id"); |
870 switch (value->GetType()) { | 870 switch (value->GetType()) { |
871 case Value::TYPE_STRING: { | 871 case Value::TYPE_STRING: { |
872 std::string string_value; | 872 std::string string_value; |
873 if (value->GetAsString(&string_value)) { | 873 if (value->GetAsString(&string_value)) { |
874 OPEN_ELEMENT_FOR_SCOPE("profileparam"); | 874 OPEN_ELEMENT_FOR_SCOPE("profileparam"); |
875 WriteAttribute("name", *i); | 875 WriteAttribute("name", *i); |
876 WriteAttribute("value", string_value); | 876 WriteAttribute("value", string_value); |
877 } | 877 } |
878 break; | 878 break; |
879 } | 879 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 ProductDataToProto(google_update_metrics.google_update_data, | 1019 ProductDataToProto(google_update_metrics.google_update_data, |
1020 google_update->mutable_google_update_status()); | 1020 google_update->mutable_google_update_status()); |
1021 } | 1021 } |
1022 | 1022 |
1023 if (!google_update_metrics.product_data.version.empty()) { | 1023 if (!google_update_metrics.product_data.version.empty()) { |
1024 ProductDataToProto(google_update_metrics.product_data, | 1024 ProductDataToProto(google_update_metrics.product_data, |
1025 google_update->mutable_client_status()); | 1025 google_update->mutable_client_status()); |
1026 } | 1026 } |
1027 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1027 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
1028 } | 1028 } |
OLD | NEW |