Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
64479dc
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 11, 2025
048645a
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
3f6710a
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
662566e
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
057dbf8
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
22a6a30
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 14, 2025
f577617
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 16, 2025
ce35399
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 16, 2025
c40183f
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
428cdac
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
c77b2d1
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
ba551d0
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
c4dd1ed
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
5270ab8
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
5ea1271
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
de54ae6
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 19, 2025
0c36239
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
e4a9887
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
d5c0719
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
2c15657
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
bf830f8
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 11, 2025
f4df92d
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
35afe0f
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
c3ecf80
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
1e918e4
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 13, 2025
d52f1bd
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 14, 2025
d9bd557
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 16, 2025
fb047a6
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 16, 2025
2851ea9
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
f5c27e0
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
0465564
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
52f5496
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
84ff0e7
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
a48d071
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
2c508aa
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 17, 2025
2d931de
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 19, 2025
4c11480
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
8fde6f5
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
1835d8c
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
809a8a4
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 20, 2025
d0f4e3e
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 21, 2025
f9cc20c
Merge branch 'topic/RDK-59221' of https://github.com/rdkcentral/telem…
Oct 21, 2025
4b9f9e9
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 21, 2025
8121226
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 21, 2025
9dd963f
Merge branch 'develop' into topic/RDK-59221
yogeswaransky Oct 23, 2025
a76b842
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 23, 2025
ffd9ba9
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 23, 2025
f3019c8
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 23, 2025
349cd40
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 24, 2025
deb8000
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 24, 2025
aaf2dc7
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 24, 2025
07a00e3
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 26, 2025
ba345af
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 26, 2025
6553740
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 26, 2025
f49bc24
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
2af8435
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
d4e9dce
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
bf1048c
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
c0cf119
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
baab429
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
8ce7f79
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
8c5c787
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 27, 2025
b012896
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
f514792
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
7216b7e
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
d922624
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
db36d61
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
a344cbb
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
9b4ec46
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
b99a192
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
23bfc19
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Pr…
Oct 28, 2025
a49db01
Merge branch 'develop' into topic/RDK-59221
shibu-kv Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions source/bulkdata/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,25 +452,22 @@ static void* CollectAndReport(void* data)
}
if(profile->topMarkerList != NULL && Vector_Size(profile->topMarkerList) > 0)
{
Vector *topMarkerResultList = NULL;
Vector_Create(&topMarkerResultList);
processTopPattern(profile->name, profile->topMarkerList, topMarkerResultList, 0);
long int reportSize = Vector_Size(topMarkerResultList);
processTopPattern(profile->name, profile->topMarkerList, 0);
long int reportSize = Vector_Size(profile->topMarkerList);
if(reportSize != 0)
{
T2Info("Top markers report is compleated report size %ld\n", (unsigned long)reportSize);
encodeGrepResultInJSON(valArray, topMarkerResultList);
T2Info("Top markers report is completed report size %ld\n", (unsigned long)reportSize);
encodeGrepResultInJSON(valArray, profile->topMarkerList);
}
else
{
T2Debug("Top markers report generated but is empty possabliy the memory value is changed");
}
Vector_Destroy(topMarkerResultList, freeGResult);
}
if(profile->gMarkerList != NULL && Vector_Size(profile->gMarkerList) > 0)
{
getGrepResults(&(profile->grepSeekProfile), profile->gMarkerList, &grepResultList, profile->bClearSeekMap, false, customLogPath); // Passing 5th argument as false so that it doesn't check rotated logs for the first reporting after bootup for multiprofiles.
encodeGrepResultInJSON(valArray, grepResultList);
encodeGrepResultInJSON(valArray, profile->gMarkerList);
Vector_Destroy(grepResultList, freeGResult);
}
if(profile->eMarkerList != NULL && Vector_Size(profile->eMarkerList) > 0)
Expand Down
325 changes: 152 additions & 173 deletions source/bulkdata/profilexconf.c

Large diffs are not rendered by default.

