本文整理汇总了C++中LogEntry::read方法的典型用法代码示例。如果您正苦于以下问题:C++ LogEntry::read方法的具体用法?C++ LogEntry::read怎么用?C++ LogEntry::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogEntry
的用法示例。
在下文中一共展示了LogEntry::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
bool bVeryVerbose = false;
bool bVerbose = false;
bool bFences = false;
bool bBufferManager = false;
bool bQueue = false;
// process arguments
int argIndex = 1;
while (argIndex < argc) {
if (strcmp(argv[argIndex], "-h") == 0) {
printHelp();
return 0;
}
if (strcmp(argv[argIndex], "-v") == 0) {
bVerbose = true;
printf("bVerbose = %d\n", bVerbose);
}
if (strcmp(argv[argIndex], "-vv") == 0) {
bVeryVerbose = true;
printf("bVeryVerbose = %d\n", bVeryVerbose);
}
if (strcmp(argv[argIndex], "-f") == 0) {
bFences = true;
printf("bFences = %d\n", bFences);
}
if (strcmp(argv[argIndex], "-b") == 0) {
bBufferManager = true;
printf("bBufferManager = %d\n", bBufferManager);
}
if (strcmp(argv[argIndex], "-q") == 0) {
bQueue = true;
printf("bQueue = %d\n", bQueue);
}
argIndex++;
}
while (1) {
// Find and connect to HWC service
sp<IService> hwcService = interface_cast<IService>(
defaultServiceManager()->getService(String16(IA_HWC_SERVICE_NAME)));
if (hwcService == NULL) {
usleep(TENTH_SECOND);
continue;
}
sp<IDiagnostic> pDiagnostic = hwcService->GetDiagnostic();
if (pDiagnostic == NULL) {
usleep(TENTH_SECOND);
continue;
}
printf("Connected to service %s and obtained diagnostic interface\n\n",
IA_HWC_SERVICE_NAME);
while (1) {
LogEntry entry;
status_t ret = entry.read(pDiagnostic);
if (ret != OK) {
if (ret == IDiagnostic::eLogTruncated) {
printf("...\n");
} else if (ret == NOT_ENOUGH_DATA) {
fflush(stdout);
usleep(4000); // 4 ms sleep
continue;
} else {
printf("readLogEntry error, attempting to reconnect.\n\n");
break;
}
}
entry.print(bVeryVerbose, bVerbose, bFences, bBufferManager, bQueue);
}
}
return 0;
}