Loading go-apps/meep-gis-engine/server/gis-automation.go +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,9 @@ func resetAutomation() { } func setAutomation(automationType string, state bool) (err error) { ge.mutex.Lock() defer ge.mutex.Unlock() // Validate automation type if _, found := ge.automation[automationType]; !found { return errors.New("Automation type not found") Loading go-apps/meep-gis-engine/server/gis-engine.go +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ const postgisUser = "postgres" const postgisPwd = "pwd" // Enable profiling const profiling = false const profiling = true var proStart time.Time var proFinish time.Time Loading go-packages/meep-gis-asset-mgr/asset-mgr.go +133 −68 Original line number Diff line number Diff line Loading @@ -40,10 +40,9 @@ const ( ) // Enable profiling const profiling = false const profiling = true var proStart time.Time var proFinish time.Time var profilingTimers map[string]time.Time const ( FieldPosition = "position" Loading Loading @@ -149,6 +148,13 @@ type AssetMgr struct { updateCb func(string, string) } // Profiling init func init() { if profiling { profilingTimers = make(map[string]time.Time) } } // NewAssetMgr - Creates and initializes a new GIS Asset Manager func NewAssetMgr(name, namespace, user, pwd, host, port string) (am *AssetMgr, err error) { if name == "" { Loading Loading @@ -408,7 +414,7 @@ func (am *AssetMgr) DeleteTable(tableName string) (err error) { // CreateUe - Create new UE func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreateUe"] = time.Now() } var position string Loading Loading @@ -511,8 +517,8 @@ func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{} am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("CreateUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreateUe: ", now.Sub(profilingTimers["CreateUe"])) } return nil } Loading @@ -520,7 +526,7 @@ func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{} // CreatePoa - Create new POA func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreatePoa"] = time.Now() } var subtype string Loading Loading @@ -582,8 +588,8 @@ func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{ am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("CreatePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreatePoa: ", now.Sub(profilingTimers["CreatePoa"])) } return nil } Loading @@ -591,7 +597,7 @@ func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{ // CreateCompute - Create new Compute func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreateCompute"] = time.Now() } var subtype string Loading Loading @@ -645,8 +651,8 @@ func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interf am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("CreateCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreateCompute: ", now.Sub(profilingTimers["CreateCompute"])) } return nil } Loading @@ -654,7 +660,7 @@ func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interf // UpdateUe - Update existing UE func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdateUe"] = time.Now() } // Validate input Loading Loading @@ -780,8 +786,8 @@ func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err erro am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("UpdateUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdateUe: ", now.Sub(profilingTimers["UpdateUe"])) } return nil } Loading @@ -789,7 +795,7 @@ func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err erro // UpdatePoa - Update existing POA func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdatePoa"] = time.Now() } // Validate input Loading Loading @@ -841,8 +847,8 @@ func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err err am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("UpdatePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdatePoa: ", now.Sub(profilingTimers["UpdatePoa"])) } return nil } Loading @@ -850,7 +856,7 @@ func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err err // UpdateCompute - Update existing Compute func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdateCompute"] = time.Now() } // Validate input Loading Loading @@ -901,8 +907,8 @@ func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("UpdateCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdateCompute: ", now.Sub(profilingTimers["UpdateCompute"])) } return nil } Loading @@ -910,7 +916,7 @@ func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err // GetUe - Get UE information func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { if profiling { proStart = time.Now() profilingTimers["GetUe"] = time.Now() } // Validate input Loading Loading @@ -979,8 +985,8 @@ func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { } if profiling { proFinish = time.Now() log.Debug("GetUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetUe: ", now.Sub(profilingTimers["GetUe"])) } return ue, nil } Loading @@ -988,7 +994,7 @@ func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { // GetPoa - Get POA information func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { if profiling { proStart = time.Now() profilingTimers["GetPoa"] = time.Now() } // Validate input Loading Loading @@ -1030,8 +1036,8 @@ func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { } if profiling { proFinish = time.Now() log.Debug("GetPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetPoa: ", now.Sub(profilingTimers["GetPoa"])) } return poa, nil } Loading @@ -1039,7 +1045,7 @@ func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { // GetCompute - Get Compute information func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { if profiling { proStart = time.Now() profilingTimers["GetCompute"] = time.Now() } // Validate input Loading Loading @@ -1081,8 +1087,8 @@ func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { } if profiling { proFinish = time.Now() log.Debug("GetCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetCompute: ", now.Sub(profilingTimers["GetCompute"])) } return compute, nil } Loading @@ -1090,7 +1096,7 @@ func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { // GetAllUe - Get All UE information func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllUe"] = time.Now() } // Create UE map Loading Loading @@ -1151,8 +1157,8 @@ func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { } if profiling { proFinish = time.Now() log.Debug("GetAllUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllUe: ", now.Sub(profilingTimers["GetAllUe"])) } return ueMap, nil } Loading @@ -1160,7 +1166,7 @@ func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { // GetAllPoa - Get all POA information func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllPoa"] = time.Now() } // Create POA map Loading Loading @@ -1197,8 +1203,8 @@ func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { } if profiling { proFinish = time.Now() log.Debug("GetAllPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllPoa: ", now.Sub(profilingTimers["GetAllPoa"])) } return poaMap, nil } Loading @@ -1206,7 +1212,7 @@ func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { // GetAllCompute - Get all Compute information func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllCompute"] = time.Now() } // Create Compute map Loading Loading @@ -1243,8 +1249,8 @@ func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) } if profiling { proFinish = time.Now() log.Debug("GetAllCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllCompute: ", now.Sub(profilingTimers["GetAllCompute"])) } return computeMap, nil } Loading @@ -1252,7 +1258,7 @@ func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) // DeleteUe - Delete UE entry func (am *AssetMgr) DeleteUe(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteUe"] = time.Now() } // Validate input Loading @@ -1271,8 +1277,8 @@ func (am *AssetMgr) DeleteUe(name string) (err error) { am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("DeleteUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteUe: ", now.Sub(profilingTimers["DeleteUe"])) } return nil } Loading @@ -1280,7 +1286,7 @@ func (am *AssetMgr) DeleteUe(name string) (err error) { // DeletePoa - Delete POA entry func (am *AssetMgr) DeletePoa(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeletePoa"] = time.Now() } // Validate input Loading @@ -1307,8 +1313,8 @@ func (am *AssetMgr) DeletePoa(name string) (err error) { am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("DeletePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeletePoa: ", now.Sub(profilingTimers["DeletePoa"])) } return nil } Loading @@ -1316,7 +1322,7 @@ func (am *AssetMgr) DeletePoa(name string) (err error) { // DeleteCompute - Delete Compute entry func (am *AssetMgr) DeleteCompute(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteCompute"] = time.Now() } // Validate input Loading @@ -1335,8 +1341,8 @@ func (am *AssetMgr) DeleteCompute(name string) (err error) { am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("DeleteCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteCompute: ", now.Sub(profilingTimers["DeleteCompute"])) } return nil } Loading @@ -1344,7 +1350,7 @@ func (am *AssetMgr) DeleteCompute(name string) (err error) { // DeleteAllUe - Delete all UE entries func (am *AssetMgr) DeleteAllUe() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllUe"] = time.Now() } // !!! IMPORTANT NOTE !!! Loading @@ -1365,8 +1371,8 @@ func (am *AssetMgr) DeleteAllUe() (err error) { am.notifyListener(TypeUe, "") if profiling { proFinish = time.Now() log.Debug("DeleteAllUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllUe: ", now.Sub(profilingTimers["DeleteAllUe"])) } return nil } Loading @@ -1374,7 +1380,7 @@ func (am *AssetMgr) DeleteAllUe() (err error) { // DeleteAllPoa - Delete all POA entries func (am *AssetMgr) DeleteAllPoa() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllPoa"] = time.Now() } _, err = am.db.Exec(`DELETE FROM ` + PoaTable) Loading @@ -1395,8 +1401,8 @@ func (am *AssetMgr) DeleteAllPoa() (err error) { am.notifyListener(TypePoa, AllAssets) if profiling { proFinish = time.Now() log.Debug("DeleteAllPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllPoa: ", now.Sub(profilingTimers["DeleteAllPoa"])) } return nil } Loading @@ -1404,7 +1410,7 @@ func (am *AssetMgr) DeleteAllPoa() (err error) { // DeleteAllCompute - Delete all Compute entries func (am *AssetMgr) DeleteAllCompute() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllCompute"] = time.Now() } _, err = am.db.Exec(`DELETE FROM ` + ComputeTable) Loading @@ -1417,8 +1423,8 @@ func (am *AssetMgr) DeleteAllCompute() (err error) { am.notifyListener(TypeCompute, AllAssets) if profiling { proFinish = time.Now() log.Debug("DeleteAllCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllCompute: ", now.Sub(profilingTimers["DeleteAllCompute"])) } return nil } Loading @@ -1426,7 +1432,7 @@ func (am *AssetMgr) DeleteAllCompute() (err error) { // AdvanceUePosition - Advance UE along path by provided number of increments func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error) { if profiling { proStart = time.Now() profilingTimers["AdvanceUePosition"] = time.Now() } // Set new position Loading Loading @@ -1462,8 +1468,8 @@ func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("AdvanceUePosition: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("AdvanceUePosition: ", now.Sub(profilingTimers["AdvanceUePosition"])) } return nil } Loading @@ -1471,7 +1477,7 @@ func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error // AdvanceAllUePosition - Advance all UEs along path by provided number of increments func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { if profiling { proStart = time.Now() profilingTimers["AdvanceAllUePosition"] = time.Now() } // Set new position Loading Loading @@ -1517,8 +1523,8 @@ func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { am.notifyListener(TypeUe, AllAssets) if profiling { proFinish = time.Now() log.Debug("AdvanceAllUePosition: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("AdvanceAllUePosition: ", now.Sub(profilingTimers["AdvanceAllUePosition"])) } return nil } Loading @@ -1527,6 +1533,10 @@ func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { // Recalculate UE path length & increment func (am *AssetMgr) refreshUePath(name string) (err error) { if profiling { profilingTimers["refreshUePath"] = time.Now() } query := `UPDATE ` + UeTable + ` SET path_length = ST_Length(path::geography), path_increment = path_velocity / ST_Length(path::geography), Loading @@ -1537,11 +1547,19 @@ func (am *AssetMgr) refreshUePath(name string) (err error) { log.Error(err.Error()) return err } if profiling { now := time.Now() log.Debug("- refreshUePath: ", now.Sub(profilingTimers["refreshUePath"])) } return nil } // Recalculate nearest POA & POAs in range for provided UE func (am *AssetMgr) refreshUe(name string) (err error) { if profiling { profilingTimers["refreshUe"] = time.Now() } // Initialize UE information map ueMap := make(map[string]*Ue) Loading @@ -1566,11 +1584,19 @@ func (am *AssetMgr) refreshUe(name string) (err error) { if err != nil { return err } if profiling { now := time.Now() log.Debug("- refreshUe: ", now.Sub(profilingTimers["refreshUe"])) } return nil } // Refresh UE information for all UEs func (am *AssetMgr) refreshAllUe() (err error) { if profiling { profilingTimers["refreshAllUe"] = time.Now() } // Initialize UE information map ueMap := make(map[string]*Ue) Loading @@ -1595,12 +1621,23 @@ func (am *AssetMgr) refreshAllUe() (err error) { if err != nil { return err } if profiling { now := time.Now() log.Debug("- refreshAllUe: ", now.Sub(profilingTimers["refreshAllUe"])) } return nil } // Parse UE to POA information results func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map[string]bool) (err error) { if profiling { profilingTimers["parseUePoaInfo"] = time.Now() } if profiling { profilingTimers["parseUePoaInfo-query"] = time.Now() } // Get full matrix of UE to POA information in order to perform // POA selection & UE measurement calculations var rows *sql.Rows Loading @@ -1624,6 +1661,15 @@ func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map } defer rows.Close() if profiling { now := time.Now() log.Debug("-- parseUePoaInfo-query: ", now.Sub(profilingTimers["parseUePoaInfo-query"])) } if profiling { profilingTimers["parseUePoaInfo-scan"] = time.Now() } for rows.Next() { ueName := "" poaTypePrio := []string{} Loading Loading @@ -1672,11 +1718,24 @@ func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map log.Error(err) } if profiling { now := time.Now() log.Debug("-- parseUePoaInfo-scan: ", now.Sub(profilingTimers["parseUePoaInfo-scan"])) } if profiling { now := time.Now() log.Debug("-- parseUePoaInfo: ", now.Sub(profilingTimers["parseUePoaInfo"])) } return nil } // reset UE Poa Info func (am *AssetMgr) resetUePoaInfo(name string, ueMap map[string]*Ue) (err error) { if profiling { profilingTimers["resetUePoaInfo"] = time.Now() } if name == "" { rows, err := am.db.Query(`SELECT name FROM ` + UeTable) if err != nil { Loading Loading @@ -1717,13 +1776,18 @@ func (am *AssetMgr) resetUePoaInfo(name string, ueMap map[string]*Ue) (err error ueMap[name] = ue } if profiling { now := time.Now() log.Debug("-- resetUePoaInfo: ", now.Sub(profilingTimers["resetUePoaInfo"])) } return nil } // Update all UE Poa Info func (am *AssetMgr) updateUeInfo(ueMap map[string]*Ue) (err error) { // start := time.Now() if profiling { profilingTimers["updateUeInfo"] = time.Now() } // Begin Update Transaction tx, err := am.db.Begin() Loading Loading @@ -1791,9 +1855,10 @@ func (am *AssetMgr) updateUeInfo(ueMap map[string]*Ue) (err error) { } } // finish := time.Now() // log.Error("UPDATE DURATION: ", finish.Sub(start)) if profiling { now := time.Now() log.Debug("-- updateUeInfo: ", now.Sub(profilingTimers["updateUeInfo"])) } return nil } Loading Loading
go-apps/meep-gis-engine/server/gis-automation.go +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,9 @@ func resetAutomation() { } func setAutomation(automationType string, state bool) (err error) { ge.mutex.Lock() defer ge.mutex.Unlock() // Validate automation type if _, found := ge.automation[automationType]; !found { return errors.New("Automation type not found") Loading
go-apps/meep-gis-engine/server/gis-engine.go +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ const postgisUser = "postgres" const postgisPwd = "pwd" // Enable profiling const profiling = false const profiling = true var proStart time.Time var proFinish time.Time Loading
go-packages/meep-gis-asset-mgr/asset-mgr.go +133 −68 Original line number Diff line number Diff line Loading @@ -40,10 +40,9 @@ const ( ) // Enable profiling const profiling = false const profiling = true var proStart time.Time var proFinish time.Time var profilingTimers map[string]time.Time const ( FieldPosition = "position" Loading Loading @@ -149,6 +148,13 @@ type AssetMgr struct { updateCb func(string, string) } // Profiling init func init() { if profiling { profilingTimers = make(map[string]time.Time) } } // NewAssetMgr - Creates and initializes a new GIS Asset Manager func NewAssetMgr(name, namespace, user, pwd, host, port string) (am *AssetMgr, err error) { if name == "" { Loading Loading @@ -408,7 +414,7 @@ func (am *AssetMgr) DeleteTable(tableName string) (err error) { // CreateUe - Create new UE func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreateUe"] = time.Now() } var position string Loading Loading @@ -511,8 +517,8 @@ func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{} am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("CreateUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreateUe: ", now.Sub(profilingTimers["CreateUe"])) } return nil } Loading @@ -520,7 +526,7 @@ func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{} // CreatePoa - Create new POA func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreatePoa"] = time.Now() } var subtype string Loading Loading @@ -582,8 +588,8 @@ func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{ am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("CreatePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreatePoa: ", now.Sub(profilingTimers["CreatePoa"])) } return nil } Loading @@ -591,7 +597,7 @@ func (am *AssetMgr) CreatePoa(id string, name string, data map[string]interface{ // CreateCompute - Create new Compute func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["CreateCompute"] = time.Now() } var subtype string Loading Loading @@ -645,8 +651,8 @@ func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interf am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("CreateCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("CreateCompute: ", now.Sub(profilingTimers["CreateCompute"])) } return nil } Loading @@ -654,7 +660,7 @@ func (am *AssetMgr) CreateCompute(id string, name string, data map[string]interf // UpdateUe - Update existing UE func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdateUe"] = time.Now() } // Validate input Loading Loading @@ -780,8 +786,8 @@ func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err erro am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("UpdateUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdateUe: ", now.Sub(profilingTimers["UpdateUe"])) } return nil } Loading @@ -789,7 +795,7 @@ func (am *AssetMgr) UpdateUe(name string, data map[string]interface{}) (err erro // UpdatePoa - Update existing POA func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdatePoa"] = time.Now() } // Validate input Loading Loading @@ -841,8 +847,8 @@ func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err err am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("UpdatePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdatePoa: ", now.Sub(profilingTimers["UpdatePoa"])) } return nil } Loading @@ -850,7 +856,7 @@ func (am *AssetMgr) UpdatePoa(name string, data map[string]interface{}) (err err // UpdateCompute - Update existing Compute func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err error) { if profiling { proStart = time.Now() profilingTimers["UpdateCompute"] = time.Now() } // Validate input Loading Loading @@ -901,8 +907,8 @@ func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("UpdateCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("UpdateCompute: ", now.Sub(profilingTimers["UpdateCompute"])) } return nil } Loading @@ -910,7 +916,7 @@ func (am *AssetMgr) UpdateCompute(name string, data map[string]interface{}) (err // GetUe - Get UE information func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { if profiling { proStart = time.Now() profilingTimers["GetUe"] = time.Now() } // Validate input Loading Loading @@ -979,8 +985,8 @@ func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { } if profiling { proFinish = time.Now() log.Debug("GetUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetUe: ", now.Sub(profilingTimers["GetUe"])) } return ue, nil } Loading @@ -988,7 +994,7 @@ func (am *AssetMgr) GetUe(name string) (ue *Ue, err error) { // GetPoa - Get POA information func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { if profiling { proStart = time.Now() profilingTimers["GetPoa"] = time.Now() } // Validate input Loading Loading @@ -1030,8 +1036,8 @@ func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { } if profiling { proFinish = time.Now() log.Debug("GetPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetPoa: ", now.Sub(profilingTimers["GetPoa"])) } return poa, nil } Loading @@ -1039,7 +1045,7 @@ func (am *AssetMgr) GetPoa(name string) (poa *Poa, err error) { // GetCompute - Get Compute information func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { if profiling { proStart = time.Now() profilingTimers["GetCompute"] = time.Now() } // Validate input Loading Loading @@ -1081,8 +1087,8 @@ func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { } if profiling { proFinish = time.Now() log.Debug("GetCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetCompute: ", now.Sub(profilingTimers["GetCompute"])) } return compute, nil } Loading @@ -1090,7 +1096,7 @@ func (am *AssetMgr) GetCompute(name string) (compute *Compute, err error) { // GetAllUe - Get All UE information func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllUe"] = time.Now() } // Create UE map Loading Loading @@ -1151,8 +1157,8 @@ func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { } if profiling { proFinish = time.Now() log.Debug("GetAllUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllUe: ", now.Sub(profilingTimers["GetAllUe"])) } return ueMap, nil } Loading @@ -1160,7 +1166,7 @@ func (am *AssetMgr) GetAllUe() (ueMap map[string]*Ue, err error) { // GetAllPoa - Get all POA information func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllPoa"] = time.Now() } // Create POA map Loading Loading @@ -1197,8 +1203,8 @@ func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { } if profiling { proFinish = time.Now() log.Debug("GetAllPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllPoa: ", now.Sub(profilingTimers["GetAllPoa"])) } return poaMap, nil } Loading @@ -1206,7 +1212,7 @@ func (am *AssetMgr) GetAllPoa() (poaMap map[string]*Poa, err error) { // GetAllCompute - Get all Compute information func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) { if profiling { proStart = time.Now() profilingTimers["GetAllCompute"] = time.Now() } // Create Compute map Loading Loading @@ -1243,8 +1249,8 @@ func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) } if profiling { proFinish = time.Now() log.Debug("GetAllCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("GetAllCompute: ", now.Sub(profilingTimers["GetAllCompute"])) } return computeMap, nil } Loading @@ -1252,7 +1258,7 @@ func (am *AssetMgr) GetAllCompute() (computeMap map[string]*Compute, err error) // DeleteUe - Delete UE entry func (am *AssetMgr) DeleteUe(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteUe"] = time.Now() } // Validate input Loading @@ -1271,8 +1277,8 @@ func (am *AssetMgr) DeleteUe(name string) (err error) { am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("DeleteUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteUe: ", now.Sub(profilingTimers["DeleteUe"])) } return nil } Loading @@ -1280,7 +1286,7 @@ func (am *AssetMgr) DeleteUe(name string) (err error) { // DeletePoa - Delete POA entry func (am *AssetMgr) DeletePoa(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeletePoa"] = time.Now() } // Validate input Loading @@ -1307,8 +1313,8 @@ func (am *AssetMgr) DeletePoa(name string) (err error) { am.notifyListener(TypePoa, name) if profiling { proFinish = time.Now() log.Debug("DeletePoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeletePoa: ", now.Sub(profilingTimers["DeletePoa"])) } return nil } Loading @@ -1316,7 +1322,7 @@ func (am *AssetMgr) DeletePoa(name string) (err error) { // DeleteCompute - Delete Compute entry func (am *AssetMgr) DeleteCompute(name string) (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteCompute"] = time.Now() } // Validate input Loading @@ -1335,8 +1341,8 @@ func (am *AssetMgr) DeleteCompute(name string) (err error) { am.notifyListener(TypeCompute, name) if profiling { proFinish = time.Now() log.Debug("DeleteCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteCompute: ", now.Sub(profilingTimers["DeleteCompute"])) } return nil } Loading @@ -1344,7 +1350,7 @@ func (am *AssetMgr) DeleteCompute(name string) (err error) { // DeleteAllUe - Delete all UE entries func (am *AssetMgr) DeleteAllUe() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllUe"] = time.Now() } // !!! IMPORTANT NOTE !!! Loading @@ -1365,8 +1371,8 @@ func (am *AssetMgr) DeleteAllUe() (err error) { am.notifyListener(TypeUe, "") if profiling { proFinish = time.Now() log.Debug("DeleteAllUe: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllUe: ", now.Sub(profilingTimers["DeleteAllUe"])) } return nil } Loading @@ -1374,7 +1380,7 @@ func (am *AssetMgr) DeleteAllUe() (err error) { // DeleteAllPoa - Delete all POA entries func (am *AssetMgr) DeleteAllPoa() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllPoa"] = time.Now() } _, err = am.db.Exec(`DELETE FROM ` + PoaTable) Loading @@ -1395,8 +1401,8 @@ func (am *AssetMgr) DeleteAllPoa() (err error) { am.notifyListener(TypePoa, AllAssets) if profiling { proFinish = time.Now() log.Debug("DeleteAllPoa: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllPoa: ", now.Sub(profilingTimers["DeleteAllPoa"])) } return nil } Loading @@ -1404,7 +1410,7 @@ func (am *AssetMgr) DeleteAllPoa() (err error) { // DeleteAllCompute - Delete all Compute entries func (am *AssetMgr) DeleteAllCompute() (err error) { if profiling { proStart = time.Now() profilingTimers["DeleteAllCompute"] = time.Now() } _, err = am.db.Exec(`DELETE FROM ` + ComputeTable) Loading @@ -1417,8 +1423,8 @@ func (am *AssetMgr) DeleteAllCompute() (err error) { am.notifyListener(TypeCompute, AllAssets) if profiling { proFinish = time.Now() log.Debug("DeleteAllCompute: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("DeleteAllCompute: ", now.Sub(profilingTimers["DeleteAllCompute"])) } return nil } Loading @@ -1426,7 +1432,7 @@ func (am *AssetMgr) DeleteAllCompute() (err error) { // AdvanceUePosition - Advance UE along path by provided number of increments func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error) { if profiling { proStart = time.Now() profilingTimers["AdvanceUePosition"] = time.Now() } // Set new position Loading Loading @@ -1462,8 +1468,8 @@ func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error am.notifyListener(TypeUe, name) if profiling { proFinish = time.Now() log.Debug("AdvanceUePosition: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("AdvanceUePosition: ", now.Sub(profilingTimers["AdvanceUePosition"])) } return nil } Loading @@ -1471,7 +1477,7 @@ func (am *AssetMgr) AdvanceUePosition(name string, increment float32) (err error // AdvanceAllUePosition - Advance all UEs along path by provided number of increments func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { if profiling { proStart = time.Now() profilingTimers["AdvanceAllUePosition"] = time.Now() } // Set new position Loading Loading @@ -1517,8 +1523,8 @@ func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { am.notifyListener(TypeUe, AllAssets) if profiling { proFinish = time.Now() log.Debug("AdvanceAllUePosition: ", proFinish.Sub(proStart)) now := time.Now() log.Debug("AdvanceAllUePosition: ", now.Sub(profilingTimers["AdvanceAllUePosition"])) } return nil } Loading @@ -1527,6 +1533,10 @@ func (am *AssetMgr) AdvanceAllUePosition(increment float32) (err error) { // Recalculate UE path length & increment func (am *AssetMgr) refreshUePath(name string) (err error) { if profiling { profilingTimers["refreshUePath"] = time.Now() } query := `UPDATE ` + UeTable + ` SET path_length = ST_Length(path::geography), path_increment = path_velocity / ST_Length(path::geography), Loading @@ -1537,11 +1547,19 @@ func (am *AssetMgr) refreshUePath(name string) (err error) { log.Error(err.Error()) return err } if profiling { now := time.Now() log.Debug("- refreshUePath: ", now.Sub(profilingTimers["refreshUePath"])) } return nil } // Recalculate nearest POA & POAs in range for provided UE func (am *AssetMgr) refreshUe(name string) (err error) { if profiling { profilingTimers["refreshUe"] = time.Now() } // Initialize UE information map ueMap := make(map[string]*Ue) Loading @@ -1566,11 +1584,19 @@ func (am *AssetMgr) refreshUe(name string) (err error) { if err != nil { return err } if profiling { now := time.Now() log.Debug("- refreshUe: ", now.Sub(profilingTimers["refreshUe"])) } return nil } // Refresh UE information for all UEs func (am *AssetMgr) refreshAllUe() (err error) { if profiling { profilingTimers["refreshAllUe"] = time.Now() } // Initialize UE information map ueMap := make(map[string]*Ue) Loading @@ -1595,12 +1621,23 @@ func (am *AssetMgr) refreshAllUe() (err error) { if err != nil { return err } if profiling { now := time.Now() log.Debug("- refreshAllUe: ", now.Sub(profilingTimers["refreshAllUe"])) } return nil } // Parse UE to POA information results func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map[string]bool) (err error) { if profiling { profilingTimers["parseUePoaInfo"] = time.Now() } if profiling { profilingTimers["parseUePoaInfo-query"] = time.Now() } // Get full matrix of UE to POA information in order to perform // POA selection & UE measurement calculations var rows *sql.Rows Loading @@ -1624,6 +1661,15 @@ func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map } defer rows.Close() if profiling { now := time.Now() log.Debug("-- parseUePoaInfo-query: ", now.Sub(profilingTimers["parseUePoaInfo-query"])) } if profiling { profilingTimers["parseUePoaInfo-scan"] = time.Now() } for rows.Next() { ueName := "" poaTypePrio := []string{} Loading Loading @@ -1672,11 +1718,24 @@ func (am *AssetMgr) parseUePoaInfo(name string, ueMap map[string]*Ue, poaMap map log.Error(err) } if profiling { now := time.Now() log.Debug("-- parseUePoaInfo-scan: ", now.Sub(profilingTimers["parseUePoaInfo-scan"])) } if profiling { now := time.Now() log.Debug("-- parseUePoaInfo: ", now.Sub(profilingTimers["parseUePoaInfo"])) } return nil } // reset UE Poa Info func (am *AssetMgr) resetUePoaInfo(name string, ueMap map[string]*Ue) (err error) { if profiling { profilingTimers["resetUePoaInfo"] = time.Now() } if name == "" { rows, err := am.db.Query(`SELECT name FROM ` + UeTable) if err != nil { Loading Loading @@ -1717,13 +1776,18 @@ func (am *AssetMgr) resetUePoaInfo(name string, ueMap map[string]*Ue) (err error ueMap[name] = ue } if profiling { now := time.Now() log.Debug("-- resetUePoaInfo: ", now.Sub(profilingTimers["resetUePoaInfo"])) } return nil } // Update all UE Poa Info func (am *AssetMgr) updateUeInfo(ueMap map[string]*Ue) (err error) { // start := time.Now() if profiling { profilingTimers["updateUeInfo"] = time.Now() } // Begin Update Transaction tx, err := am.db.Begin() Loading Loading @@ -1791,9 +1855,10 @@ func (am *AssetMgr) updateUeInfo(ueMap map[string]*Ue) (err error) { } } // finish := time.Now() // log.Error("UPDATE DURATION: ", finish.Sub(start)) if profiling { now := time.Now() log.Debug("-- updateUeInfo: ", now.Sub(profilingTimers["updateUeInfo"])) } return nil } Loading