173 changes: 145 additions & 28 deletions source/dcautil/dca.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ static pthread_mutex_t dcaMutex = PTHREAD_MUTEX_INITIALIZER;
* @return Returns the status of the operation.
* @retval Returns zero on success, appropriate errorcode otherwise.
*/
int processTopPattern(char* profileName, Vector* topMarkerList, Vector* out_grepResultList, int profileExecCounter)
int processTopPattern(char* profileName, Vector* topMarkerList, int profileExecCounter)
{
T2Debug("%s ++in\n", __FUNCTION__);
if(profileName == NULL || topMarkerList == NULL || out_grepResultList == NULL)
if(profileName == NULL || topMarkerList == NULL)
{
T2Error("Invalid arguments for %s\n", __FUNCTION__);
return -1;
Expand Down Expand Up @@ -241,14 +241,14 @@ int processTopPattern(char* profileName, Vector* topMarkerList, Vector* out_gre

if (strcmp(grepMarkerObj->markerName, "Load_Average") == 0) // This block is for device level load average
{
if (0 == getLoadAvg(out_grepResultList, grepMarkerObj->trimParam, grepMarkerObj->regexParam))
if (0 == getLoadAvg(grepMarkerObj, grepMarkerObj->trimParam, grepMarkerObj->regexParam))
{
T2Debug("getLoadAvg() Failed with error");
}
}
else
{
getProcUsage(grepMarkerObj->searchString, out_grepResultList, grepMarkerObj->trimParam, grepMarkerObj->regexParam, filename);
getProcUsage(grepMarkerObj->searchString, grepMarkerObj, grepMarkerObj->trimParam, grepMarkerObj->regexParam, filename);
}

}
Expand Down Expand Up @@ -399,15 +399,16 @@ static inline void formatCount(char* buffer, size_t size, int count)
snprintf(buffer, size, "%d", count);
}

static int getCountPatternMatch(FileDescriptor* fileDescriptor, const char* pattern)
static int getCountPatternMatch(FileDescriptor* fileDescriptor, GrepMarker* marker)
{
T2Debug("%s ++in\n", __FUNCTION__);
if (!fileDescriptor || !fileDescriptor->cfaddr || !pattern || !*pattern || fileDescriptor->cf_map_size <= 0)
if (!fileDescriptor || !fileDescriptor->cfaddr || !marker || !marker->searchString || fileDescriptor->cf_map_size <= 0)
{
T2Error("Invalid file descriptor arguments pattern match\n");
return -1; // Invalid arguments
}

const char* pattern = marker->searchString;
const char* buffer;
size_t buflen = 0;
size_t patlen = strlen(pattern);
Expand Down Expand Up @@ -457,20 +458,23 @@ static int getCountPatternMatch(FileDescriptor* fileDescriptor, const char* patt
}

}
T2Debug("count is %d\n", count);

// Using the union instead of the previous out list.
marker->u.count = count;
T2Debug("%s --out\n", __FUNCTION__);
return count;
return 0;
}

