Changeset 725c93dbed2c4bd113c87b443eee22ccd4bbeb37
- Timestamp:
- 01/12/10 20:45:04
(3 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1263329104 +0000
- git-parent:
[2b04ed7616629481e40b0b4d6cdc9d9f16f9edbe]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1263329104 +0000
- Message:
first whack at dtrace probes. the fact we can't use archives is painful. refs #233
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r39f7fec |
r725c93d |
|
| 40 | 40 | case $host in |
|---|
| 41 | 41 | *-*-darwin*) |
|---|
| | 42 | DTRACE=/usr/sbin/dtrace |
|---|
| | 43 | DTRACEHDR=dtrace_probes.h |
|---|
| | 44 | DTRACE_ENABLED=1 |
|---|
| 42 | 45 | PICFLAGS="-fPIC" |
|---|
| 43 | 46 | MODULELD="$CC -bundle -flat_namespace -undefined suppress" |
|---|
| … | … | |
| 47 | 50 | ;; |
|---|
| 48 | 51 | *-*-solaris*) |
|---|
| | 52 | DTRACE=/usr/sbin/dtrace |
|---|
| | 53 | DTRACEHDR=dtrace_probes.h |
|---|
| | 54 | DTRACE_ENABLED=1 |
|---|
| | 55 | DTRACEOBJ=dtrace_stub.o |
|---|
| 49 | 56 | AC_MSG_CHECKING([32 or 64 bit Solaris assembly]) |
|---|
| 50 | 57 | if test -n "`echo $CFLAGS | grep m64`"; then |
|---|
| 51 | 58 | AC_MSG_RESULT([64]) |
|---|
| | 59 | DTRACEFLAGS=-64 |
|---|
| 52 | 60 | ATOMIC_OBJS="noit_atomic_sol_x86_64.o" |
|---|
| 53 | 61 | else |
|---|
| … | … | |
| 104 | 112 | ;; |
|---|
| 105 | 113 | esac |
|---|
| | 114 | AC_SUBST(DTRACE) |
|---|
| | 115 | AC_SUBST(DTRACE_ENABLED) |
|---|
| | 116 | AC_DEFINE(DTRACE_ENABLED) |
|---|
| | 117 | AC_SUBST(DTRACEOBJ) |
|---|
| | 118 | AC_SUBST(DTRACEFLAGS) |
|---|
| 106 | 119 | AC_SUBST(SHLD) |
|---|
| 107 | 120 | AC_SUBST(RLDFLAG) |
|---|
| raaa42af |
r725c93d |
|
| 131 | 131 | $(WHOLE_ARCHIVE) \ |
|---|
| 132 | 132 | -Leventer -leventer \ |
|---|
| 133 | | -Lutils -lnoit_utils \ |
|---|
| | 133 | utils/*.o \ |
|---|
| 134 | 134 | -Ljlog -ljlog \ |
|---|
| 135 | 135 | -Lnoitedit -lnoitedit \ |
|---|
| … | … | |
| 144 | 144 | $(WHOLE_ARCHIVE) \ |
|---|
| 145 | 145 | -Leventer -leventer \ |
|---|
| 146 | | -Lutils -lnoit_utils \ |
|---|
| | 146 | utils/*.o \ |
|---|
| 147 | 147 | -Ljlog -ljlog \ |
|---|
| 148 | 148 | -Lnoitedit -lnoitedit \ |
|---|
| r0500158 |
r725c93d |
|
| 913 | 913 | info->timeoutevent->mask = EVENTER_TIMER; |
|---|
| 914 | 914 | |
|---|
| | 915 | noitL(nldeb, "Sending snmp get\n"); |
|---|
| 915 | 916 | gettimeofday(&when, NULL); |
|---|
| 916 | 917 | to.tv_sec = check->timeout / 1000; |
|---|
| … | … | |
| 922 | 923 | else { |
|---|
| 923 | 924 | ts->refcnt--; |
|---|
| | 925 | noitL(nlerr, "Error sending snmp get request.\n"); |
|---|
| 924 | 926 | noit_snmp_session_cleanse(ts); |
|---|
| 925 | 927 | /* Error */ |
|---|
| r39f7fec |
r725c93d |
|
| 37 | 37 | #undef inline |
|---|
| 38 | 38 | |
|---|
| | 39 | #undef DTRACE_ENABLED |
|---|
| 39 | 40 | #undef MODULEEXT |
|---|
| 40 | 41 | #undef MODULES_DIR |
|---|
| r5c424a9 |
r725c93d |
|
| 16 | 16 | all: libnoit_utils.a |
|---|
| 17 | 17 | |
|---|
| 18 | | libnoit_utils.a: $(OBJS) |
|---|
| | 18 | @DTRACEOBJ@: $(OBJS) |
|---|
| | 19 | @DTRACE@ @DTRACEFLAGS@ -G -s dtrace_probes.d -o @DTRACEOBJ@ $(OBJS) |
|---|
| | 20 | |
|---|
| | 21 | noit_log.o: @DTRACEHDR@ |
|---|
| | 22 | |
|---|
| | 23 | @DTRACEHDR@: dtrace_probes.d |
|---|
| | 24 | @DTRACE@ -h -s dtrace_probes.d |
|---|
| | 25 | |
|---|
| | 26 | libnoit_utils.a: $(OBJS) @DTRACEOBJ@ |
|---|
| 19 | 27 | @rm -f $@ |
|---|
| 20 | | @$(AR) cq $@ $(OBJS) |
|---|
| | 28 | @$(AR) cq $@ $(OBJS) @DTRACEOBJ@ |
|---|
| 21 | 29 | @echo "- archiving $@" |
|---|
| 22 | 30 | @$(RANLIB) $@ |
|---|
| reefe963 |
r725c93d |
|
| 51 | 51 | #include "jlog/jlog.h" |
|---|
| 52 | 52 | #include "jlog/jlog_private.h" |
|---|
| | 53 | #ifdef DTRACE_ENABLED |
|---|
| | 54 | #include "utils/dtrace_probes.h" |
|---|
| | 55 | #else |
|---|
| | 56 | #define NOIT_LOG_LOG(a,b,c,d) |
|---|
| | 57 | #define NOIT_LOG_LOG_ENABLED() 0 |
|---|
| | 58 | #endif |
|---|
| 53 | 59 | |
|---|
| 54 | 60 | struct _noit_log_stream { |
|---|
| … | … | |
| 72 | 78 | noit_log_stream_t noit_error = NULL; |
|---|
| 73 | 79 | noit_log_stream_t noit_debug = NULL; |
|---|
| | 80 | |
|---|
| | 81 | int noit_log_global_enabled() { |
|---|
| | 82 | return NOIT_LOG_LOG_ENABLED(); |
|---|
| | 83 | } |
|---|
| 74 | 84 | |
|---|
| 75 | 85 | static int |
|---|
| … | … | |
| 556 | 566 | #endif |
|---|
| 557 | 567 | |
|---|
| 558 | | if(ls->enabled) { |
|---|
| | 568 | if(ls->enabled || NOIT_LOG_LOG_ENABLED()) { |
|---|
| 559 | 569 | int len; |
|---|
| 560 | 570 | if(ls->debug) { |
|---|
| … | … | |
| 590 | 600 | #endif |
|---|
| 591 | 601 | } |
|---|
| 592 | | rv = noit_log_line(ls, dynbuff, len); |
|---|
| | 602 | NOIT_LOG_LOG(ls->name, (char *)file, line, dynbuff); |
|---|
| | 603 | if(ls->enabled) |
|---|
| | 604 | rv = noit_log_line(ls, dynbuff, len); |
|---|
| 593 | 605 | free(dynbuff); |
|---|
| 594 | 606 | } |
|---|
| 595 | 607 | else { |
|---|
| 596 | | rv = noit_log_line(ls, buffer, len); |
|---|
| | 608 | NOIT_LOG_LOG(ls->name, (char *)file, line, buffer); |
|---|
| | 609 | if(ls->enabled) |
|---|
| | 610 | rv = noit_log_line(ls, buffer, len); |
|---|
| 597 | 611 | } |
|---|
| 598 | 612 | if(rv == len) return 0; |
|---|
| r5bb306c |
r725c93d |
|
| 66 | 66 | extern noit_log_stream_t noit_error; |
|---|
| 67 | 67 | |
|---|
| | 68 | API_EXPORT(int) noit_log_global_enabled(); |
|---|
| 68 | 69 | API_EXPORT(void) noit_log_init(); |
|---|
| 69 | 70 | API_EXPORT(int) noit_log_reopen_all(); |
|---|
| … | … | |
| 105 | 106 | |
|---|
| 106 | 107 | #define noitLT(ls, t, args...) do { \ |
|---|
| 107 | | if((ls) && (ls)->enabled) noit_log(ls, t, __FILE__, __LINE__, args); \ |
|---|
| | 108 | if((ls) && (noit_log_global_enabled() || (ls)->enabled)) \ |
|---|
| | 109 | noit_log(ls, t, __FILE__, __LINE__, args); \ |
|---|
| 108 | 110 | } while(0) |
|---|
| 109 | 111 | #define noitL(ls, args...) do { \ |
|---|
| 110 | | if((ls) && (ls)->enabled) { \ |
|---|
| | 112 | if((ls) && (noit_log_global_enabled() || (ls)->enabled)) { \ |
|---|
| 111 | 113 | struct timeval __noitL_now; \ |
|---|
| 112 | 114 | gettimeofday(&__noitL_now, NULL); \ |
|---|