LCOV - code coverage report
Current view: top level - media/client/ipc/include - PrivateMetricsIpc.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-09-11 17:36:12 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :  * If not stated otherwise in this file or this component's LICENSE file the
       3              :  * following copyright and licenses apply:
       4              :  *
       5              :  * Copyright 2026 Sky UK
       6              :  *
       7              :  * Licensed under the Apache License, Version 2.0 (the "License");
       8              :  * you may not use this file except in compliance with the License.
       9              :  * You may obtain a copy of the License at
      10              :  *
      11              :  * http://www.apache.org/licenses/LICENSE-2.0
      12              :  *
      13              :  * Unless required by applicable law or agreed to in writing, software
      14              :  * distributed under the License is distributed on an "AS IS" BASIS,
      15              :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      16              :  * See the License for the specific language governing permissions and
      17              :  * limitations under the License.
      18              :  */
      19              : 
      20              : #ifndef FIREBOLT_RIALTO_CLIENT_PRIVATE_METRICS_IPC_H_
      21              : #define FIREBOLT_RIALTO_CLIENT_PRIVATE_METRICS_IPC_H_
      22              : 
      23              : #include "IEventThread.h"
      24              : #include "IPrivateMetricsIpc.h"
      25              : #include "IpcModule.h"
      26              : #include "privatemetricsmodule.pb.h"
      27              : #include <memory>
      28              : #include <string>
      29              : 
      30              : namespace firebolt::rialto::client
      31              : {
      32              : class PrivateMetricsIpcFactory : public IPrivateMetricsIpcFactory
      33              : {
      34              : public:
      35            1 :     PrivateMetricsIpcFactory() = default;
      36            1 :     ~PrivateMetricsIpcFactory() override = default;
      37              : 
      38              :     std::shared_ptr<IPrivateMetricsIpc> createPrivateMetricsIpc(IPrivateMetricsIpcClient *client) override;
      39              : 
      40              :     static std::shared_ptr<PrivateMetricsIpcFactory> createFactory();
      41              : };
      42              : 
      43              : class PrivateMetricsIpc : public IPrivateMetricsIpc, public IpcModule
      44              : {
      45              : public:
      46              :     PrivateMetricsIpc(IPrivateMetricsIpcClient *client, IIpcClient &ipcClient,
      47              :                       const std::shared_ptr<common::IEventThreadFactory> &eventThreadFactory);
      48              :     ~PrivateMetricsIpc() override;
      49              : 
      50              :     bool reportClientMetrics(std::uint64_t sampleId, std::uint32_t reason, const std::string &appName,
      51              :                              std::uint32_t processId, std::uint64_t monotonicTimeMs, std::uint64_t epochTimeMs,
      52              :                              std::uint64_t processCpuTimeMs, std::uint64_t processMemoryKb) override;
      53              : 
      54              : private:
      55              :     bool notifyClientReady();
      56              :     bool createRpcStubs(const std::shared_ptr<ipc::IChannel> &ipcChannel) override;
      57              :     bool subscribeToEvents(const std::shared_ptr<ipc::IChannel> &ipcChannel) override;
      58              :     void onMetricsSampleRequested(const std::shared_ptr<firebolt::rialto::MetricsSampleRequestEvent> &event);
      59              : 
      60              : private:
      61              :     IPrivateMetricsIpcClient *m_privateMetricsIpcClient;
      62              :     std::unique_ptr<common::IEventThread> m_eventThread;
      63              :     std::shared_ptr<::firebolt::rialto::PrivateMetricsModule_Stub> m_privateMetricsStub;
      64              : };
      65              : } // namespace firebolt::rialto::client
      66              : 
      67              : #endif // FIREBOLT_RIALTO_CLIENT_PRIVATE_METRICS_IPC_H_
        

Generated by: LCOV version 2.0-1