Added a proper define for the external zlib and check for sched_getcpu().
authorPaolo Molaro <lupus@oddwiz.org>
Thu, 11 Nov 2010 14:56:33 +0000 (15:56 +0100)
committerPaolo Molaro <lupus@oddwiz.org>
Thu, 11 Nov 2010 14:56:33 +0000 (15:56 +0100)
configure.in
mono/profiler/decode.c
mono/profiler/proflog.c
mono/profiler/utils.c

index 9e1ebb3d7127634a5b383c6be8f5b297f17d4249..d9c787dd01ddc8e3f2f85e18d806447b13dda20d 100644 (file)
@@ -385,6 +385,7 @@ if test x$have_zlib = xyes; then
    ],[
        AC_MSG_RESULT(Using system zlib)
        zlib_msg="system zlib"
+       AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib])
    ],[
        AC_MSG_RESULT(Using embedded zlib)
        have_zlib=no
@@ -1006,6 +1007,7 @@ if test x$target_win32 = xno; then
        AC_CHECK_FUNCS(sysconf)
 
        AC_CHECK_FUNCS(sched_setaffinity)
+       AC_CHECK_FUNCS(sched_getcpu)
 
        dnl ****************************************************************
        dnl *** Check for sched_setaffinity from glibc versions before   ***
index cb3a8327fa79fdf879f03ac68de78c160d0c2baf..d441af2e9f5a14a4765de896d479f2d46fb78fb4 100644 (file)
 #endif
 #include <unistd.h>
 #include <stdlib.h>
-#ifdef HOST_WIN32
-#undef HAVE_ZLIB
-#endif
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
 #include <zlib.h>
 #endif
 #include <mono/metadata/profiler.h>
@@ -616,7 +613,7 @@ typedef struct _ThreadContext ThreadContext;
 
 typedef struct {
        FILE *file;
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        gzFile *gzfile;
 #endif
        unsigned char *buf;
@@ -659,7 +656,7 @@ static int
 load_data (ProfContext *ctx, int size)
 {
        ensure_buffer (ctx, size);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        if (ctx->gzfile)
                return gzread (ctx->gzfile, ctx->buf, size) == size;
        else
@@ -1460,7 +1457,7 @@ load_file (char *name)
                printf ("Cannot open file: %s\n", name);
                exit (1);
        }
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        ctx->gzfile = gzdopen (fileno (ctx->file), "rb");
 #endif
        if (!load_data (ctx, 32))
index 7ba7627d7456143c05bb638d6390d11787ed24a2..d9f6c4ca91c358ba84a02e240b317f90b7ab68d9 100644 (file)
 #include "utils.c"
 #include "proflog.h"
 
-#ifdef HOST_WIN32
-#undef HAVE_ZLIB
-#endif
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
 #include <zlib.h>
 #endif
 
@@ -240,7 +237,7 @@ struct _LogBuffer {
 struct _MonoProfiler {
        LogBuffer *buffers;
        FILE* file;
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        gzFile *gzfile;
 #endif
        int pipe_output;
@@ -409,7 +406,7 @@ dump_header (MonoProfiler *profiler)
        p = write_int32 (p, 0); /* flags */
        p = write_int32 (p, 0); /* pid */
        p = write_int32 (p, 0); /* opsystem */
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        if (profiler->gzfile) {
                gzwrite (profiler->gzfile, hbuf, p - hbuf);
        } else {
@@ -434,7 +431,7 @@ dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
        p = write_int64 (p, buf->obj_base);
        p = write_int64 (p, buf->thread_id);
        p = write_int64 (p, buf->method_base);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        if (profiler->gzfile) {
                gzwrite (profiler->gzfile, hbuf, p - hbuf);
                gzwrite (profiler->gzfile, buf->buf, buf->data - buf->buf);
@@ -442,7 +439,7 @@ dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
 #endif
                fwrite (hbuf, p - hbuf, 1, profiler->file);
                fwrite (buf->buf, buf->data - buf->buf, 1, profiler->file);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        }
 #endif
        free_buffer (buf, buf->size);
@@ -921,7 +918,7 @@ log_shutdown (MonoProfiler *prof)
                dump_buffer (prof, TLS_GET (tlsbuffer));
        TLS_SET (tlsbuffer, NULL);
        release_lock ();
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        if (prof->gzfile)
                gzclose (prof->gzfile);
 #endif
@@ -952,7 +949,7 @@ create_profiler (const char *filename)
                printf ("Cannot create profiler output: %s\n", filename);
                exit (1);
        }
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
        if (use_zip)
                prof->gzfile = gzdopen (fileno (prof->file), "wb");
 #endif
index 1aa4756fec5d5f050c28cb43cfe8d02dd0cda8ee..b16e9bfc6aa7474e61a40ec7075fc349eb6a30ea 100644 (file)
@@ -46,7 +46,7 @@ static mach_timebase_info_data_t timebase_info;
 
 #define TICKS_PER_SEC 1000000000LL
 
-#if (defined(TARGET_X86) || defined(TARGET_AMD64)) && defined(__linux__)
+#if (defined(TARGET_X86) || defined(TARGET_AMD64)) && defined(__linux__) && defined(HAVE_SCHED_GETCPU)
 #define HAVE_RDTSC 1
 #endif