File: profile.c

package info (click to toggle)
klic 3.003-1.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,068 kB
  • ctags: 6,333
  • sloc: ansic: 101,584; makefile: 3,395; sh: 1,321; perl: 312; exp: 131; tcl: 111; asm: 102; lisp: 4; sed: 1
file content (138 lines) | stat: -rw-r--r-- 3,213 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* ---------------------------------------------------------- 
%   (C)1995 Institute for New Generation Computer Technology 
%       (Read COPYRIGHT for detailed information.) 
%   (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
%       (Read COPYRIGHT-JIPDEC for detailed information.)
----------------------------------------------------------- */

#include <klic/basic.h>
#include <klic/struct.h>
#include <klic/primitives.h>
#include <klic/timing.h>

#include <stdio.h>
#include <signal.h>

#include <klic/interpe.h>
#include <klic/rmon.h>

/* 
  SEND_PROFILE (from WORKERs to SHOEN)
  */

void output_profile_information();

static q*
decode_send_profile(inbuf, allocp)
combuf *inbuf;
q *allocp;
{
    declare_globals;
    long node;
    node = GET_BUFFER(inbuf);

    shoen_profile[node].stimes = GET_BUFFER(inbuf);
    shoen_profile[node].itimes = GET_BUFFER(inbuf);
    shoen_profile[node].gctimes = GET_BUFFER(inbuf);
    shoen_profile[node].mstimes = GET_BUFFER(inbuf);
    shoen_profile[node].mrtimes = GET_BUFFER(inbuf);
    gathered_count++;

    if(gathered_count == total_node){
	output_profile_information(); /* This routine is machine dependent */
	gathered_count = 0;
	gather_prof_ready = 1;
    }

    return(allocp);
}

static void
encode_send_profile(buffer)
combuf *buffer;
{
    declare_globals;
/*    iosprintf("Node %d: encode_send_profile it_c = %d, id_c = %d gc_c = %d, ms_c = %d, mr_c = %d\n",
		 my_node,intr_count,perfmon_counter.idle_count,perfmon_counter.gc_count,perfmon_counter.ms_count,perfmon_counter.mr_count);*/

    PUT_BUFFER(buffer, decode_send_profile);
    PUT_BUFFER(buffer, my_node);
    PUT_BUFFER(buffer, perfmon_counter.intr_count);
    PUT_BUFFER(buffer, perfmon_counter.idle_count);
    PUT_BUFFER(buffer, perfmon_counter.gc_count);
    PUT_BUFFER(buffer, perfmon_counter.ms_count);
    PUT_BUFFER(buffer, perfmon_counter.mr_count);

    perfmon_counter.intr_count = 0;
    perfmon_counter.idle_count = 0;
    perfmon_counter.gc_count = 0;
    perfmon_counter.ms_count = 0;
    perfmon_counter.mr_count = 0;
}

void
send_profile()
{
    declare_globals;
    combuf *buffer = NODE_TO_BUFFER(SHOEN_NODE);
    
    INT_CL_DEBUG_X(ioprintf("%d:send_message\n", my_node));
    
    encode_send_profile(buffer);
    
    /* Cannot use send_message routine, 
       because it may send request_wtc message after sending the message. */
    
    send_message_without_wtc_chk(SHOEN_NODE, buffer);

}


/* 
  SEND_PROFILE_TRIGGER (from WORKERs to SHOEN)
  */

static q*
decode_profile_trigger(inbuf, allocp)
combuf *inbuf;
q *allocp;
{
    send_profile();
    return(allocp);
}

static
void encode_profile_trigger(buffer)
combuf *buffer;
{
    PUT_BUFFER(buffer, decode_profile_trigger);
}

void
send_profile_trigger_message(node)
     long node;
{
    combuf *buffer = NODE_TO_BUFFER(node);
    encode_profile_trigger(buffer);
    send_message_without_wtc_chk(node, buffer);
}

int
send_profile_trigger(allocp, sig)
q *allocp;
int sig;
{
    declare_globals;
    long i;

    if (gather_prof_ready) {
	for (i = 0; i < total_node ; i++){
	    send_profile_trigger_message(i);
	}
	gather_prof_ready = 0;
    }

    heapp = allocp;
    return 0;
}