MCPcopy Create free account
hub / github.com/an0nfunc/ALHP / getMemoryStats

Function getMemoryStats

utils.go:825–851  ·  view source on GitHub ↗
(pid int)

Source from the content-addressed store, hash-verified

823
824func replaceStringsFromMap(str string, replace map[string]string) string {
825 for k, v := range replace {
826 str = strings.ReplaceAll(str, k, v)
827 }
828
829 return str
830}
831
832func parseFlagSubSection(list any, res []string, replaceMap map[string]string) []string {
833 for _, cEntry := range list.([]any) {
834 switch ce := cEntry.(type) {
835 case map[any]any:
836 for k, v := range ce {
837 if v == nil {
838 res = append(res[:Find(res, k.(string))], res[Find(res, k.(string))+1:]...)
839 } else if s, ok := v.(string); ok {
840 Replace(res, k.(string), replaceStringsFromMap(s, replaceMap))
841 } else {
842 log.Warningf("malformated flag-config: unable to handle %v:%v", replaceStringsFromMap(k.(string), replaceMap), v)
843 }
844 }
845 case string:
846 res = append(res, replaceStringsFromMap(ce, replaceMap))
847 default:
848 log.Warningf("malformated flag-config: unable to handle %v (%T)", cEntry, cEntry)
849 }
850 }
851
852 return res
853}
854

Callers 1

pollMemoryUsageFunction · 0.85

Calls 1

FieldsMethod · 0.45

Tested by

no test coverage detected