Arcane  v3.14.11.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
TestStat.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#include <gtest/gtest.h>
8
9#include "arccore/message_passing/Stat.h"
10
11using namespace Arccore;
12using namespace Arccore::MessagePassing;
13
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17TEST(MessagePassing, OneStat)
18{
19 String name1("Message1");
20 const Int64 message_size1 = 324;
21 const double message_time1 = 1.2;
22 const Int64 message_size2 = 1923;
23 const double message_time2 = 4.5;
24
25 {
26 OneStat stat1(name1);
27 ASSERT_EQ(stat1.name(), name1);
28 }
29 {
30 OneStat stat1(name1, message_size1, message_time1);
31 ASSERT_EQ(stat1.name(), name1);
32 ASSERT_EQ(stat1.nbMessage(), 0);
33 ASSERT_EQ(stat1.totalSize(), message_size1);
34 ASSERT_EQ(stat1.totalTime(), message_time1);
35 }
36 {
37 OneStat stat1(name1);
38
39 stat1.addMessage(message_size1, message_time1);
40 ASSERT_EQ(stat1.nbMessage(), 1);
41 ASSERT_EQ(stat1.totalSize(), message_size1);
42 ASSERT_EQ(stat1.totalTime(), message_time1);
43 ASSERT_EQ(stat1.cumulativeNbMessage(), 1);
44 ASSERT_EQ(stat1.cumulativeTotalSize(), message_size1);
45 ASSERT_EQ(stat1.cumulativeTotalTime(), message_time1);
46
47 stat1.resetCurrentStat();
48
49 ASSERT_EQ(stat1.nbMessage(), 0);
50 ASSERT_EQ(stat1.totalSize(), 0);
51 ASSERT_EQ(stat1.totalTime(), 0);
52 ASSERT_EQ(stat1.cumulativeNbMessage(), 1);
53 ASSERT_EQ(stat1.cumulativeTotalSize(), message_size1);
54 ASSERT_EQ(stat1.cumulativeTotalTime(), message_time1);
55
56 stat1.addMessage(message_size2, message_time2);
57
58 ASSERT_EQ(stat1.nbMessage(), 1);
59 ASSERT_EQ(stat1.totalSize(), message_size2);
60 ASSERT_EQ(stat1.totalTime(), message_time2);
61 ASSERT_EQ(stat1.cumulativeNbMessage(), 2);
62 ASSERT_EQ(stat1.cumulativeTotalSize(), message_size1 + message_size2);
63 ASSERT_EQ(stat1.cumulativeTotalTime(), message_time1 + message_time2);
64
65 stat1.print(std::cout);
66 }
67
68 {
69 OneStat stat1(name1);
70
71 stat1.setNbMessage(3);
72 ASSERT_EQ(stat1.nbMessage(), 3);
73
74 stat1.setTotalSize(message_size1);
75 ASSERT_EQ(stat1.totalSize(), message_size1);
76
77 stat1.setTotalTime(message_time1);
78 ASSERT_EQ(stat1.totalTime(), message_time1);
79
80 stat1.setCumulativeNbMessage(25);
81 ASSERT_EQ(stat1.cumulativeNbMessage(), 25);
82
83 stat1.setCumulativeTotalSize(message_size2);
84 ASSERT_EQ(stat1.cumulativeTotalSize(), message_size2);
85
86 stat1.setCumulativeTotalTime(message_time2);
87 ASSERT_EQ(stat1.cumulativeTotalTime(), message_time2);
88 }
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Chaîne de caractères unicode.
Espace de nommage contenant les types et déclarations qui gèrent le mécanisme de parallélisme par éch...
Espace de nom de Arccore.
Definition ArcaneTypes.h:24