Skip to content
Snippets Groups Projects
Commit 05b9a5ed authored by Mohamed Alzayat's avatar Mohamed Alzayat
Browse files

Logging statistics on marker sync and 5-tuple fetching

parent dbbf91d1
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,7 @@ $wgInvalidateCacheOnLocalSettingsChange=0; ...@@ -163,6 +163,7 @@ $wgInvalidateCacheOnLocalSettingsChange=0;
##added by alzayat -- 28/03/2017 ##added by alzayat -- 28/03/2017
$wgSMEEnabled = 1; $wgSMEEnabled = 1;
$wgSMEStats = 1;
$wgSMEProfiling = 0; $wgSMEProfiling = 0;
$wgSMEEnforcement = 1; $wgSMEEnforcement = 1;
$wgSMEDebug=0; $wgSMEDebug=0;
......
...@@ -696,6 +696,7 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) ...@@ -696,6 +696,7 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli)
global $wgSMEDebug; global $wgSMEDebug;
global $wgSMEDummyIP, $wgSMEDummyPort; global $wgSMEDummyIP, $wgSMEDummyPort;
global $SME_KERNEL_ENFORCEMENT_TIMESTAMP; global $SME_KERNEL_ENFORCEMENT_TIMESTAMP;
global $wgSMEStats;
if (isset($wgSMEDummyIP)) if (isset($wgSMEDummyIP))
$dummy_server_ip = $wgSMEDummyIP; $dummy_server_ip = $wgSMEDummyIP;
...@@ -709,9 +710,23 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) ...@@ -709,9 +710,23 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli)
get_local_ip_port($server_ip, $server_port); get_local_ip_port($server_ip, $server_port);
get_remote_ip_port($client_ip, $client_port); get_remote_ip_port($client_ip, $client_port);
if (isset($wgSMEStats) && $wgSMEStats){
$time_start = microtime(true);
}
identify_backend_connection($local_backend_ip, $local_backend_port, identify_backend_connection($local_backend_ip, $local_backend_port,
$remote_backend_ip, $remote_backend_port); $remote_backend_ip, $remote_backend_port);
if (isset($wgSMEStats) && $wgSMEStats){
$time_end = microtime(true);
$time = $time_end - $time_start;
file_put_contents("/local/sme/stats_5_tuple.txt",
"Time required for fetching the 5 tuple is: $time (seconds)\n",
LOCK_EX|FILE_APPEND);
}
/* /*
file_put_contents("/local/sme/besock.txt", file_put_contents("/local/sme/besock.txt",
"src: $client_ip $client_port, in: $server_ip $server_port" . "src: $client_ip $client_port, in: $server_ip $server_port" .
...@@ -720,11 +735,6 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) ...@@ -720,11 +735,6 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli)
*/ */
// Wait for ACK to the FE-Client marker on the frontend kernel,
// before sending the FE-BE marker
if (isset($wgSMEDebug) && $wgSMEDebug == 0) {
waitForKernelACK($SME_MARKER_SOCK, $dummy_server_ip, $dummy_server_port);
}
$num_pub = count($pubhash); $num_pub = count($pubhash);
$num_priv = count($privhash); $num_priv = count($privhash);
...@@ -739,6 +749,12 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) ...@@ -739,6 +749,12 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli)
/* /*
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
*/ */
// Wait for ACK to the FE-Client marker on the frontend kernel,
// before sending the FE-BE marker
if (isset($wgSMEDebug) && $wgSMEDebug == 0) {
waitForKernelACK($SME_MARKER_SOCK, $dummy_server_ip, $dummy_server_port);
}
// Send FE-BE profile marker to kernel // Send FE-BE profile marker to kernel
$ret = socket_sendto($SME_MARKER_SOCK, $pbuf_FE_BE, $plen_FE_BE, 0, $ret = socket_sendto($SME_MARKER_SOCK, $pbuf_FE_BE, $plen_FE_BE, 0,
...@@ -771,15 +787,28 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) ...@@ -771,15 +787,28 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli)
function waitForKernelACK($sock, $dummy_server_ip, $dummy_server_port){ function waitForKernelACK($sock, $dummy_server_ip, $dummy_server_port){
global $SME_KERNEL_ENFORCEMENT_TIMESTAMP; global $SME_KERNEL_ENFORCEMENT_TIMESTAMP;
global $wgSMEDebug; global $wgSMEDebug;
global $wgSMEStats;
if ($sock == -1) { if ($sock == -1) {
file_put_contents("/local/sme/msg_sent_to_kernel.txt", "sock: $sock\n", file_put_contents("/local/sme/msg_sent_to_kernel.txt", "sock: $sock\n",
FILE_APPEND | LOCK_EX); FILE_APPEND | LOCK_EX);
return; return;
} }
if (isset($wgSMEStats) && $wgSMEStats){
$time_start = microtime(true);
}
$ret = socket_recvfrom($sock, $ackbuf, 8, 0, $ret = socket_recvfrom($sock, $ackbuf, 8, 0,
$dummy_server_ip, $dummy_server_port); $dummy_server_ip, $dummy_server_port);
if (isset($wgSMEStats) && $wgSMEStats){
$time_end = microtime(true);
$time = $time_end - $time_start;
file_put_contents("/local/sme/stats_marker_sync.txt",
"Marker sync additional delay: $time\n",
LOCK_EX|FILE_APPEND);
}
$SME_KERNEL_ENFORCEMENT_TIMESTAMP = int_helper::uInt64($ackbuf); $SME_KERNEL_ENFORCEMENT_TIMESTAMP = int_helper::uInt64($ackbuf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment