mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-24 07:41:54 -07:00
Further simplify the eventcnv text output format.
Copied from Perforce Change: 180054 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
0e6cea6157
commit
ed914cd37f
3 changed files with 190 additions and 276 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* This is a command-line tool that converts a binary format telemetry output
|
||||
* stream from the MPS into several textual formats.
|
||||
* stream from the MPS into a textual format.
|
||||
*
|
||||
* The default MPS library will write a telemetry stream to a file called
|
||||
* "mpsio.log" when the environment variable MPS_TELEMETRY_CONTROL is set
|
||||
|
|
@ -22,20 +22,16 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "eventdef.h"
|
||||
#include "eventcom.h"
|
||||
#include "eventpro.h"
|
||||
#include "mpmtypes.h"
|
||||
#include "testlib.h" /* for ulongest_t and associated print formats */
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include <stdio.h> /* for printf */
|
||||
#include <stdarg.h> /* for va_list */
|
||||
#include <stdlib.h> /* for EXIT_FAILURE */
|
||||
#include <assert.h> /* for assert */
|
||||
#include <string.h> /* for strcmp */
|
||||
#include <math.h> /* for sqrt */
|
||||
#include "mpstd.h"
|
||||
|
||||
#ifdef MPS_BUILD_MV
|
||||
|
|
@ -44,20 +40,12 @@
|
|||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
|
||||
#define DEFAULT_TELEMETRY_FILENAME "mpsio.log"
|
||||
#define TELEMETRY_FILENAME_ENVAR "MPS_TELEMETRY_FILENAME"
|
||||
|
||||
static EventClock eventTime; /* current event time */
|
||||
static char *prog; /* program name */
|
||||
|
||||
|
||||
/* style: '\0' for human-readable, 'L' for Lisp, 'C' for CDF. */
|
||||
static char style = '\0';
|
||||
|
||||
|
||||
/* everror -- error signalling */
|
||||
|
||||
static void everror(const char *format, ...)
|
||||
|
|
@ -80,7 +68,7 @@ static void everror(const char *format, ...)
|
|||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-f logfile] [-S[LC]] [-h]\n"
|
||||
"Usage: %s [-f logfile] [-h]\n"
|
||||
"See \"Telemetry\" in the reference manual for instructions.\n",
|
||||
prog);
|
||||
}
|
||||
|
|
@ -99,7 +87,7 @@ static void usageError(void)
|
|||
|
||||
static char *parseArgs(int argc, char *argv[])
|
||||
{
|
||||
char *name = "mpsio.log";
|
||||
char *name = NULL;
|
||||
int i = 1;
|
||||
|
||||
if (argc >= 1)
|
||||
|
|
@ -117,9 +105,6 @@ static char *parseArgs(int argc, char *argv[])
|
|||
else
|
||||
name = argv[i];
|
||||
break;
|
||||
case 'S': /* style */
|
||||
style = argv[i][2]; /* '\0' for human-readable, 'L' for Lisp, */
|
||||
break; /* 'C' for CDF. */
|
||||
case '?': case 'h': /* help */
|
||||
usage();
|
||||
exit(EXIT_SUCCESS);
|
||||
|
|
@ -135,119 +120,39 @@ static char *parseArgs(int argc, char *argv[])
|
|||
|
||||
/* Printing routines */
|
||||
|
||||
static void printHex(ulongest_t val)
|
||||
{
|
||||
printf(" %"PRIXLONGEST, (ulongest_t)val);
|
||||
}
|
||||
|
||||
#define printParamP(p) printHex((ulongest_t)p)
|
||||
#define printParamA(a) printHex((ulongest_t)a)
|
||||
#define printParamU(u) printHex((ulongest_t)u)
|
||||
#define printParamW(w) printHex((ulongest_t)w)
|
||||
#define printParamB(b) printHex((ulongest_t)b)
|
||||
|
||||
/* printStr -- print an EventString */
|
||||
static void printParamD(double d)
|
||||
{
|
||||
printf(" %.10G", d);
|
||||
}
|
||||
|
||||
static void printStr(const char *str, Bool quotes)
|
||||
static void printParamS(const char *str)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (quotes) putchar('"');
|
||||
putchar(' ');
|
||||
putchar('"');
|
||||
for (i = 0; str[i] != '\0'; ++i) {
|
||||
char c = str[i];
|
||||
if (quotes && (c == '"' || c == '\\')) putchar('\\');
|
||||
if (c == '"' || c == '\\') putchar('\\');
|
||||
putchar(c);
|
||||
}
|
||||
if (quotes) putchar('"');
|
||||
putchar('"');
|
||||
}
|
||||
|
||||
|
||||
/* printAddr -- print an Addr or its label */
|
||||
|
||||
static void printAddr(EventProc proc, Addr addr)
|
||||
{
|
||||
UNUSED(proc);
|
||||
printf(style != 'C' ?
|
||||
" %0"PRIwWORD PRIXLONGEST :
|
||||
" %"PRIuLONGEST,
|
||||
(ulongest_t)addr);
|
||||
}
|
||||
|
||||
|
||||
/* printParam* -- printing functions for event parameter types */
|
||||
|
||||
static void printParamA(EventProc proc, char *styleConv, Addr addr)
|
||||
{
|
||||
if (style != 'L') {
|
||||
if (style == 'C') putchar(',');
|
||||
printAddr(proc, addr);
|
||||
} else
|
||||
printf(styleConv, (ulongest_t)addr);
|
||||
}
|
||||
|
||||
static void printParamP(EventProc proc, char *styleConv, void *p)
|
||||
{
|
||||
UNUSED(proc);
|
||||
printf(styleConv, (ulongest_t)p);
|
||||
}
|
||||
|
||||
static void printParamU(EventProc proc, char *styleConv, unsigned u)
|
||||
{
|
||||
UNUSED(proc);
|
||||
printf(styleConv, (ulongest_t)u);
|
||||
}
|
||||
|
||||
static void printParamW(EventProc proc, char *styleConv, Word w)
|
||||
{
|
||||
UNUSED(proc);
|
||||
printf(styleConv, (ulongest_t)w);
|
||||
}
|
||||
|
||||
static void printParamD(EventProc proc, char *styleConv, double d)
|
||||
{
|
||||
UNUSED(proc);
|
||||
UNUSED(styleConv);
|
||||
switch (style) {
|
||||
case '\0':
|
||||
printf(" %#8.3g", d); break;
|
||||
case 'C':
|
||||
printf(", %.10G", d); break;
|
||||
case 'L':
|
||||
printf(" %#.10G", d); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void printParamS(EventProc proc, char *styleConv, const char *s)
|
||||
{
|
||||
UNUSED(proc);
|
||||
UNUSED(styleConv);
|
||||
if (style == 'C') putchar(',');
|
||||
putchar(' ');
|
||||
printStr(s, (style == 'C' || style == 'L'));
|
||||
}
|
||||
|
||||
static void printParamB(EventProc proc, char *styleConv, Bool b)
|
||||
{
|
||||
UNUSED(proc);
|
||||
printf(styleConv, (ulongest_t)b);
|
||||
}
|
||||
|
||||
|
||||
/* readLog -- read and parse log
|
||||
*
|
||||
* This is the heart of eventcnv: It reads an event log using
|
||||
* EventRead. It updates the counters. It looks up the format,
|
||||
* parses the arguments, and prints a representation of the event.
|
||||
* Each argument is printed using printArg (see RELATION, below),
|
||||
* except for some event types that are handled specially.
|
||||
*/
|
||||
/* readLog -- read and parse log */
|
||||
|
||||
static void readLog(EventProc proc)
|
||||
{
|
||||
char *styleConv = NULL; /* suppress uninit warning */
|
||||
|
||||
/* Init style. */
|
||||
switch (style) {
|
||||
case '\0':
|
||||
styleConv = " %8"PRIXLONGEST; break;
|
||||
case 'C':
|
||||
styleConv = ", %"PRIuLONGEST; break;
|
||||
case 'L':
|
||||
styleConv = " %"PRIXLONGEST; break;
|
||||
default:
|
||||
everror("Unknown style code '%c'", style);
|
||||
}
|
||||
|
||||
while (TRUE) { /* loop for each event */
|
||||
Event event;
|
||||
EventCode code;
|
||||
|
|
@ -260,131 +165,25 @@ static void readLog(EventProc proc)
|
|||
eventTime = event->any.clock;
|
||||
code = event->any.code;
|
||||
|
||||
/* Output event. */
|
||||
{
|
||||
if (style == 'L') putchar('(');
|
||||
EVENT_CLOCK_PRINT(stdout, eventTime);
|
||||
printf(" %X", (unsigned)code);
|
||||
|
||||
switch (style) {
|
||||
case '\0': case 'L':
|
||||
EVENT_CLOCK_PRINT(stdout, eventTime);
|
||||
putchar(' ');
|
||||
break;
|
||||
case 'C':
|
||||
EVENT_CLOCK_PRINT(stdout, eventTime);
|
||||
fputs(", ", stdout);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (style) {
|
||||
case '\0': case 'L': {
|
||||
printf("%-19s ", EventCode2Name(code));
|
||||
} break;
|
||||
case 'C':
|
||||
printf("%u", (unsigned)code);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
|
||||
case EventLabelCode:
|
||||
switch (style) {
|
||||
case '\0':
|
||||
{
|
||||
const char *sym = LabelText(proc, event->Label.f1);
|
||||
printf(style == '\0' ?
|
||||
" %08"PRIXLONGEST" " :
|
||||
", %"PRIuLONGEST", ",
|
||||
(ulongest_t)event->Label.f0);
|
||||
if (sym != NULL) {
|
||||
printStr(sym, 0);
|
||||
} else {
|
||||
printf("sym %05"PRIXLONGEST ,
|
||||
(ulongest_t)event->Label.f1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
printf(" %"PRIXLONGEST" %"PRIXLONGEST,
|
||||
(ulongest_t)event->Label.f0,
|
||||
(ulongest_t)event->Label.f1);
|
||||
break;
|
||||
case 'C':
|
||||
printf(", %"PRIuLONGEST", %"PRIuLONGEST,
|
||||
(ulongest_t)event->Label.f0,
|
||||
(ulongest_t)event->Label.f1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventMeterValuesCode:
|
||||
switch (style) {
|
||||
case '\0':
|
||||
if (event->MeterValues.f3 == 0) {
|
||||
printf(" %08"PRIXLONGEST" 0 N/A N/A N/A N/A",
|
||||
(ulongest_t)event->MeterValues.f0);
|
||||
} else {
|
||||
double mean = event->MeterValues.f1 / (double)event->MeterValues.f3;
|
||||
/* .stddev: stddev = sqrt(meanSquared - mean^2), but see */
|
||||
/* <code/meter.c#limitation.variance>. */
|
||||
double stddev = sqrt(fabs(event->MeterValues.f2
|
||||
- (mean * mean)));
|
||||
printf(" %08"PRIXLONGEST" %8u %8u %8u %#8.3g %#8.3g",
|
||||
(ulongest_t)event->MeterValues.f0, (uint)event->MeterValues.f3,
|
||||
(uint)event->MeterValues.f4, (uint)event->MeterValues.f5,
|
||||
mean, stddev);
|
||||
}
|
||||
printAddr(proc, (Addr)event->MeterValues.f0);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
putchar(',');
|
||||
printAddr(proc, (Addr)event->MeterValues.f0);
|
||||
printf(", %.10G, %.10G, %u, %u, %u",
|
||||
event->MeterValues.f1, event->MeterValues.f2,
|
||||
(uint)event->MeterValues.f3, (uint)event->MeterValues.f4,
|
||||
(uint)event->MeterValues.f5);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
printf(" %"PRIXLONGEST" %#.10G %#.10G %X %X %X",
|
||||
(ulongest_t)event->MeterValues.f0,
|
||||
event->MeterValues.f1, event->MeterValues.f2,
|
||||
(uint)event->MeterValues.f3, (uint)event->MeterValues.f4,
|
||||
(uint)event->MeterValues.f5);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventPoolInitCode: /* pool, arena, class */
|
||||
printf(styleConv, (ulongest_t)event->PoolInit.f0);
|
||||
printf(styleConv, (ulongest_t)event->PoolInit.f1);
|
||||
/* class is a Pointer, but we label them, so call printAddr */
|
||||
if (style != 'L') {
|
||||
if (style == 'C') putchar(',');
|
||||
printAddr(proc, (Addr)event->PoolInit.f2);
|
||||
} else
|
||||
printf(styleConv, (ulongest_t)event->PoolInit.f2);
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (code) {
|
||||
#define EVENT_PARAM_PRINT(name, index, sort, ident) \
|
||||
printParam##sort(proc, styleConv, event->name.f##index);
|
||||
printParam##sort(event->name.f##index);
|
||||
#define EVENT_PRINT(X, name, code, always, kind) \
|
||||
case code: \
|
||||
EVENT_##name##_PARAMS(EVENT_PARAM_PRINT, name) \
|
||||
break;
|
||||
switch (code) { EVENT_LIST(EVENT_PRINT, X) }
|
||||
}
|
||||
|
||||
if (style == 'L') putchar(')');
|
||||
putchar('\n');
|
||||
fflush(stdout);
|
||||
EVENT_LIST(EVENT_PRINT, X)
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
fflush(stdout);
|
||||
EventDestroy(proc, event);
|
||||
} /* while(!feof(input)) */
|
||||
}
|
||||
|
||||
|
||||
/* logReader -- reader function for a file log */
|
||||
|
||||
static FILE *input;
|
||||
|
|
@ -416,9 +215,14 @@ int main(int argc, char *argv[])
|
|||
assert(CHECKCONV(ulongest_t, Addr));
|
||||
assert(CHECKCONV(ulongest_t, void *));
|
||||
assert(CHECKCONV(ulongest_t, EventCode));
|
||||
assert(CHECKCONV(Addr, void *)); /* for labelled pointers */
|
||||
|
||||
filename = parseArgs(argc, argv);
|
||||
if (!filename) {
|
||||
filename = getenv(TELEMETRY_FILENAME_ENVAR
|
||||
);
|
||||
if(!filename)
|
||||
filename = DEFAULT_TELEMETRY_FILENAME;
|
||||
}
|
||||
|
||||
if (strcmp(filename, "-") == 0)
|
||||
input = stdin;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@
|
|||
#define DATABASE_NAME_ENVAR "MPS_EVENT_DATABASE"
|
||||
#define DEFAULT_DATABASE_NAME "mpsevent.db"
|
||||
|
||||
typedef sqlite3_int64 int64;
|
||||
|
||||
/* we output rows of dots. One dot per SMALL_TICK events,
|
||||
* BIG_TICK dots per row. */
|
||||
|
||||
|
|
@ -136,8 +138,8 @@ static void error(const char *format, ...)
|
|||
|
||||
static void sqlite_error(int res, sqlite3 *db, const char *format, ...)
|
||||
{
|
||||
log(LOG_ALWAYS, "Fatal SQL error %d", res);
|
||||
va_list args;
|
||||
log(LOG_ALWAYS, "Fatal SQL error %d", res);
|
||||
va_start(args, format);
|
||||
vlog(LOG_ALWAYS, format, args);
|
||||
va_end(args);
|
||||
|
|
@ -335,7 +337,7 @@ static struct {
|
|||
|
||||
static void testTableExists(sqlite3 *db)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
int defects = 0;
|
||||
int tests = 0;
|
||||
for (i=0; i < (sizeof(tableTests)/sizeof(tableTests[0])); ++i) {
|
||||
|
|
@ -366,7 +368,7 @@ static void testTableExists(sqlite3 *db)
|
|||
* assume that the user is smart enough not to do that.
|
||||
*/
|
||||
|
||||
static unsigned long logSerial = 0;
|
||||
static int64 logSerial = 0;
|
||||
|
||||
static void registerLogFile(sqlite3 *db,
|
||||
const char *filename)
|
||||
|
|
@ -374,9 +376,9 @@ static void registerLogFile(sqlite3 *db,
|
|||
sqlite3_stmt *statement;
|
||||
int res;
|
||||
const unsigned char *name;
|
||||
unsigned long completed;
|
||||
unsigned long long file_size;
|
||||
unsigned long long file_modtime;
|
||||
int64 completed;
|
||||
int64 file_size;
|
||||
int64 file_modtime;
|
||||
|
||||
if (filename) {
|
||||
struct stat st;
|
||||
|
|
@ -402,8 +404,8 @@ static void registerLogFile(sqlite3 *db,
|
|||
break;
|
||||
case SQLITE_ROW:
|
||||
name = sqlite3_column_text(statement, 0);
|
||||
logSerial = sqlite3_column_int(statement, 1);
|
||||
completed = sqlite3_column_int(statement, 2);
|
||||
logSerial = sqlite3_column_int64(statement, 1);
|
||||
completed = sqlite3_column_int64(statement, 2);
|
||||
log(force ? LOG_OFTEN : LOG_ALWAYS, "Log file matching '%s' already in event_log, named \"%s\" (serial %lu, completed %lu).",
|
||||
filename, name, logSerial, completed);
|
||||
if (force) {
|
||||
|
|
@ -444,7 +446,7 @@ static void registerLogFile(sqlite3 *db,
|
|||
}
|
||||
|
||||
static void logFileCompleted(sqlite3 *db,
|
||||
unsigned long completed)
|
||||
int64 completed)
|
||||
{
|
||||
sqlite3_stmt *statement;
|
||||
int res;
|
||||
|
|
@ -515,7 +517,7 @@ EVENT_LIST(EVENT_TABLE_CREATE, X)
|
|||
|
||||
static void makeTables(sqlite3 *db)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
log(LOG_SOMETIMES, "Creating tables.");
|
||||
|
||||
for (i=0; i < (sizeof(createStatements)/sizeof(createStatements[0])); ++i) {
|
||||
|
|
@ -531,7 +533,7 @@ const char *glueTables[] = {
|
|||
|
||||
static void dropGlueTables(sqlite3 *db)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
int res;
|
||||
char sql[1024];
|
||||
|
||||
|
|
@ -689,18 +691,16 @@ static void fillGlueTables(sqlite3 *db)
|
|||
EVENT_##name##_PARAMS(EVENT_PARAM_BIND, X) \
|
||||
break;
|
||||
|
||||
static char *bind_int(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count, int index, char *p)
|
||||
static char *bind_int(sqlite3 *db, sqlite3_stmt *stmt, int64 count, int index, char *p)
|
||||
{
|
||||
char *q;
|
||||
long long val;
|
||||
int res;
|
||||
|
||||
if ((p[0] != ',') || (p[1] != ' '))
|
||||
error("event %llu field %d not preceded by \", \": %s",
|
||||
count, index, p);
|
||||
while(*p == ' ')
|
||||
++p;
|
||||
|
||||
p += 2;
|
||||
val = strtoll(p, &q, 0);
|
||||
val = strtoll(p, &q, 16);
|
||||
if (q == p)
|
||||
error("event %llu field %d not an integer: %s",
|
||||
count, index, p);
|
||||
|
|
@ -711,17 +711,15 @@ static char *bind_int(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count,
|
|||
return q;
|
||||
}
|
||||
|
||||
static char *bind_real(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count, int index, char *p)
|
||||
static char *bind_real(sqlite3 *db, sqlite3_stmt *stmt, int64 count, int index, char *p)
|
||||
{
|
||||
char *q;
|
||||
double val;
|
||||
int res;
|
||||
|
||||
if ((p[0] != ',') || (p[1] != ' '))
|
||||
error("event %llu field %d not preceded by \", \": %s",
|
||||
count, index, p);
|
||||
while(*p == ' ')
|
||||
++p;
|
||||
|
||||
p += 2;
|
||||
val = strtod(p, &q);
|
||||
if (q == p)
|
||||
error("event %llu field %d not a floating-point value: %s",
|
||||
|
|
@ -733,16 +731,14 @@ static char *bind_real(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count
|
|||
return q;
|
||||
}
|
||||
|
||||
static char *bind_text(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count, int index, char *p)
|
||||
static char *bind_text(sqlite3 *db, sqlite3_stmt *stmt, int64 count, int index, char *p)
|
||||
{
|
||||
char *q;
|
||||
int res;
|
||||
|
||||
if ((p[0] != ',') || (p[1] != ' ') || (p[2] != '"'))
|
||||
error("event %llu string field %d not preceded by \", \\\"\": %s",
|
||||
count, index, p);
|
||||
while(*p == ' ')
|
||||
++p;
|
||||
|
||||
p += 3;
|
||||
q = p;
|
||||
while((*q != '\n') && (*q != '\0')) {
|
||||
++ q;
|
||||
|
|
@ -751,7 +747,7 @@ static char *bind_text(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count
|
|||
error("event %llu string field %d has no closing quote mark.",
|
||||
count, index);
|
||||
|
||||
res = sqlite3_bind_text(stmt, index, p, q-p-1, SQLITE_STATIC);
|
||||
res = sqlite3_bind_text(stmt, index, p, (int)(q-p-1), SQLITE_STATIC);
|
||||
if (res != SQLITE_OK)
|
||||
sqlite_error(res, db, "event %llu field %d bind failed", count, index);
|
||||
return q;
|
||||
|
|
@ -760,10 +756,10 @@ static char *bind_text(sqlite3 *db, sqlite3_stmt *stmt, unsigned long long count
|
|||
/* readLog -- read and parse log. Returns the number of events written.
|
||||
*/
|
||||
|
||||
static unsigned long long readLog(FILE *input,
|
||||
sqlite3 *db)
|
||||
static int64 readLog(FILE *input,
|
||||
sqlite3 *db)
|
||||
{
|
||||
unsigned long long eventCount = 0;
|
||||
int64 eventCount = 0;
|
||||
|
||||
/* declare statements for every event type */
|
||||
EVENT_LIST(EVENT_TYPE_DECLARE_STATEMENT, X);
|
||||
|
|
@ -780,8 +776,8 @@ static unsigned long long readLog(FILE *input,
|
|||
int last_index=0;
|
||||
sqlite3_stmt *statement;
|
||||
int res;
|
||||
unsigned long long clock;
|
||||
int code;
|
||||
int64 clock;
|
||||
long code;
|
||||
|
||||
p = fgets(line, 1024, input);
|
||||
if (!p) {
|
||||
|
|
@ -798,13 +794,14 @@ static unsigned long long readLog(FILE *input,
|
|||
error("event %llu clock field not a hex integer: %s",
|
||||
eventCount, p);
|
||||
|
||||
if ((q[0] != ',') || (q[1] != ' '))
|
||||
error("event %llu code field not preceded by \", \": %s",
|
||||
if (*q != ' ')
|
||||
error("event %llu code field not preceded by ' ': %s",
|
||||
eventCount, q);
|
||||
while(*q == ' ')
|
||||
++q;
|
||||
|
||||
p = q + 2;
|
||||
|
||||
code = strtol(p, &q, 0);
|
||||
p = q;
|
||||
code = strtol(p, &q, 16);
|
||||
if (q == p)
|
||||
error("event %llu code field %d not an integer: %s",
|
||||
eventCount, index, p);
|
||||
|
|
@ -874,10 +871,10 @@ static FILE *openLog(sqlite3 *db)
|
|||
return input;
|
||||
}
|
||||
|
||||
static unsigned long long writeEventsToSQL(sqlite3 *db)
|
||||
static int64 writeEventsToSQL(sqlite3 *db)
|
||||
{
|
||||
FILE *input;
|
||||
unsigned long long count;
|
||||
int64 count;
|
||||
input = openLog(db);
|
||||
count = readLog(input, db);
|
||||
(void)fclose(input);
|
||||
|
|
@ -888,7 +885,7 @@ static unsigned long long writeEventsToSQL(sqlite3 *db)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
sqlite3 *db;
|
||||
unsigned long long count;
|
||||
int64 count;
|
||||
|
||||
parseArgs(argc, argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
buildPhases = (
|
||||
);
|
||||
dependencies = (
|
||||
2D07B9791636FCBD00DB751B /* PBXTargetDependency */,
|
||||
3104AFF6156D37BC000A585A /* PBXTargetDependency */,
|
||||
3114A6D5156E9839001E0AA3 /* PBXTargetDependency */,
|
||||
3114A6B9156E9763001E0AA3 /* PBXTargetDependency */,
|
||||
|
|
@ -51,6 +52,8 @@
|
|||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2D07B97A1636FCCE00DB751B /* eventsql.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D07B96C1636FC7200DB751B /* eventsql.c */; };
|
||||
2D07B97C163705E400DB751B /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D07B97B163705E400DB751B /* libsqlite3.dylib */; };
|
||||
3104AFBF156D3591000A585A /* apss.c in Sources */ = {isa = PBXBuildFile; fileRef = 3104AFBE156D3591000A585A /* apss.c */; };
|
||||
3104AFC2156D35B2000A585A /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||
3104AFC3156D35C3000A585A /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
||||
|
|
@ -196,6 +199,13 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
2D07B9781636FCBD00DB751B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 2D07B9701636FC9900DB751B;
|
||||
remoteInfo = eventsql;
|
||||
};
|
||||
3104AFC0156D35AE000A585A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||
|
|
@ -626,6 +636,15 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
2D07B96F1636FC9900DB751B /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
3104AFB1156D357B000A585A /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -899,6 +918,9 @@
|
|||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2D07B96C1636FC7200DB751B /* eventsql.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = eventsql.c; sourceTree = "<group>"; };
|
||||
2D07B9711636FC9900DB751B /* eventsql */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = eventsql; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2D07B97B163705E400DB751B /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
|
||||
3104AFA5156D27E7000A585A /* ssixi6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssixi6.c; sourceTree = "<group>"; };
|
||||
3104AFB3156D357B000A585A /* apss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = apss; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3104AFBE156D3591000A585A /* apss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = apss.c; sourceTree = "<group>"; };
|
||||
|
|
@ -1026,6 +1048,14 @@
|
|||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
2D07B96E1636FC9900DB751B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2D07B97C163705E400DB751B /* libsqlite3.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3104AFB0156D357B000A585A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -1276,6 +1306,21 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
2D07B96A1636FC4C00DB751B /* eventsql */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2D07B96C1636FC7200DB751B /* eventsql.c */,
|
||||
);
|
||||
name = eventsql;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2D07B9731636FC9900DB751B /* eventsql */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = eventsql;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3114A647156E956C001E0AA3 /* Mysterious */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -1288,6 +1333,7 @@
|
|||
3114A6D6156E9846001E0AA3 /* Tools */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2D07B96A1636FC4C00DB751B /* eventsql */,
|
||||
3114A6D8156E9942001E0AA3 /* eventcnv */,
|
||||
);
|
||||
name = Tools;
|
||||
|
|
@ -1374,10 +1420,12 @@
|
|||
31EEABD8156AAE9E00714D05 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2D07B97B163705E400DB751B /* libsqlite3.dylib */,
|
||||
3114A6D6156E9846001E0AA3 /* Tools */,
|
||||
3114A647156E956C001E0AA3 /* Mysterious */,
|
||||
31A47BA8156C1E930039B1C2 /* MPS */,
|
||||
3124CAB3156BE1B700753214 /* Tests */,
|
||||
2D07B9731636FC9900DB751B /* eventsql */,
|
||||
31EEABEF156AAF5C00714D05 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1416,6 +1464,7 @@
|
|||
3114A695156E971B001E0AA3 /* messtest */,
|
||||
3114A6AC156E9759001E0AA3 /* walkt0 */,
|
||||
3114A6C6156E9815001E0AA3 /* eventcnv */,
|
||||
2D07B9711636FC9900DB751B /* eventsql */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1515,6 +1564,23 @@
|
|||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
2D07B9701636FC9900DB751B /* eventsql */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2D07B9741636FC9900DB751B /* Build configuration list for PBXNativeTarget "eventsql" */;
|
||||
buildPhases = (
|
||||
2D07B96D1636FC9900DB751B /* Sources */,
|
||||
2D07B96E1636FC9900DB751B /* Frameworks */,
|
||||
2D07B96F1636FC9900DB751B /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = eventsql;
|
||||
productName = eventsql;
|
||||
productReference = 2D07B9711636FC9900DB751B /* eventsql */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
3104AFB2156D357B000A585A /* apss */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3104AFBC156D357B000A585A /* Build configuration list for PBXNativeTarget "apss" */;
|
||||
|
|
@ -2124,11 +2190,20 @@
|
|||
3114A694156E971B001E0AA3 /* messtest */,
|
||||
3114A6AB156E9759001E0AA3 /* walkt0 */,
|
||||
3114A6C5156E9815001E0AA3 /* eventcnv */,
|
||||
2D07B9701636FC9900DB751B /* eventsql */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
2D07B96D1636FC9900DB751B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2D07B97A1636FCCE00DB751B /* eventsql.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3104AFAF156D357B000A585A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -2461,6 +2536,11 @@
|
|||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
2D07B9791636FCBD00DB751B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 2D07B9701636FC9900DB751B /* eventsql */;
|
||||
targetProxy = 2D07B9781636FCBD00DB751B /* PBXContainerItemProxy */;
|
||||
};
|
||||
3104AFC1156D35AE000A585A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
||||
|
|
@ -2769,6 +2849,30 @@
|
|||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
2D07B9751636FC9900DB751B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2D07B9761636FC9900DB751B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
2D07B9771636FC9900DB751B /* WE */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = WE;
|
||||
};
|
||||
3104AFBA156D357B000A585A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
|
|
@ -3616,6 +3720,15 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
2D07B9741636FC9900DB751B /* Build configuration list for PBXNativeTarget "eventsql" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2D07B9751636FC9900DB751B /* Debug */,
|
||||
2D07B9761636FC9900DB751B /* Release */,
|
||||
2D07B9771636FC9900DB751B /* WE */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
3104AFBC156D357B000A585A /* Build configuration list for PBXNativeTarget "apss" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue