<commit_before>/*
 * Copyright 2014 Real Logic 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.
 */
package uk.co.real_logic.aeron.driver;

import uk.co.real_logic.aeron.common.concurrent.AtomicCounter;
import uk.co.real_logic.aeron.common.concurrent.CountersManager;

public class SystemCounters implements AutoCloseable
{
    private final AtomicCounter receiverProxyFails;
    private final AtomicCounter senderProxyFails;
    private final AtomicCounter naksSent;
    private final AtomicCounter naksReceived;
    private final AtomicCounter retransmitsSent;
    private final AtomicCounter statusMessagesSent;
    private final AtomicCounter statusMessagesReceived;
    private final AtomicCounter heartbeatsSent;
    private final AtomicCounter flowControlUnderRuns;
    private final AtomicCounter flowControlOverRuns;
    private final AtomicCounter subscriptionCleaningLate;
    private final AtomicCounter invalidPackets;

    public SystemCounters(final CountersManager countersManager)
    {
        receiverProxyFails = countersManager.newCounter("Failed offers to ReceiverProxy");
        senderProxyFails = countersManager.newCounter("Failed offers to SenderProxy");
        naksSent = countersManager.newCounter("NAKs sent");
        naksReceived = countersManager.newCounter("NAKs received");
        statusMessagesSent = countersManager.newCounter("SMs sent");
        statusMessagesReceived = countersManager.newCounter("SMs received");
        heartbeatsSent = countersManager.newCounter("Heartbeats sent");
        retransmitsSent = countersManager.newCounter("Retransmits sent");
        flowControlUnderRuns = countersManager.newCounter("Flow control under runs");
        flowControlOverRuns = countersManager.newCounter("Flow control over runs");
        subscriptionCleaningLate = countersManager.newCounter("Subscription cleaning late");
        invalidPackets = countersManager.newCounter("Invalid packet");
    }

    public void close()
    {
        receiverProxyFails.close();
        senderProxyFails.close();
        naksSent.close();
        naksReceived.close();
        statusMessagesSent.close();
        statusMessagesReceived.close();
        heartbeatsSent.close();
        retransmitsSent.close();
        flowControlUnderRuns.close();
        flowControlOverRuns.close();
        subscriptionCleaningLate.close();
        invalidPackets.close();
    }

    public AtomicCounter receiverProxyFails()
    {
        return receiverProxyFails;
    }

    public AtomicCounter senderProxyFails()
    {
        return senderProxyFails;
    }

    public AtomicCounter naksSent()
    {
        return naksSent;
    }

    public AtomicCounter naksReceived()
    {
        return naksReceived;
    }

    public AtomicCounter retransmitsSent()
    {
        return retransmitsSent;
    }

    public AtomicCounter statusMessagesSent()
    {
        return statusMessagesSent;
    }

    public AtomicCounter statusMessagesReceived()
    {
        return statusMessagesReceived;
    }

    public AtomicCounter heartbeatsSent()
    {
        return heartbeatsSent;
    }

    public AtomicCounter flowControlUnderRuns()
    {
        return flowControlOverRuns;<commit_msg>[Java]: fixed system counters return of underrun counter to return underrun and not overrun.<commit_after>/*
 * Copyright 2014 Real Logic 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.
 */
package uk.co.real_logic.aeron.driver;

import uk.co.real_logic.aeron.common.concurrent.AtomicCounter;
import uk.co.real_logic.aeron.common.concurrent.CountersManager;

public class SystemCounters implements AutoCloseable
{
    private final AtomicCounter receiverProxyFails;
    private final AtomicCounter senderProxyFails;
    private final AtomicCounter naksSent;
    private final AtomicCounter naksReceived;
    private final AtomicCounter retransmitsSent;
    private final AtomicCounter statusMessagesSent;
    private final AtomicCounter statusMessagesReceived;
    private final AtomicCounter heartbeatsSent;
    private final AtomicCounter flowControlUnderRuns;
    private final AtomicCounter flowControlOverRuns;
    private final AtomicCounter subscriptionCleaningLate;
    private final AtomicCounter invalidPackets;

    public SystemCounters(final CountersManager countersManager)
    {
        receiverProxyFails = countersManager.newCounter("Failed offers to ReceiverProxy");
        senderProxyFails = countersManager.newCounter("Failed offers to SenderProxy");
        naksSent = countersManager.newCounter("NAKs sent");
        naksReceived = countersManager.newCounter("NAKs received");
        statusMessagesSent = countersManager.newCounter("SMs sent");
        statusMessagesReceived = countersManager.newCounter("SMs received");
        heartbeatsSent = countersManager.newCounter("Heartbeats sent");
        retransmitsSent = countersManager.newCounter("Retransmits sent");
        flowControlUnderRuns = countersManager.newCounter("Flow control under runs");
        flowControlOverRuns = countersManager.newCounter("Flow control over runs");
        subscriptionCleaningLate = countersManager.newCounter("Subscription cleaning late");
        invalidPackets = countersManager.newCounter("Invalid packet");
    }

    public void close()
    {
        receiverProxyFails.close();
        senderProxyFails.close();
        naksSent.close();
        naksReceived.close();
        statusMessagesSent.close();
        statusMessagesReceived.close();
        heartbeatsSent.close();
        retransmitsSent.close();
        flowControlUnderRuns.close();
        flowControlOverRuns.close();
        subscriptionCleaningLate.close();
        invalidPackets.close();
    }

    public AtomicCounter receiverProxyFails()
    {
        return receiverProxyFails;
    }

    public AtomicCounter senderProxyFails()
    {
        return senderProxyFails;
    }

    public AtomicCounter naksSent()
    {
        return naksSent;
    }

    public AtomicCounter naksReceived()
    {
        return naksReceived;
    }

    public AtomicCounter retransmitsSent()
    {
        return retransmitsSent;
    }

    public AtomicCounter statusMessagesSent()
    {
        return statusMessagesSent;
    }

    public AtomicCounter statusMessagesReceived()
    {
        return statusMessagesReceived;
    }

    public AtomicCounter heartbeatsSent()
    {
        return heartbeatsSent;
    }

    public AtomicCounter flowControlUnderRuns()
    {
        return flowControlUnderRuns;
{'fraction_non_alphanumeric': 0.07000266169816342, 'fraction_numerical': 0.002129358530742614, 'mean_word_length': 3.535304767652384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3405438', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1832, 'n_words': 516}