Skip to content

Commit

Permalink
REMOVE jsonV1ParseTime stuff and unneded items in ParseData type
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Aug 12, 2024
1 parent fab25cb commit eff5984
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 81 deletions.
2 changes: 0 additions & 2 deletions doc/manuals.jp/admin/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ SemWait ブロックは、メインの内部セマフォの累積待ち時間を
...
"timing": {
"accumulated": {
"jsonV1Parse": 7.860908311,
"jsonV2Parse": 120.680244446,
"mongoBackend": 12778.52734375,
"mongoReadWait": 7532.301757812,
Expand Down Expand Up @@ -142,7 +141,6 @@ SemWait ブロックは、メインの内部セマフォの累積待ち時間を
特定のカウンタは次のとおりです :

* `total` : HTTP ライブラリがリクエスト/レスポンス・ディスパッチ (擬似エンド・ツー・エンド時間) にかかる時間を除く、リクエスト全体の処理時間です
* `jsonV1Parse` : NGSIv1 JSON パース・モジュールで渡された時間です (疑似セルフタイム)
* `jsonV2Parse` : NGSIv2 JSON パース・モジュールで渡された時間です (疑似セルフタイム)
* `mongoBackend` : mongoBackend モジュールで渡された時間です (疑似セルフタイム)
* `render` : レンダリングモジュールに渡された時間です (擬似セルフタイム)
Expand Down
2 changes: 0 additions & 2 deletions doc/manuals/admin/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ Provides timing information, i.e. the time that CB passes executing in different
...
"timing": {
"accumulated": {
"jsonV1Parse": 7.860908311,
"jsonV2Parse": 120.680244446,
"mongoBackend": 12778.52734375,
"mongoReadWait": 7532.301757812,
Expand Down Expand Up @@ -158,7 +157,6 @@ The particular counters are as follows:

* `total`: processing time for the whole request, excluding the time that the HTTP library
takes for request/response dispatching (pseudo end-to-end time)
* `jsonV1Parse`: time passed in NGSIv1 JSON parsing module (pseudo self-time)
* `jsonV2Parse`: time passed in NGSIv2 JSON parsing module (pseudo self-time)
* `mongoBackend`: time passed in mongoBackend module (pseduo self-time)
* `render`: time passed in rendering module (pseudo self-time)
Expand Down
9 changes: 2 additions & 7 deletions src/lib/common/statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ inline float timeSpecToFloat(const struct timespec& t)
* xxxReqTime - the total time that the LAST request took.
* Measuring from the first MHD callback to 'connectionTreat',
* until the MHD callback to 'requestCompleted'.
* xxxJsonV1ParseTime - the time that the JSON parse+treat of the LAST request took.
* xxxJsonV2ParseTime - the time that the JSON parse+treat of the LAST request took.
* xxxMongoBackendTime - the time that the mongoBackend took to treat the last request
* xxxReadWaitTime -
Expand All @@ -129,7 +128,6 @@ std::string renderTimingStatistics(void)

timeStatSemTake(__FUNCTION__, "putting stats together");

bool accJsonV1ParseTime = (accTimeStat.jsonV1ParseTime.tv_sec != 0) || (accTimeStat.jsonV1ParseTime.tv_nsec != 0);
bool accJsonV2ParseTime = (accTimeStat.jsonV2ParseTime.tv_sec != 0) || (accTimeStat.jsonV2ParseTime.tv_nsec != 0);
bool accMongoBackendTime = (accTimeStat.mongoBackendTime.tv_sec != 0) || (accTimeStat.mongoBackendTime.tv_nsec != 0);
bool accMongoReadWaitTime = (accTimeStat.mongoReadWaitTime.tv_sec != 0) || (accTimeStat.mongoReadWaitTime.tv_nsec != 0);
Expand All @@ -142,7 +140,6 @@ std::string renderTimingStatistics(void)
bool accRenderTime = (accTimeStat.renderTime.tv_sec != 0) || (accTimeStat.renderTime.tv_nsec != 0);
bool accReqTime = (accTimeStat.reqTime.tv_sec != 0) || (accTimeStat.reqTime.tv_nsec != 0);

bool lastJsonV1ParseTime = (lastTimeStat.jsonV1ParseTime.tv_sec != 0) || (lastTimeStat.jsonV1ParseTime.tv_nsec != 0);
bool lastJsonV2ParseTime = (lastTimeStat.jsonV2ParseTime.tv_sec != 0) || (lastTimeStat.jsonV2ParseTime.tv_nsec != 0);
bool lastMongoBackendTime = (lastTimeStat.mongoBackendTime.tv_sec != 0) || (lastTimeStat.mongoBackendTime.tv_nsec != 0);
bool lastMongoReadWaitTime = (lastTimeStat.mongoReadWaitTime.tv_sec != 0) || (lastTimeStat.mongoReadWaitTime.tv_nsec != 0);
Expand All @@ -155,8 +152,8 @@ std::string renderTimingStatistics(void)
bool lastRenderTime = (lastTimeStat.renderTime.tv_sec != 0) || (lastTimeStat.renderTime.tv_nsec != 0);
bool lastReqTime = (lastTimeStat.reqTime.tv_sec != 0) || (lastTimeStat.reqTime.tv_nsec != 0);

bool last = lastJsonV1ParseTime || lastJsonV2ParseTime || lastMongoBackendTime || lastRenderTime || lastReqTime;
bool acc = accJsonV1ParseTime || accJsonV2ParseTime || accMongoBackendTime || accRenderTime || accReqTime;
bool last = lastJsonV2ParseTime || lastMongoBackendTime || lastRenderTime || lastReqTime;
bool acc = accJsonV2ParseTime || accMongoBackendTime || accRenderTime || accReqTime;

if (!acc && !last)
{
Expand All @@ -170,7 +167,6 @@ std::string renderTimingStatistics(void)
{
JsonObjectHelper accJh;

if (accJsonV1ParseTime) accJh.addNumber("jsonV1Parse", timeSpecToFloat(accTimeStat.jsonV1ParseTime));
if (accJsonV2ParseTime) accJh.addNumber("jsonV2Parse", timeSpecToFloat(accTimeStat.jsonV2ParseTime));
if (accMongoBackendTime) accJh.addNumber("mongoBackend", timeSpecToFloat(accTimeStat.mongoBackendTime));
if (accMongoReadWaitTime) accJh.addNumber("mongoReadWait", timeSpecToFloat(accTimeStat.mongoReadWaitTime));
Expand All @@ -189,7 +185,6 @@ std::string renderTimingStatistics(void)
{
JsonObjectHelper lastJh;

if (lastJsonV1ParseTime) lastJh.addNumber("jsonV1Parse", timeSpecToFloat(lastTimeStat.jsonV1ParseTime));
if (lastJsonV2ParseTime) lastJh.addNumber("jsonV2Parse", timeSpecToFloat(lastTimeStat.jsonV2ParseTime));
if (lastMongoBackendTime) lastJh.addNumber("mongoBackend", timeSpecToFloat(lastTimeStat.mongoBackendTime));
if (lastMongoReadWaitTime) lastJh.addNumber("mongoReadWait", timeSpecToFloat(lastTimeStat.mongoReadWaitTime));
Expand Down
1 change: 0 additions & 1 deletion src/lib/common/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@
*/
typedef struct TimeStat
{
struct timespec jsonV1ParseTime;
struct timespec jsonV2ParseTime;
struct timespec mongoBackendTime;
struct timespec mongoReadWaitTime;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/jsonParseV2/jsonRequestTreat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ std::string jsonRequestTreat
break;

case SubscriptionsRequest:
answer = parseSubscription(ciP, &parseDataP->subsV2);
answer = parseSubscription(ciP, &parseDataP->sub);
if (answer != "OK")
{
return answer;
}
break;

case SubscriptionRequest:
answer = parseSubscription(ciP, &parseDataP->subsV2, true); // NOTE: partial == true
answer = parseSubscription(ciP, &parseDataP->sub, true); // NOTE: partial == true
if (answer != "OK")
{
return answer;
Expand Down
59 changes: 11 additions & 48 deletions src/lib/ngsi/ParseData.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,6 @@ struct QueryContextResponseData



/* ****************************************************************************
*
* SubscribeContextData -
*/
struct SubscribeContextData
{
SubscribeContextData():entityIdP(NULL), attributeMetadataP(NULL), restrictionP(NULL), notifyConditionP(NULL), scopeP(NULL), vertexP(NULL) {}
EntityId* entityIdP;
Metadata* attributeMetadataP;
Restriction* restrictionP;
NotifyCondition* notifyConditionP;
Scope* scopeP;
orion::Point* vertexP;
};



/* ****************************************************************************
*
* NotifyContextData -
Expand Down Expand Up @@ -142,20 +125,6 @@ struct UpdateContextResponseData



/* ****************************************************************************
*
* UpdateContextSubscriptionData -
*/
struct UpdateContextSubscriptionData
{
UpdateContextSubscriptionData(): notifyConditionP(NULL), scopeP(NULL), vertexP(NULL) {}
NotifyCondition* notifyConditionP;
Scope* scopeP;
orion::Point* vertexP;
};



/* ****************************************************************************
*
* EntityData -
Expand Down Expand Up @@ -214,32 +183,26 @@ typedef struct BatchUpdateData
*
* ParseData -
*
* FIXME PR: review this list
*/
typedef struct ParseData
{
ParseData(): lastContextAttribute(NULL) { }

std::string errorString;
ContextAttribute* lastContextAttribute;

QueryContextData qcr;
SubscribeContextData scr;
UpdateContextData upcr;
UpdateContextSubscriptionData ucsr;
NotifyContextData ncr;

QueryContextResponseData qcrs;
UpdateContextResponseData upcrs;

// filled by jsonRequestTreat() function in jsonRequestTreat.cpp
EntityData ent;
AttributeData attr;
AttributeValueData av;
BatchQueryData bq;
BatchUpdateData bu;

ngsiv2::SubscriptionUpdate subsV2;
ngsiv2::SubscriptionUpdate sub;
ngsiv2::Registration reg;
NotifyContextData ncr;

// Used in postQueryContext() function for the forwarding logic
QueryContextData qcr;
QueryContextResponseData qcrs;

// Used in postUpdateContext() function for the forwarding logic
UpdateContextData upcr;
UpdateContextResponseData upcrs;
} ParseData;

#endif // SRC_LIB_NGSI_PARSEDATA_H_
13 changes: 0 additions & 13 deletions src/lib/parse/compoundValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ void compoundValueEnd(ConnectionInfo* ciP, ParseData* parseDataP)
alarmMgr.badInput(clientIp, ciP->answer);
}

//
// Give the root pointer of this Compound to the active ContextAttribute
// lastContextAttribute is set in the JSON v1 parsing routines, to point at the
// latest contextAttribute, i.e. the attribute whose 'contextValue' is the
// owner of this compound value tree.
//

LM_T(LmtCompoundValue, ("Set compoundValueP (%p) for attribute at %p",
ciP->compoundValueRoot,
parseDataP->lastContextAttribute));

parseDataP->lastContextAttribute->compoundValueP = ciP->compoundValueRoot;

// Reset the Compound stuff in ConnectionInfo
ciP->compoundValueRoot = NULL;
ciP->compoundValueP = NULL;
Expand Down
1 change: 0 additions & 1 deletion src/lib/rest/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ static void requestCompleted
clock_subtime(&threadLastTimeStat.mongoBackendTime, &threadLastTimeStat.mongoWriteWaitTime);
clock_subtime(&threadLastTimeStat.mongoBackendTime, &threadLastTimeStat.mongoCommandWaitTime);

clock_addtime(&accTimeStat.jsonV1ParseTime, &threadLastTimeStat.jsonV1ParseTime);
clock_addtime(&accTimeStat.jsonV2ParseTime, &threadLastTimeStat.jsonV2ParseTime);
clock_addtime(&accTimeStat.mongoBackendTime, &threadLastTimeStat.mongoBackendTime);
clock_addtime(&accTimeStat.mongoWriteWaitTime, &threadLastTimeStat.mongoWriteWaitTime);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/serviceRoutinesV2/patchSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::string patchSubscription
{
std::string subscriptionId = compV[2];
// 'Fill In' SusbcriptionUpdate
parseDataP->subsV2.id = subscriptionId;
parseDataP->sub.id = subscriptionId;


OrionError beError;
Expand All @@ -67,7 +67,7 @@ std::string patchSubscription
// jsonParseV2/parseSubscription.cpp, function parseNotifyConditionVector() and
// the resulting StringFilter object resides in a Scope in parseDataP->subsV2.restriction.scopeVector
//
TIMED_MONGO(mongoUpdateSubscription(parseDataP->subsV2,
TIMED_MONGO(mongoUpdateSubscription(parseDataP->sub,
&beError,
ciP->tenant,
ciP->servicePathV));
Expand All @@ -84,7 +84,7 @@ std::string patchSubscription
}

// free sub memory associated to subscriptions
parseDataP->subsV2.release();
parseDataP->sub.release();

return answer;
}
4 changes: 2 additions & 2 deletions src/lib/serviceRoutinesV2/postSubscriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern std::string postSubscriptions
std::string subsID;

TIMED_MONGO(subsID = mongoCreateSubscription(
parseDataP->subsV2,
parseDataP->sub,
&beError,
ciP->tenant,
ciP->servicePathV));
Expand All @@ -96,7 +96,7 @@ extern std::string postSubscriptions
}

// free sub memory associated to subscriptions
parseDataP->subsV2.release();
parseDataP->sub.release();

return answer;
}

0 comments on commit eff5984

Please sign in to comment.