Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc/compare: kill dead code
[simgrid.git] / src / mc / mc_hash.cpp
1 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <cinttypes>
7 #include <cstdint>
8
9 #include "xbt/log.h"
10
11 #include "mc/datatypes.h"
12 #include "src/mc/mc_hash.hpp"
13 #include "src/mc/mc_private.hpp"
14 #include "src/mc/sosp/Snapshot.hpp"
15 #include <mc/mc.h>
16
17 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_hash, mc, "Logging specific to mc_hash");
18
19 namespace simgrid {
20 namespace mc {
21
22 namespace {
23
24 class djb_hash {
25   hash_type state_ = 5381LL;
26
27 public:
28   template<class T>
29   void update(T& x)
30   {
31     state_ = (state_ << 5) + state_ + x;
32   }
33   hash_type value()
34   {
35     return state_;
36   }
37 };
38
39 }
40
41 hash_type hash(Snapshot const& snapshot)
42 {
43   XBT_DEBUG("START hash %i", snapshot.num_state_);
44   djb_hash hash;
45   // TODO:
46   // * nb_processes
47   // * heap_bytes_used
48   // * root variables
49   // * basic stack frame information
50   // * stack frame local variables
51   XBT_DEBUG("END hash %i", snapshot.num_state_);
52   return hash.value();
53 }
54
55 }
56 }