Home | History | Annotate | Download | only in bootstat

Lines Matching refs:string

32 #include <string>
64 // and is a proper string representation of an integer value, the converted
66 void RecordBootEventFromCommandLine(const std::string& event, const std::string& value_str) {
103 // Constructs a readable, printable string from the givencommand line
105 std::string GetCommandLine(int argc, char** argv) {
106 std::string cmd;
116 // std::string.
117 std::string GetProperty(const char* key) {
123 return std::string(&temp[0], len);
126 void SetProperty(const char* key, const std::string& val) {
137 // A mapping from boot reason string, as read from the ro.boot.bootreason
141 const std::map<std::string, int32_t> kBootReasonMap = {
292 // Converts a string value representing the reason the system booted to an
295 int32_t BootReasonStrToEnum(const std::string& boot_reason) {
310 const std::vector<const std::string> knownReasons = {
329 bool isStrongRebootReason(const std::string& r) {
341 bool isKernelRebootReason(const std::string& r) {
353 bool isKnownRebootReason(const std::string& r) {
364 bool isBluntRebootReason(const std::string& r) {
370 while ((pos = r.find(',', pos)) != std::string::npos) {
372 std::string next(r.substr(pos));
381 bool readPstoreConsole(std::string& console) {
388 // Implement a variant of std::string::rfind that is resilient to errors in
393 const std::string& console;
399 // A string comparison function, reports the number of errors discovered
409 size_t numError(size_t pos, const std::string& _r) const {
420 if (num > ((8 + kBitErrorRate) / kBitErrorRate)) return std::string::npos;
425 return std::string::npos;
432 explicit pstoreConsole(const std::string& console) : console(console) {}
434 explicit pstoreConsole(const std::string&& console) = delete;
435 explicit pstoreConsole(std::string&& console) = delete;
438 size_t rfind(const std::string& needle) const {
440 if (pos != std::string::npos) return pos;
442 // Check to make sure needle fits in console string.
444 if (needle.length() > pos) return std::string::npos;
448 if (numError(pos, needle) != std::string::npos) return pos;
452 return std::string::npos;
456 size_t find(const std::string& needle, size_t start = 0) const {
457 // Check to make sure needle fits in console string.
458 if (needle.length() > console.length()) return std::string::npos;
462 if (numError(pos, needle) != std::string::npos) return pos;
464 return std::string::npos;
470 bool correctForBer(std::string& reason, const std::string& needle) {
477 if (pos == std::string::npos) break;
488 bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
490 if (console.rfind("SysRq : Trigger a crash") != std::string::npos) {
496 std::string::npos) {
500 string::npos) {
507 bool addKernelPanicSubReason(const std::string& content, std::string& ret) {
512 // Converts a string value representing the reason the system booted to a
513 // string complying with Android system standard reason.
523 void transformReason(std::string& reason) {
533 // Scrub, Sanitize, Standardize and Enhance the boot reason string supplied.
534 std::string BootReasonStrToReason(const std::string& boot_reason) {
537 std::string ret(GetProperty(system_reboot_reason_property));
538 std::string reason(boot_reason);
549 std::vector<std::string> words(android::base::Split(reason, ",_-"));
551 std::string blunt;
572 static const std::vector<std::pair<const std::string, const std::string>> aliasReasons = {
583 // Either the primary or alias is found _somewhere_ in the reason string.
585 if (reason.find(s.first) != std::string::npos) {
589 if (s.second.size() && (reason.find(s.second) != std::string::npos)) {
598 if (reason.find("sec") != std::string::npos) {
605 std::string content;
613 std::string content;
618 if (console.rfind("reboot: Power down") != std::string::npos) {
628 if (pos != std::string::npos) {
630 std::string subReason(content.substr(pos, max_reason_length));
665 ((console.rfind("Power held for ") != std::string::npos) ||
666 (console.rfind("charger: [") != std::string::npos))) {
684 std::string digits;
685 if (pos != std::string::npos) {
747 if (pos != std::string::npos) {
817 std::string CalculateBootCompletePrefix() {
818 static const std::string kBuildDateKey = "build_date";
819 std::string boot_complete_prefix = "boot_complete";
821 std::string build_date_str = GetProperty("ro.build.date.utc");
824 return std::string();
846 std::string value = GetProperty(property);
855 typedef std::map<std::string, int32_t> BootloaderTimingMap;
864 std::string value = GetProperty("ro.boot.boottime");
876 std::string stageName = stageTimingValues[0];
937 const std::string reason(GetProperty(bootloader_reboot_reason_property));
947 const std::string system_reason(GetProperty(system_reboot_reason_property));
955 const std::string bootloader_boot_reason(GetProperty(bootloader_reboot_reason_property));
956 const std::string system_boot_reason(BootReasonStrToReason(bootloader_boot_reason));
997 std::string boot_complete_prefix = CalculateBootCompletePrefix();
1045 const std::string reason(GetProperty(bootloader_reboot_reason_property));
1063 const std::string system_reason(GetProperty(system_reboot_reason_property));
1127 const std::string cmd_line = GetCommandLine(argc, argv);
1151 std::string boot_event;
1152 std::string value;
1158 const std::string option_name = long_options[option_index].name;