Renamed syscall_parameters_info structure to extended_syscall_info (and

kSyscallParametersInfos to kExtendedSyscallInfos) and added "name"
field. Now the classes for syscall kernel tracing don't need to lookup
the syscall function symbol anymore, which speeds up printing/filtering
of those entries dramatically.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23687 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-01-21 15:29:00 +00:00
parent a54c125e37
commit b4f58d8758
3 changed files with 16 additions and 26 deletions
+4 -3
View File
@@ -24,15 +24,16 @@ typedef struct syscall_parameter_info {
type_code type; type_code type;
} syscall_parameter_info; } syscall_parameter_info;
typedef struct syscall_parameters_info { typedef struct extended_syscall_info {
const char* name;
int parameter_count; int parameter_count;
syscall_parameter_info parameters[MAX_SYSCALL_PARAMETERS]; syscall_parameter_info parameters[MAX_SYSCALL_PARAMETERS];
} syscall_parameters_info; } extended_syscall_info;
extern const int kSyscallCount; extern const int kSyscallCount;
extern const syscall_info kSyscallInfos[]; extern const syscall_info kSyscallInfos[];
extern const syscall_parameters_info kSyscallParametersInfos[]; extern const extended_syscall_info kExtendedSyscallInfos[];
#ifdef __cplusplus #ifdef __cplusplus
+9 -21
View File
@@ -305,22 +305,10 @@ namespace SyscallTracing {
static const char* static const char*
get_syscall_name(uint32 syscall) get_syscall_name(uint32 syscall)
{ {
addr_t baseAddress;
const char* symbolName;
const char* imageName;
bool exactMatch;
if (syscall >= (uint32)kSyscallCount) if (syscall >= (uint32)kSyscallCount)
return "<invalid syscall number>"; return "<invalid syscall number>";
if (elf_debug_lookup_symbol_address( return kExtendedSyscallInfos[syscall].name;
(addr_t)kSyscallInfos[syscall].function,
&baseAddress, &symbolName, &imageName,
&exactMatch) != B_OK) {
return "<lookup failed>";
}
return symbolName;
} }
@@ -338,11 +326,11 @@ class PreSyscall : public AbstractTraceEntry {
// copy string parameters, if any // copy string parameters, if any
if (fParameters != NULL) { if (fParameters != NULL) {
int32 stringIndex = 0; int32 stringIndex = 0;
const syscall_parameters_info& paramsInfo const extended_syscall_info& syscallInfo
= kSyscallParametersInfos[fSyscall]; = kExtendedSyscallInfos[fSyscall];
for (int i = 0; i < paramsInfo.parameter_count; i++) { for (int i = 0; i < syscallInfo.parameter_count; i++) {
const syscall_parameter_info& paramInfo const syscall_parameter_info& paramInfo
= paramsInfo.parameters[i]; = syscallInfo.parameters[i];
if (paramInfo.type != B_STRING_TYPE) if (paramInfo.type != B_STRING_TYPE)
continue; continue;
@@ -366,11 +354,11 @@ class PreSyscall : public AbstractTraceEntry {
if (fParameters != NULL) { if (fParameters != NULL) {
int32 stringIndex = 0; int32 stringIndex = 0;
const syscall_parameters_info& paramsInfo const extended_syscall_info& syscallInfo
= kSyscallParametersInfos[fSyscall]; = kExtendedSyscallInfos[fSyscall];
for (int i = 0; i < paramsInfo.parameter_count; i++) { for (int i = 0; i < syscallInfo.parameter_count; i++) {
const syscall_parameter_info& paramInfo const syscall_parameter_info& paramInfo
= paramsInfo.parameters[i]; = syscallInfo.parameters[i];
const uint8* data = (uint8*)fParameters + paramInfo.offset; const uint8* data = (uint8*)fParameters + paramInfo.offset;
uint64 value = 0; uint64 value = 0;
bool printValue = true; bool printValue = true;
+3 -2
View File
@@ -408,7 +408,7 @@ public:
file << endl; file << endl;
// syscall parameters infos array preamble // syscall parameters infos array preamble
file << "const syscall_parameters_info kSyscallParametersInfos[] = {" file << "const extended_syscall_info kExtendedSyscallInfos[] = {"
<< endl; << endl;
// the syscall parameters infos // the syscall parameters infos
@@ -417,7 +417,8 @@ public:
int paramCount = syscall->CountParameters(); int paramCount = syscall->CountParameters();
file << "\t{" << endl; file << "\t{" << endl;
file << "\t\t" << paramCount << "," << endl; file << "\t\t\"" << syscall->Name() << "\", " << paramCount << ","
<< endl;
file << "\t\t{" << endl; file << "\t\t{" << endl;
for (int k = 0; k < paramCount; k++) { for (int k = 0; k < paramCount; k++) {