* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BY_TRACE_H
#define BY_TRACE_H
#include "common.h"
namespace OHOS {
namespace SmartPerf {
class ByTrace {
public:
static ByTrace &GetInstance()
{
static ByTrace instance;
return instance;
}
void SetTraceConfig(int mSum, int mInterval, long long mThreshold) const;
void ThreadGetTrace() const;
void ThreadEndTrace() const;
void ThreadFinishTrace(const std::string &pathName) const;
TraceStatus CheckFpsJitters(std::vector<long long> jitters);
void TriggerCatch(long long curTime) const;
private:
ByTrace() {};
ByTrace(const ByTrace &);
ByTrace &operator = (const ByTrace &);
mutable int sum = 2;
mutable int curNum = 0;
mutable int interval = 60000;
mutable int cost = 10000;
mutable long long threshold = 100;
mutable long long lastTriggerTime = -1;
mutable long long curTriggerFlag = -1;
};
}
}
#endif