Path: blob/master/src/hotspot/share/logging/logSelection.hpp
40930 views
/*1* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#ifndef SHARE_LOGGING_LOGSELECTION_HPP24#define SHARE_LOGGING_LOGSELECTION_HPP2526#include "logging/logLevel.hpp"27#include "logging/logTag.hpp"28#include "memory/allocation.hpp"2930class LogTagSet;3132// Class representing a selection of tags with for a given level.33// Consists of a set of tags, an optional wildcard flag, and a level, e.g. "tag1+tag2*=level".34class LogSelection : public StackObj {35friend class LogSelectionList;3637private:38size_t _ntags;39LogTagType _tags[LogTag::MaxTags];40bool _wildcard;41LogLevelType _level;42size_t _tag_sets_selected;4344LogSelection();4546public:47static const LogSelection Invalid;4849static LogSelection parse(const char* str, outputStream* error_stream = NULL);5051LogSelection(const LogTagType tags[LogTag::MaxTags], bool wildcard, LogLevelType level);5253bool operator==(const LogSelection& ref) const;54bool operator!=(const LogSelection& ref) const;5556size_t ntags() const;57LogLevelType level() const;58size_t tag_sets_selected() const;5960bool selects(const LogTagSet& ts) const;61bool consists_of(const LogTagType tags[LogTag::MaxTags]) const;6263int describe_tags(char* buf, size_t bufsize) const;64int describe(char* buf, size_t bufsize) const;6566// List similar selections that matches existing tag sets on the given outputstream67void suggest_similar_matching(outputStream* out) const;6869// Compute a similarity measure in the range [0, 1], where higher means more similar70double similarity(const LogSelection& other) const;71};7273#endif // SHARE_LOGGING_LOGSELECTION_HPP747576