icwmp/scripts/functions/misc
Mohamed Kallel 27b73d5af7 PIVA::DELIVERY 8
script optimization
Voice parameters: AddObject/DeleteObject
Voice parameters: Vendor specific parameter

Concerning what we did in the optimization task:
1)  The main script  (freecwmp) is loaded only 1 time during the session. the load is done just before the start of the session. the function scripts are loaded within the load of the main script (freecwmp) only one time. The old behaviour consist to load the main script (freecwmp) and the function scripts for each parameter treatment. Core code (C) and Scripts are changed
2) Optimize the preparing of inform message. old script take ~30s and now it takes ~2s. Core code (C) and Scripts are changed
3) Execute only the function related to the parameter. For example if the requested parameter is "InternetGatewayDevice.ManagementServer.URL" then the main script freecwmp will execute only the related function of this parameter which is get_management_server(). The old behaviour consist to execute all get functions: get_wan_device(), get_lan_device(), get_device_info()...
4) Minimize the size of the script files: Replace some blocks o othe source code by a functions
2013-07-24 16:05:32 +01:00

41 lines
No EOL
1.2 KiB
Bash

#!/bin/sh
# Copyright (C) 2012 Luka Perkov <freecwmp@lukaperkov.net>
# Copyright (C) 2013 Inteno Broadband Technology AB
# Author Ahmed Zribi <ahmed.zribi@pivasoftware.com>
get_misc_cpu_usage() {
local val=`uptime | awk -F'average: ' '{ print $2 }' | awk -F',' '{ print $1 }' | awk -F'.' '{ print $2 }'`
freecwmp_output "Device.DeviceInfo.ProcessStatus.CPUUsage" "$val"
}
get_misc_process_number() {
local val=`ps | grep -v COMMAND | wc -l`
local type="xsd:unsignedInt"
freecwmp_output "Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries" "$val" "" "$type"
}
get_misc() {
case "$1" in
Device.DeviceInfo.ProcessStatus.CPUUsage)
get_misc_cpu_usage
return $FAULT_CPE_NO_FAULT
;;
Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries)
get_misc_process_number
return $FAULT_CPE_NO_FAULT
;;
esac
return $FAULT_CPE_INVALID_PARAMETER_NAME
}
get_misc_name () { return $FAULT_CPE_INVALID_PARAMETER_NAME; }
get_misc_notification () { return $FAULT_CPE_INVALID_PARAMETER_NAME; }
set_misc() { return $FAULT_CPE_INVALID_PARAMETER_NAME; }
set_misc_notification () { return $FAULT_CPE_INVALID_PARAMETER_NAME; }
add_misc() { return $FAULT_CPE_INVALID_PARAMETER_NAME; }
delete_misc() { return $FAULT_CPE_INVALID_PARAMETER_NAME; }