Commit b3acb187b636517caa01b82bcc2ee7c7ac69de30

Authored by Perry Werneck
1 parent 231deaaa
Exists in master and in 1 other branch develop

Fixing performance issues.

client/src/core/windows/request.cc
@@ -136,6 +136,7 @@ @@ -136,6 +136,7 @@
136 } 136 }
137 137
138 debug("Received response \"", in.block, "\" with ", in.used, " bytes"); 138 debug("Received response \"", in.block, "\" with ", in.used, " bytes");
  139 +
139 #ifdef DEBUG 140 #ifdef DEBUG
140 // lib3270_trace_data(NULL,"Response block",(const char *) this->in.block, this->in.used); 141 // lib3270_trace_data(NULL,"Response block",(const char *) this->in.block, this->in.used);
141 #endif // DEBUG 142 #endif // DEBUG
server/src/core/methods/methods.c
@@ -83,24 +83,18 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req @@ -83,24 +83,18 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req
83 83
84 debug("%s(%s,request=%p,response=%p,error=%p)",__FUNCTION__,method_name,request,response,*error); 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 for(ix = 0; ix < G_N_ELEMENTS(methods); ix++) { 86 for(ix = 0; ix < G_N_ELEMENTS(methods); ix++) {
89 87
90 if(!g_ascii_strcasecmp(methods[ix].name,method_name)) { 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 if(rc) 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 ipc3270_set_error(object,rc,error); 97 ipc3270_set_error(object,rc,error);
103 - debug("Error Message was set to %s",(*error)->message);  
104 } 98 }
105 99
106 return 0; 100 return 0;
@@ -110,6 +104,9 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req @@ -110,6 +104,9 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req
110 // Check actions table. 104 // Check actions table.
111 const LIB3270_ACTION * action = lib3270_action_get_by_name(method_name); 105 const LIB3270_ACTION * action = lib3270_action_get_by_name(method_name);
112 if(action) { 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 if(lib3270_action_activate(action,hSession)) { 110 if(lib3270_action_activate(action,hSession)) {
114 ipc3270_set_error(object,errno,error); 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,6 +120,8 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req
123 120
124 if(!g_ascii_strcasecmp(int_methods[ix].name,method_name)) { 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 gint value; 125 gint value;
127 g_variant_get(request, "(i)", &value); 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,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 g_message("Unknown method \"%s\"",method_name); 140 g_message("Unknown method \"%s\"",method_name);
141 return ENOENT; 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,16 +101,22 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) {
101 H3270 * hSession = ipc3270_get_session(source->object); 101 H3270 * hSession = ipc3270_get_session(source->object);
102 int request_type = 0; 102 int request_type = 0;
103 103
  104 + /*
104 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE)) 105 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE))
105 lib3270_trace_data(hSession, "IPC Data block received on pipe", (const unsigned char *) source->buffer, (size_t) cbRead); 106 lib3270_trace_data(hSession, "IPC Data block received on pipe", (const unsigned char *) source->buffer, (size_t) cbRead);
106 107
107 debug("Received packet \"%s\" with %u bytes", request_name, (unsigned int) cbRead); 108 debug("Received packet \"%s\" with %u bytes", request_name, (unsigned int) cbRead);
  109 + */
108 110
109 g_autoptr (GError) error = NULL; 111 g_autoptr (GError) error = NULL;
110 g_autoptr (GVariant) response = NULL; 112 g_autoptr (GVariant) response = NULL;
111 g_autoptr (GVariant) parameters = ipc3270_unpack(source->buffer, &request_type); 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 if(parameters) { 121 if(parameters) {
116 122
@@ -155,7 +161,11 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { @@ -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 // Pack response 170 // Pack response
161 size_t szPacket = 0; 171 size_t szPacket = 0;
@@ -174,8 +184,10 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { @@ -174,8 +184,10 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) {
174 // Send response 184 // Send response
175 DWORD wrote = (DWORD) szPacket; 185 DWORD wrote = (DWORD) szPacket;
176 186
  187 + /*
177 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE)) 188 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_EVENT_TRACE))
178 lib3270_trace_data(hSession, "IPC Data block sent to pipe", (const unsigned char *) buffer, szPacket); 189 lib3270_trace_data(hSession, "IPC Data block sent to pipe", (const unsigned char *) buffer, szPacket);
  190 + */
179 191
180 WriteFile(source->hPipe,buffer,wrote,&wrote,NULL); 192 WriteFile(source->hPipe,buffer,wrote,&wrote,NULL);
181 193
server/src/testprogram/testprogram.c
@@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
42 #include <stdlib.h> 42 #include <stdlib.h>
43 #include <glib.h> 43 #include <glib.h>
44 #include <glib/gstdio.h> 44 #include <glib/gstdio.h>
  45 + #include <lib3270/toggle.h>
45 46
46 /*---[ Globals ]------------------------------------------------------------------------------------*/ 47 /*---[ Globals ]------------------------------------------------------------------------------------*/
47 48
@@ -227,6 +228,8 @@ @@ -227,6 +228,8 @@
227 228
228 g_signal_connect(terminal,"session_changed",G_CALLBACK(session_changed),window); 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 int main (int argc, char **argv) { 235 int main (int argc, char **argv) {