@Test
  public void testP2PMembersFunctionExecutionStats() {
    Host host = Host.getHost(0);
    VM member1 = host.getVM(0);
    VM member2 = host.getVM(1);
    VM member3 = host.getVM(2);
    VM member4 = host.getVM(3);

    SerializableRunnableIF connectToDistributedSystem = () -> {
      Properties props = new Properties();
      try {
        ds = getSystem(props);
        assertNotNull(ds);
      } catch (Exception e) {
        Assert.fail("Failed while creating the Distribued System", e);
      }
    };
    member1.invoke(connectToDistributedSystem);
    member2.invoke(connectToDistributedSystem);
    member3.invoke(connectToDistributedSystem);
    member4.invoke(connectToDistributedSystem);

    member1.invoke(initializeStats);
    member2.invoke(initializeStats);
    member3.invoke(initializeStats);
    member4.invoke(initializeStats);

    final Function inlineFunction = new FunctionAdapter() {
      @Override
      public void execute(FunctionContext context) {
        @SuppressWarnings("unchecked")
        final ResultSender<String> resultSender = context.getResultSender();
        if (context.getArguments() instanceof String) {
          resultSender.lastResult("Success");
        } else {
          resultSender.lastResult("Failure");
        }
      }

      @Override
      public String getId() {
        return getClass().getName();
      }

      @Override
      public boolean hasResult() {
        return true;
      }
    };

    member1.invoke(() -> {

      assertNotNull(ds);
      DistributedMember localmember = ds.getDistributedMember();
      Execution memberExecution = FunctionService.onMember(localmember);

      memberExecution.setArguments("Key");
      try {
        ResultCollector rc = memberExecution.execute(inlineFunction);
        int size = ((List) rc.getResult()).size();
        resultReceived_Aggregate += size;
        noOfExecutionCalls_Aggregate++;
        noOfExecutionsCompleted_Aggregate++;
        resultReceived_Inline += size;
        noOfExecutionCalls_Inline++;
        noOfExecutionsCompleted_Inline++;

      } catch (Exception e) {
        logger.info("Exception Occurred : " + e.getMessage());
        e.printStackTrace();
        Assert.fail("Test failed", e);
      }
    });

    member1.invoke(() -> {
      FunctionServiceStats functionServiceStats =
          ds.getFunctionStatsManager().getFunctionServiceStats();
      waitNoFunctionsRunning(functionServiceStats);

      assertEquals(noOfExecutionCalls_Aggregate,
          functionServiceStats.getFunctionExecutionCalls());
      assertEquals(noOfExecutionsCompleted_Aggregate,
          functionServiceStats.getFunctionExecutionsCompleted());
      assertEquals(resultReceived_Aggregate, functionServiceStats.getResultsReceived());

      FunctionStats functionStats =
          FunctionStatsManager.getFunctionStats(inlineFunction.getId(), ds);
      assertEquals(noOfExecutionCalls_Inline, functionStats.getFunctionExecutionCalls());
      assertEquals(noOfExecutionsCompleted_Inline,
          functionStats.getFunctionExecutionsCompleted());
      assertEquals(resultReceived_Inline, functionStats.getResultsReceived());
    });

    SerializableRunnableIF checkFunctionExecutionStatsForOtherMember = () -> {
      FunctionServiceStats functionServiceStats =
          ds.getFunctionStatsManager().getFunctionServiceStats();
      waitNoFunctionsRunning(functionServiceStats);

      // One function Execution took place on there members
      // noOfExecutionCalls_Aggregate++;
      // noOfExecutionsCompleted_Aggregate++;
      assertEquals(noOfExecutionCalls_Aggregate,
          functionServiceStats.getFunctionExecutionCalls());
      assertEquals(noOfExecutionsCompleted_Aggregate,
          functionServiceStats.getFunctionExecutionsCompleted());

      FunctionStats functionStats =
          FunctionStatsManager.getFunctionStats(inlineFunction.getId(), ds);
      // noOfExecutionCalls_Inline++;
      // noOfExecutionsCompleted_Inline++;
      assertEquals(noOfExecutionCalls_Inline, functionStats.getFunctionExecutionCalls());
      assertEquals(noOfExecutionsCompleted_Inline,
          functionStats.getFunctionExecutionsCompleted());
    };
    member2.invoke(checkFunctionExecutionStatsForOtherMember);
    member3.invoke(checkFunctionExecutionStatsForOtherMember);
    member4.invoke(checkFunctionExecutionStatsForOtherMember);

    member1.invoke(closeDistributedSystem);
    member2.invoke(closeDistributedSystem);
    member3.invoke(closeDistributedSystem);
    member4.invoke(closeDistributedSystem);
  }
Test the execution of function on all memebers haveResults = true

member1 calls for the function executions sp the results received on memeber 1 should be equal
to the no of function execution calls. Function Execution should happen on all other members
too. so the no of function execution calls and no of function executions completed should be
equal tio the no of functions from member 1
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java