Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improved error message upon timeout. Combine redundant implementations of the function that finds user and kernel CPU usage. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
6c3d370496dfb7c91d2ef20e0523cfcb |
| User & Date: | drh 2021-08-07 17:28:43.603 |
Context
|
2021-08-08
| ||
| 18:20 | More information in the log file for signal handlers. Include the phase of operation as part of the log message. ... (check-in: 48c06b0a13 user: drh tags: trunk) | |
|
2021-08-07
| ||
| 17:28 | Improved error message upon timeout. Combine redundant implementations of the function that finds user and kernel CPU usage. ... (check-in: 6c3d370496 user: drh tags: trunk) | |
| 17:28 | Update to the latest trunk version of SQLite, for SQLite testing. ... (check-in: 5570a6aae9 user: drh tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
2779 2780 2781 2782 2783 2784 2785 2786 |
}
/*
** Respond to a SIGALRM by writing a message to the error log (if there
** is one) and exiting.
*/
#ifndef _WIN32
static void sigalrm_handler(int x){
| > > > | > > | 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 |
}
/*
** Respond to a SIGALRM by writing a message to the error log (if there
** is one) and exiting.
*/
#ifndef _WIN32
static int nAlarmSeconds = 0;
static void sigalrm_handler(int x){
sqlite3_uint64 tmUser = 0, tmKernel = 0;
fossil_cpu_times(&tmUser, &tmKernel);
fossil_panic("Timeout after %d seconds - user %,llu µs, sys %,llu µs",
nAlarmSeconds, tmUser, tmKernel);
}
#endif
/*
** Arrange to timeout using SIGALRM after N seconds. Or if N==0, cancel
** any pending timeout.
**
** Bugs:
** (1) This only works on unix systems.
** (2) Any call to sleep() or sqlite3_sleep() will cancel the alarm.
*/
void fossil_set_timeout(int N){
#ifndef _WIN32
signal(SIGALRM, sigalrm_handler);
alarm(N);
nAlarmSeconds = N;
#endif
}
/*
** COMMAND: server*
** COMMAND: ui
**
|
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
1747 1748 1749 1750 1751 1752 1753 |
{ "content", unversionedContentCmd },
{ "list", unversionedListCmd },
{ 0, 0 }
};
return Th_CallSubCommand(interp, p, argc, argv, argl, aSub);
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 |
{ "content", unversionedContentCmd },
{ "list", unversionedListCmd },
{ 0, 0 }
};
return Th_CallSubCommand(interp, p, argc, argv, argl, aSub);
}
/*
** TH1 command: utime
**
** Return the number of microseconds of CPU time consumed by the current
** process in user space.
*/
static int utimeCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
sqlite3_uint64 x;
char zUTime[50];
fossil_cpu_times(&x, 0);
sqlite3_snprintf(sizeof(zUTime), zUTime, "%llu", x);
Th_SetResult(interp, zUTime, -1);
return TH_OK;
}
/*
** TH1 command: stime
**
** Return the number of microseconds of CPU time consumed by the current
** process in system space.
*/
static int stimeCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
sqlite3_uint64 x;
char zUTime[50];
fossil_cpu_times(0, &x);
sqlite3_snprintf(sizeof(zUTime), zUTime, "%llu", x);
Th_SetResult(interp, zUTime, -1);
return TH_OK;
}
/*
|
| ︙ | ︙ |
Changes to src/util.c.
| ︙ | ︙ | |||
33 34 35 36 37 38 39 | #else # include <sys/time.h> # include <sys/resource.h> # include <unistd.h> # include <fcntl.h> # include <errno.h> #endif | < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#else
# include <sys/time.h>
# include <sys/resource.h>
# include <unistd.h>
# include <fcntl.h>
# include <errno.h>
#endif
/*
** Exit. Take care to close the database first.
*/
NORETURN void fossil_exit(int rc){
db_close(1);
#ifndef _WIN32
|
| ︙ | ︙ |