⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packet.h

📁 nandflash文件系统源代码
💻 H
字号:
//---------------------------------------------------------- -*- Mode: C++ -*-// $Id: packet.h 199 2008-10-22 19:13:14Z sriramsrao $//// Created 2008/09/13// Author: Sriram Rao//// Copyright 2008 Quantcast Corporation.  All rights reserved.// This file is part of Kosmos File System (KFS).//// 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.//// \file Telemetry_srv.cc// \brief Format of the packets that are sent/recevied by the telemetry service.// //----------------------------------------------------------------------------#ifndef TELEMETRY_PACKET_H#define TELEMETRY_PACKET_H#include <netinet/in.h>#include <string.h>namespace KFS{    static const int OPNAME_LEN = 32;    static const int MAX_NODES_PER_PKT = 32;    static const uint32_t MAX_IO_INFO_PER_PKT = 32;    // Packet sent to the telemetry service by the clients: each    // client identifies itself and the target that is "slow".  This    // state is accumulated by the service and a list of slow nodes is    // periodically published.    struct TelemetryClntPacket_t {        TelemetryClntPacket_t() { }        TelemetryClntPacket_t(const struct in_addr &s, const struct in_addr &t,                              double tt, const char *n) :            source(s), target(t), timetaken(tt), count(0) {            strncpy(opname, n, OPNAME_LEN);        }        struct in_addr source;        struct in_addr target;        double timetaken;        // for each individual request, send the time it took        // how many IOs are we reporting per packet        uint32_t count;        double diskIOTime[MAX_IO_INFO_PER_PKT];        double elapsedTime[MAX_IO_INFO_PER_PKT];        char opname[OPNAME_LEN];    };    // set of nodes that are slow for a given op-type    struct TelemetryServerPacket_t {        TelemetryServerPacket_t() : numNodes(0) { }        void addNode(const struct in_addr &t) {            if (numNodes >= MAX_NODES_PER_PKT)                return;            slowNodes[numNodes] = t;            numNodes++;        }        int numNodes;        struct in_addr slowNodes[MAX_NODES_PER_PKT];    };}#endif // TELEMETRY_PACKET_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -