This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 172578
Collapse All | Expand All

(-)file_not_specified_in_diff (-19 / +4 lines)
Line  Link Here
0
-- C:\Users\User\Documents\NetBeansProjects\ProfilingDemo_1\common.h
0
++ C:\Program Files\TortoiseHg\cnd-main\cnd.makeproject\samples_src\profiling\common.h
Lines 35-41 Link Here
35
#endif
35
#endif
36
36
37
#include <stdio.h>
37
#include <stdio.h>
38
#include <sys/time.h>
39
    
38
    
40
// Tracing
39
// Tracing
41
typedef enum {
40
typedef enum {
Lines 50-56 Link Here
50
#define REF(fmt, ...) if (msg_levels & msg_ref) { printf(fmt, ##__VA_ARGS__); }
49
#define REF(fmt, ...) if (msg_levels & msg_ref) { printf(fmt, ##__VA_ARGS__); }
51
#define TRACE(fmt, ...) if (msg_levels & msg_trace) { printf(fmt, ##__VA_ARGS__); }
50
#define TRACE(fmt, ...) if (msg_levels & msg_trace) { printf(fmt, ##__VA_ARGS__); }
52
#define EXPLAIN(fmt, ...) if (msg_levels & msg_explain) { printf(fmt, ##__VA_ARGS__); }
51
#define EXPLAIN(fmt, ...) if (msg_levels & msg_explain) { printf(fmt, ##__VA_ARGS__); }
53
#define PAUSE(fmt, ...) if (msg_levels & msg_explain) { print_run_time();  printf(fmt, ##__VA_ARGS__);  getchar(); }
52
#define PAUSE(fmt, ...) if (msg_levels & msg_explain) { printf(fmt, ##__VA_ARGS__); getchar(); }
54
#define ERROR(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__);
53
#define ERROR(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__);
55
54
56
// CPU usage types
55
// CPU usage types
Lines 88-94 Link Here
88
int cpucount();
87
int cpucount();
89
void mem2str(char* buf, long bytes);
88
void mem2str(char* buf, long bytes);
90
89
91
struct timeval globalstarttime;
92
90
93
// Check available pthread features
91
// Check available pthread features
94
#include <pthread.h>
92
#include <pthread.h>
95
-- C:\Users\User\Documents\NetBeansProjects\ProfilingDemo_1\common.c
93
++ C:\Program Files\TortoiseHg\cnd-main\cnd.makeproject\samples_src\profiling\common.c
Lines 56-72 Link Here
56
    TRACE("work %d: Done sleeping\n", work_id);
56
    TRACE("work %d: Done sleeping\n", work_id);
57
}
57
}
58
58
59
void get_run_time(struct timeval* a) {
60
     gettimeofday(a, 0);
61
     a->tv_sec -= globalstarttime.tv_sec;
62
}
63
64
void print_run_time () {
65
     struct timeval a;
66
     get_run_time(&a);
67
     TRACE("\nProgram works %ld seconds \n\n", a);
68
 }
69
70
static void work_run_usrcpu(int work_id, long micros) {
59
static void work_run_usrcpu(int work_id, long micros) {
71
    TRACE("work %d: Starting mathematical calculations...\n", work_id);
60
    TRACE("work %d: Starting mathematical calculations...\n", work_id);
72
    long i = 0, j = 0;
61
    long i = 0, j = 0;
73
-- C:\Users\User\Documents\NetBeansProjects\ProfilingDemo_1\main.c
62
++ C:\Program Files\TortoiseHg\cnd-main\cnd.makeproject\samples_src\profiling\main.c
Lines 53-60 Link Here
53
53
54
    msg_levels = msg_explain | msg_trace;
54
    msg_levels = msg_explain | msg_trace;
55
  
55
  
56
    gettimeofday(&globalstarttime,0);
57
58
    sequential_demo(work_count, works, 10);
56
    sequential_demo(work_count, works, 10);
59
57
60
    parallel_demo(work_count, works, 10);
58
    parallel_demo(work_count, works, 10);

Return to bug 172578