static char* getAbsolutePatternMatch(FileDescriptor* fileDescriptor, const char* pattern)
static int getAbsolutePatternMatch(FileDescriptor* fileDescriptor, GrepMarker* marker)
{
T2Debug("%s ++in\n", __FUNCTION__);
if (!fileDescriptor || !fileDescriptor->cfaddr || fileDescriptor->cf_map_size <= 0 || !pattern || !*pattern)
if (!fileDescriptor || !fileDescriptor->cfaddr || fileDescriptor->cf_map_size <= 0 || !marker || !marker->searchString)
{
T2Error("Invalid file descriptor arguments absolute\n");
return NULL;
return -1;
}

const char* pattern = marker->searchString;
const char* buffer;
size_t buflen = 0;
size_t patlen = strlen(pattern);
Expand Down Expand Up @@ -526,8 +530,10 @@ static char* getAbsolutePatternMatch(FileDescriptor* fileDescriptor, const char*

if(!last_found)
{
return NULL;
marker->u.markerValue = NULL;
return 0;
}

// Move pointer just after the pattern
const char *start = last_found + patlen;
size_t chars_left = buflen - (start - buffer);
Expand All @@ -539,15 +545,120 @@ static char* getAbsolutePatternMatch(FileDescriptor* fileDescriptor, const char*
char *result = (char*)malloc(length + 1);
if (!result)
{
return NULL;
marker->u.markerValue = NULL;
return -1;
}
memcpy(result, start, length);
result[length] = '\0';

marker->u.markerValue = result;
T2Debug("%s --out\n", __FUNCTION__);
return 0;
}

static int getAccumulatePatternMatch(FileDescriptor* fileDescriptor, GrepMarker* marker, Vector* out_grepResultList)
{
T2Info("%s ++in", __FUNCTION__);
if (!fileDescriptor || !fileDescriptor->cfaddr || fileDescriptor->cf_file_size <= 0 || !marker || !marker->searchString || !*marker->searchString || !out_grepResultList)
{
T2Error("Invalid file descriptor arguments accumulate\n");
return -1;
}

const char* pattern = marker->searchString;
const char* buffer;
size_t buflen = 0;
size_t patlen = strlen(pattern);

// Using the existing accumulatedValues Vector from marker's union
Vector* accumulatedValues = marker->u.accumulatedValues;
if (!accumulatedValues)
{
T2Error("accumulatedValues vector is NULL in marker\n");
return -1;
}

for (int i = 0; i < 2; i++)
{
T2Info("%s %d \n", __FUNCTION__, __LINE__);
if (i == 0)
{
buffer = fileDescriptor->cfaddr;
buflen = (size_t)fileDescriptor->cf_file_size;
}
else
{
buffer = fileDescriptor->rfaddr;
buflen = (size_t)fileDescriptor->rf_file_size;
}

if (buffer == NULL)
{
T2Info("Invalid file descriptor arguments accumulate match\n");
continue;
}

const char *cur = buffer;
size_t bytes_left = buflen;

while (bytes_left >= patlen)
{
T2Info("%s %d \n", __FUNCTION__, __LINE__);
const char *found = strnstr(cur, pattern, bytes_left);
if (!found)
{
break;
}

// Move pointer just after the pattern
const char *start = found + patlen;
size_t chars_left = buflen - (start - buffer);

// Find next newline or end of buffer
const char *end = memchr(start, '\n', chars_left);
size_t length = end ? (size_t)(end - start) : chars_left;

// Create result string for this occurrence
char *result = (char*)malloc(length + 1);
if (result)
{
memcpy(result, start, length);
result[length] = '\0';
T2Info("%s %d : result = %s\n", __FUNCTION__, __LINE__, result);
Vector_PushBack(accumulatedValues, result);
}

size_t advance = (size_t)(found - cur) + patlen;
cur = found + patlen;
if (bytes_left < advance)
{
break;
}
bytes_left -= advance;
}
T2Info("%s %d --out\n", __FUNCTION__, __LINE__);
}

// Create individual GrepResult objects for each accumulated value
size_t accumulatedCount = Vector_Size(accumulatedValues);
for (size_t j = 0; j < accumulatedCount; j++)
{
char* value = (char*)Vector_At(accumulatedValues, j);
if (value)
{
GrepResult* result = createGrepResultObj(marker->markerName, value, marker->trimParam, marker->regexParam);
if (result)
{
Vector_PushBack(out_grepResultList, result);
}
}
}

T2Debug("%s --out\n", __FUNCTION__);
return result;
return 0;
}

static int processPatternWithOptimizedFunction(const GrepMarker* marker, Vector* out_grepResultList, FileDescriptor* filedescriptor)
static int processPatternWithOptimizedFunction(GrepMarker* marker, Vector* out_grepResultList, FileDescriptor* filedescriptor)
{
// Sanitize the input
const char* memmmapped_data_cf = filedescriptor->cfaddr;
Expand All @@ -557,18 +668,18 @@ static int processPatternWithOptimizedFunction(const GrepMarker* marker, Vector*
return -1;
}
// Extract the pattern and other parameters from the marker
const char* pattern = marker->searchString;
//const char* pattern = marker->searchString;
bool trimParameter = marker->trimParam;
char* regexParameter = marker->regexParam;
char* header = marker->markerName;
int count = 0;
char* last_found = NULL;
MarkerType mType = marker->mType;

if (mType == MTYPE_COUNTER)
{
// Count the number of occurrences of the pattern in the memory-mapped data
count = getCountPatternMatch(filedescriptor, pattern);
getCountPatternMatch(filedescriptor, marker);
count = marker->u.count;
if (count > 0)
{
// If matches are found, process them accordingly
Expand All @@ -583,26 +694,32 @@ static int processPatternWithOptimizedFunction(const GrepMarker* marker, Vector*
Vector_PushBack(out_grepResultList, result);
}
}
else
else if (mType == MTYPE_ACCUMULATE)
{
//Get MAX_ACCUMULATE number of occurrences of the pattern in the memory-mapped data
T2Info("%s %d : Accumulate is called\n", __FUNCTION__, __LINE__);
getAccumulatePatternMatch(filedescriptor, marker, out_grepResultList); //TO DO: Add limit of 20
T2Info("%s %d : Accumulate is complete\n", __FUNCTION__, __LINE__);
}
else /* MTYPE_ABSOLUTE */
{
// Get the last occurrence of the pattern in the memory-mapped data
last_found = getAbsolutePatternMatch(filedescriptor, pattern);
if (last_found)
getAbsolutePatternMatch(filedescriptor, marker);
#if 0
if (marker->u.markerValue)
{
// If a match is found, process it accordingly
GrepResult* result = createGrepResultObj(header, last_found, trimParameter, regexParameter);
if(last_found)
{
free(last_found);
last_found = NULL;
}
GrepResult* result = createGrepResultObj(header, marker->u.markerValue, trimParameter, regexParameter);
free(marker->u.markerValue);
marker->u.markerValue = NULL;
if (result == NULL)
{
T2Error("Failed to create GrepResult\n");
return -1;
}
Vector_PushBack(out_grepResultList, result);
}
#endif
}
return 0;
}
Expand Down Expand Up @@ -655,7 +772,7 @@ static int getLogFileDescriptor(GrepSeekProfile* gsProfile, const char* logPath,
// Check if the file size matches the seek value from the map
if (sb.st_size == seek_value_from_map)
{
T2Debug("The logfile size matches the seek value (%ld) for %s\n", seek_value_from_map, logFile);
T2Info("The logfile size matches the seek value (%ld) for %s\n", seek_value_from_map, logFile);
close(fd);
return -1; // Consistent error return value
}
Expand Down
2 changes: 1 addition & 1 deletion source/dcautil/dca.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ int getDCAResultsInVector(GrepSeekProfile *gSeekProfile, Vector* vectorMarkerLis

void T2InitProperties(); // declaration for initProperties

int processTopPattern(char* profileName, Vector* topMarkerList, Vector* out_grepResultList, int execCount);
int processTopPattern(char* profileName, Vector* topMarkerList, int execCount);

#endif /* SRC_DCA_H_ */
Loading
Loading