|
Packit |
6d2c1b |
/*
|
|
Packit |
6d2c1b |
* Copyright (c) 2001-2020 Mellanox Technologies, Ltd. All rights reserved.
|
|
Packit |
6d2c1b |
*
|
|
Packit |
6d2c1b |
* This software is available to you under a choice of one of two
|
|
Packit |
6d2c1b |
* licenses. You may choose to be licensed under the terms of the GNU
|
|
Packit |
6d2c1b |
* General Public License (GPL) Version 2, available from the file
|
|
Packit |
6d2c1b |
* COPYING in the main directory of this source tree, or the
|
|
Packit |
6d2c1b |
* BSD license below:
|
|
Packit |
6d2c1b |
*
|
|
Packit |
6d2c1b |
* Redistribution and use in source and binary forms, with or
|
|
Packit |
6d2c1b |
* without modification, are permitted provided that the following
|
|
Packit |
6d2c1b |
* conditions are met:
|
|
Packit |
6d2c1b |
*
|
|
Packit |
6d2c1b |
* - Redistributions of source code must retain the above
|
|
Packit |
6d2c1b |
* copyright notice, this list of conditions and the following
|
|
Packit |
6d2c1b |
* disclaimer.
|
|
Packit |
6d2c1b |
*
|
|
Packit |
6d2c1b |
* - Redistributions in binary form must reproduce the above
|
|
Packit |
6d2c1b |
* copyright notice, this list of conditions and the following
|
|
Packit |
6d2c1b |
* disclaimer in the documentation and/or other materials
|
|
Packit |
6d2c1b |
* provided with the distribution.
|
|
Packit |
6d2c1b |
*
|
|
Packit |
6d2c1b |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
Packit |
6d2c1b |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Packit |
6d2c1b |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
Packit |
6d2c1b |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
Packit |
6d2c1b |
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
Packit |
6d2c1b |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
Packit |
6d2c1b |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
Packit |
6d2c1b |
* SOFTWARE.
|
|
Packit |
6d2c1b |
*/
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
#ifndef STATS_DATA_READER_H
|
|
Packit |
6d2c1b |
#define STATS_DATA_READER_H
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
#include <map>
|
|
Packit |
6d2c1b |
#include "utils/lock_wrapper.h"
|
|
Packit |
6d2c1b |
#include "vma/event/timer_handler.h"
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
typedef std::map< void*, std::pair<void*, int> > stats_read_map_t;
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
typedef struct {
|
|
Packit |
6d2c1b |
int size;
|
|
Packit |
6d2c1b |
void* shm_addr;
|
|
Packit |
6d2c1b |
} data_addr_and_size_t;
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
class stats_data_reader : public timer_handler
|
|
Packit |
6d2c1b |
{
|
|
Packit |
6d2c1b |
public:
|
|
Packit |
6d2c1b |
stats_data_reader();
|
|
Packit |
6d2c1b |
void handle_timer_expired(void *ctx);
|
|
Packit |
6d2c1b |
void register_to_timer();
|
|
Packit |
6d2c1b |
void add_data_reader(void* local_addr, void* shm_addr, int size);
|
|
Packit |
6d2c1b |
void* pop_data_reader(void* local_addr);
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
private:
|
|
Packit |
6d2c1b |
void* m_timer_handler;
|
|
Packit |
6d2c1b |
stats_read_map_t m_data_map;
|
|
Packit |
6d2c1b |
lock_spin m_lock_data_map;
|
|
Packit |
6d2c1b |
};
|
|
Packit |
6d2c1b |
|
|
Packit |
6d2c1b |
#endif //STATS_DATA_READER_H
|