Commit b3acb187b636517caa01b82bcc2ee7c7ac69de30
1 parent
231deaaa
Exists in
master
and in
1 other branch
Fixing performance issues.
Showing
4 changed files
with
27 additions
and
11 deletions
Show diff stats
client/src/core/windows/request.cc
server/src/core/methods/methods.c
... | ... | @@ -83,24 +83,18 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req |
83 | 83 | |
84 | 84 | debug("%s(%s,request=%p,response=%p,error=%p)",__FUNCTION__,method_name,request,response,*error); |
85 | 85 | |
86 | - lib3270_write_event_trace(hSession,"Method %s called on session %c\n",method_name,lib3270_get_session_id(hSession)); | |
87 | - | |
88 | 86 | for(ix = 0; ix < G_N_ELEMENTS(methods); ix++) { |
89 | 87 | |
90 | 88 | if(!g_ascii_strcasecmp(methods[ix].name,method_name)) { |
91 | 89 | |
92 | - g_message("Running method %s",method_name); | |
93 | - int rc = methods[ix].call(object,request,response,error); | |
90 | + lib3270_write_event_trace(hSession,"Method %s called on session %c\n",method_name,lib3270_get_session_id(hSession)); | |
94 | 91 | |
95 | - debug("rc=%d error=%p",rc,*error); | |
92 | + int rc = methods[ix].call(object,request,response,error); | |
96 | 93 | |
97 | 94 | if(rc) |
98 | 95 | { |
99 | - g_message("Method %s failed with rc=%d (%s)",method_name,rc,ipc3270_get_error_message(rc)); | |
100 | - debug("%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); | |
101 | - lib3270_write_log(hSession,"IPC","%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); | |
96 | + lib3270_write_event_trace(hSession,"Method %s failed with rc=%d (%s)",method_name,rc,ipc3270_get_error_message(rc)); | |
102 | 97 | ipc3270_set_error(object,rc,error); |
103 | - debug("Error Message was set to %s",(*error)->message); | |
104 | 98 | } |
105 | 99 | |
106 | 100 | return 0; |
... | ... | @@ -110,6 +104,9 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req |
110 | 104 | // Check actions table. |
111 | 105 | const LIB3270_ACTION * action = lib3270_action_get_by_name(method_name); |
112 | 106 | if(action) { |
107 | + | |
108 | + lib3270_write_event_trace(hSession,"Action %s called on session %c\n",method_name,lib3270_get_session_id(hSession)); | |
109 | + | |
113 | 110 | if(lib3270_action_activate(action,hSession)) { |
114 | 111 | ipc3270_set_error(object,errno,error); |
115 | 112 | } |
... | ... | @@ -123,6 +120,8 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req |
123 | 120 | |
124 | 121 | if(!g_ascii_strcasecmp(int_methods[ix].name,method_name)) { |
125 | 122 | |
123 | + lib3270_write_event_trace(hSession,"Internal method %s called on session %c\n",method_name,lib3270_get_session_id(hSession)); | |
124 | + | |
126 | 125 | gint value; |
127 | 126 | g_variant_get(request, "(i)", &value); |
128 | 127 | |
... | ... | @@ -137,6 +136,7 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req |
137 | 136 | |
138 | 137 | } |
139 | 138 | |
139 | + lib3270_write_event_trace(hSession,"Unknown method %s\n",method_name); | |
140 | 140 | g_message("Unknown method \"%s\"",method_name); |
141 | 141 | return ENOENT; |
142 | 142 | ... | ... |
server/src/core/windows/pipesource.c
... | ... | @@ -101,16 +101,22 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { |
101 | 101 | H3270 * hSession = ipc3270_get_session(source->object); |
102 | 102 | int request_type = 0; |
103 | 103 | |
104 | + /* | |
104 | 105 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE)) |
105 | 106 | lib3270_trace_data(hSession, "IPC Data block received on pipe", (const unsigned char *) source->buffer, (size_t) cbRead); |
106 | 107 | |
107 | 108 | debug("Received packet \"%s\" with %u bytes", request_name, (unsigned int) cbRead); |
109 | + */ | |
108 | 110 | |
109 | 111 | g_autoptr (GError) error = NULL; |
110 | 112 | g_autoptr (GVariant) response = NULL; |
111 | 113 | g_autoptr (GVariant) parameters = ipc3270_unpack(source->buffer, &request_type); |
112 | 114 | |
113 | - debug("************ error=%p",error); | |
115 | +/* | |
116 | +#ifdef DEBUG | |
117 | + clock_t begin_time = clock(); | |
118 | +#endif // DEBUG | |
119 | +*/ | |
114 | 120 | |
115 | 121 | if(parameters) { |
116 | 122 | |
... | ... | @@ -155,7 +161,11 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { |
155 | 161 | |
156 | 162 | } |
157 | 163 | |
158 | - debug("response=%p",response); | |
164 | +/* | |
165 | +#ifdef DEBUG | |
166 | + g_message("Command takes %lu",(unsigned long) (clock () - begin_time)); | |
167 | +#endif // DEBUG | |
168 | +*/ | |
159 | 169 | |
160 | 170 | // Pack response |
161 | 171 | size_t szPacket = 0; |
... | ... | @@ -174,8 +184,10 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { |
174 | 184 | // Send response |
175 | 185 | DWORD wrote = (DWORD) szPacket; |
176 | 186 | |
187 | + /* | |
177 | 188 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE)) |
178 | 189 | lib3270_trace_data(hSession, "IPC Data block sent to pipe", (const unsigned char *) buffer, szPacket); |
190 | + */ | |
179 | 191 | |
180 | 192 | WriteFile(source->hPipe,buffer,wrote,&wrote,NULL); |
181 | 193 | ... | ... |
server/src/testprogram/testprogram.c
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | #include <stdlib.h> |
43 | 43 | #include <glib.h> |
44 | 44 | #include <glib/gstdio.h> |
45 | + #include <lib3270/toggle.h> | |
45 | 46 | |
46 | 47 | /*---[ Globals ]------------------------------------------------------------------------------------*/ |
47 | 48 | |
... | ... | @@ -227,6 +228,8 @@ |
227 | 228 | |
228 | 229 | g_signal_connect(terminal,"session_changed",G_CALLBACK(session_changed),window); |
229 | 230 | |
231 | + lib3270_set_toggle(v3270_get_session(terminal),LIB3270_TOGGLE_EVENT_TRACE,1); | |
232 | + | |
230 | 233 | } |
231 | 234 | |
232 | 235 | int main (int argc, char **argv) { | ... | ... |