OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/metrics_log.h" | 5 #include "components/metrics/metrics_log.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // Reduce granularity of the enabled_date field to nearest hour. | 344 // Reduce granularity of the enabled_date field to nearest hour. |
345 system_profile->set_uma_enabled_date(RoundSecondsToHour(enabled_date)); | 345 system_profile->set_uma_enabled_date(RoundSecondsToHour(enabled_date)); |
346 | 346 |
347 // Reduce granularity of the install_date field to nearest hour. | 347 // Reduce granularity of the install_date field to nearest hour. |
348 system_profile->set_install_date(RoundSecondsToHour(install_date)); | 348 system_profile->set_install_date(RoundSecondsToHour(install_date)); |
349 | 349 |
350 system_profile->set_application_locale(client_->GetApplicationLocale()); | 350 system_profile->set_application_locale(client_->GetApplicationLocale()); |
351 | 351 |
352 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 352 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
353 | 353 |
354 // By default, the hardware class is empty (i.e., unknown). | 354 // HardwareModelName() will return an empty string on platforms where it's |
355 hardware->set_hardware_class(std::string()); | 355 // not implemented or if an error occured. |
| 356 hardware->set_hardware_class(base::SysInfo::HardwareModelName()); |
356 | 357 |
357 hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); | 358 hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); |
358 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); | 359 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); |
359 #if defined(OS_WIN) | 360 #if defined(OS_WIN) |
360 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); | 361 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); |
361 #endif | 362 #endif |
362 | 363 |
363 SystemProfileProto::OS* os = system_profile->mutable_os(); | 364 SystemProfileProto::OS* os = system_profile->mutable_os(); |
364 std::string os_name = base::SysInfo::OperatingSystemName(); | 365 std::string os_name = base::SysInfo::OperatingSystemName(); |
365 #if defined(OS_WIN) | 366 #if defined(OS_WIN) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 DCHECK(!closed_); | 427 DCHECK(!closed_); |
427 closed_ = true; | 428 closed_ = true; |
428 } | 429 } |
429 | 430 |
430 void MetricsLog::GetEncodedLog(std::string* encoded_log) { | 431 void MetricsLog::GetEncodedLog(std::string* encoded_log) { |
431 DCHECK(closed_); | 432 DCHECK(closed_); |
432 uma_proto_.SerializeToString(encoded_log); | 433 uma_proto_.SerializeToString(encoded_log); |
433 } | 434 } |
434 | 435 |
435 } // namespace metrics | 436 } // namespace metrics |
OLD | NEW |