repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278
values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15
values |
|---|---|---|---|---|---|
PixelCraft3D/PixelCraft_game | files/default/formspec.lua | 1 | 11486 | default.ui = {}
default.ui.core = {}
default.ui.core.colors = "listcolors[#00000000;#00000010;#00000000;#68B259;#FFF]"
default.ui.core.bg = "bgcolor[#00000000;false]"
function default.ui.get_itemslot_bg(x, y, w, h)
local out = ""
for i = 0, w - 1, 1 do
for j = 0, h - 1, 1 do
out = out .."image["..x+i..","..y+j..";1,1;ui_itemslot.png]"
end
end
return out
end
function default.ui.get_hotbar_itemslot_bg(x, y, w, h)
local out = ""
for i = 0, w - 1, 1 do
for j = 0, h - 1, 1 do
out = out .."image["..x+i..","..y+j..";1,1;ui_itemslot.png^ui_itemslot_dark.png]"
end
end
return out
end
function default.ui.image_button(x, y, w, h, name, image)
local image = minetest.formspec_escape(image)
return "image_button["..x..","..y..";"..w..","..h..";"..image..";"..name..";;;false;"..image.."]"
end
function default.ui.button(x, y, w, h, name, label, noclip)
local nc = "false"
if noclip then
nc = "true"
end
if w == 2 then
return "image_button["..x..","..y..";"..w..","..h..";ui_button_2w_inactive.png;"..name..";"..label..";"..nc..";false;ui_button_2w_active.png]"
else
return "image_button["..x..","..y..";"..w..","..h..";ui_button_3w_inactive.png;"..name..";"..label..";"..nc..";false;ui_button_3w_active.png]"
end
end
function default.ui.button_exit(x, y, w, h, name, label, noclip)
local nc = "false"
if noclip then
nc = "true"
end
if w == 2 then
return "image_button_exit["..x..","..y..";"..w..","..h..";ui_button_2w_inactive.png;"..name..";"..label..";"..nc..";false;ui_button_2w_active.png]"
else
return "image_button_exit["..x..","..y..";"..w..","..h..";ui_button_3w_inactive.png;"..name..";"..label..";"..nc..";false;ui_button_3w_active.png]"
end
end
function default.ui.tab(x, y, name, icon, tooltip)
local tooltip = tooltip or ""
local shifted_icon = "[combine:16x16:0,0=ui_tab_active.png:0,1="..icon
local form = ""
form = form .. "image_button["..x..","..y..";1,1;ui_tab_inactive.png^"..icon..";"..name..";;true;false;"..minetest.formspec_escape(shifted_icon).."]"
form = form .. "tooltip["..name..";"..tooltip.."]"
return form
end
local function get_itemdef_field(itemname, fieldname)
if not minetest.registered_items[itemname] then
return nil
end
return minetest.registered_items[itemname][fieldname]
end
function default.ui.fake_itemstack(x, y, itemstack, name)
local name = name or "fake_itemstack"
local itemname = itemstack:get_name()
local itemamt = itemstack:get_count()
local itemimage = ""
if itemname ~= "" then
local inventory_image = get_itemdef_field(itemname, "inventory_image")
if inventory_image and inventory_image ~= "" then
itemimage = inventory_image
else
local tiles = get_itemdef_field(itemname, "tiles")
local t1 = tiles[1]
local t2 = tiles[1]
local t3 = tiles[1]
if #tiles == 3 then
t1 = tiles[1]
t2 = tiles[3]
t3 = tiles[3]
elseif #tiles == 6 then
t1 = tiles[1]
t2 = tiles[5]
t3 = tiles[6]
end
itemimage=minetest.inventorycube(t1, t2, t3)
end
end
itemimage = minetest.formspec_escape(itemimage)
local itemdesc = ""
if minetest.registered_items[itemname].description ~= nil then
itemdesc = minetest.registered_items[itemname].description
end
if itemamt <= 1 then itemamt = "" end
local result = ""
if itemname ~= "" then
result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
result = result .. "label["..(x+0.6)..","..(y+0.5)..";"..itemamt.."]"
result = result .. "tooltip["..name..";"..itemdesc.."]"
end
return result
end
function default.ui.fake_simple_itemstack(x, y, itemname, name)
local name = name or "fake_simple_itemstack"
local itemimage = ""
if itemname ~= "" then
local inventory_image = get_itemdef_field(itemname, "inventory_image")
if inventory_image and inventory_image ~= "" then
itemimage = inventory_image
else
local tiles = get_itemdef_field(itemname, "tiles")
local t1 = tiles[1]
local t2 = tiles[1]
local t3 = tiles[1]
if #tiles == 3 then
t1 = tiles[1]
t2 = tiles[3]
t3 = tiles[3]
elseif #tiles == 6 then
t1 = tiles[1]
t2 = tiles[5]
t3 = tiles[6]
end
itemimage=minetest.inventorycube(t1, t2, t3)
end
end
itemimage = minetest.formspec_escape(itemimage)
local itemdesc = ""
if minetest.registered_items[itemname].description ~= nil then
itemdesc = minetest.registered_items[itemname].description
end
local result = ""
if itemname ~= "" then
result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
result = result .. "tooltip["..name..";"..itemdesc.."]"
end
return result
end
function default.ui.item_group(x, y, group, name)
local name = name or "fake_simple_itemstack"
local itemname = ""
for itemn, itemdef in pairs(minetest.registered_items) do
if minetest.get_item_group(itemn, group) ~= 0 and minetest.get_item_group(itemn, "not_in_craftingguide") ~= 1 then
itemname = itemn
end
end
local itemimage = ""
if itemname ~= "" then
local inventory_image = get_itemdef_field(itemname, "inventory_image")
if inventory_image and inventory_image ~= "" then
itemimage = inventory_image
else
local tiles = get_itemdef_field(itemname, "tiles")
local t1 = tiles[1]
local t2 = tiles[1]
local t3 = tiles[1]
if #tiles == 3 then
t1 = tiles[1]
t2 = tiles[3]
t3 = tiles[3]
elseif #tiles == 6 then
t1 = tiles[1]
t2 = tiles[5]
t3 = tiles[6]
end
itemimage=minetest.inventorycube(t1, t2, t3)
end
end
local result = ""
if itemname ~= "" then
local itemdesc = ""
itemimage = minetest.formspec_escape(itemimage)
if minetest.registered_items[itemname].description ~= nil then
itemdesc = minetest.registered_items[itemname].description
end
result = result .. "image_button["..x..","..y..";1,1;"..itemimage..";"..name..";;false;false;"..itemimage.."]"
result = result .. "label["..(x+0.4)..","..(y+0.35)..";G]"
result = result .. "tooltip["..name..";Group: "..group.."]"
end
return result
end
default.ui.registered_pages = {
}
function default.ui.get_page(name)
local page= default.ui.registered_pages[name]
if page == nil then
default.log("UI page '" .. name .. "' is not yet registered", "dev")
page = ""
end
return page
end
function default.ui.register_page(name, form)
default.ui.registered_pages[name] = form
end
local form_core = ""
form_core = form_core .. "size[8.5,9]"
form_core = form_core .. default.ui.core.colors
form_core = form_core .. default.ui.core.bg
form_core = form_core .. default.ui.tab(-0.9, 1, "tab_crafting", "ui_icon_crafting.png", "Crafting")
if minetest.get_modpath("craftingguide") ~= nil then
form_core = form_core .. default.ui.tab(-0.9, 1.78, "tab_craftingguide", "ui_icon_craftingguide.png", "Crafting Guide")
end
if minetest.get_modpath("armor") ~= nil then
form_core = form_core .. default.ui.tab(-0.9, 2.56, "tab_armor", "ui_icon_armor.png", "Armor")
end
if minetest.get_modpath("achievements") ~= nil then
form_core = form_core .. default.ui.tab(-0.9, 3.34, "tab_achievements", "ui_icon_achievements.png", "Achievements")
end
form_core = form_core .. "background[0,0;8.5,9;ui_formspec_bg_tall.png]"
default.ui.register_page("core", form_core)
default.ui.register_page("core_2part", form_core .. "background[0,0;8.5,4.5;ui_formspec_bg_short.png]")
local form_core_notabs = ""
form_core_notabs = form_core_notabs .. "size[8.5,9]"
form_core_notabs = form_core_notabs .. default.ui.core.colors
form_core_notabs = form_core_notabs .. default.ui.core.bg
form_core_notabs = form_core_notabs .. "background[0,0;8.5,9;ui_formspec_bg_tall.png]"
default.ui.register_page("core_notabs", form_core_notabs)
default.ui.register_page("core_notabs_2part", form_core_notabs .. "background[0,0;8.5,4.5;ui_formspec_bg_short.png]")
local form_core_field = ""
form_core_field = form_core_field .. "size[8.5,5]"
form_core_field = form_core_field .. default.ui.core.colors
form_core_field = form_core_field .. default.ui.core.bg
form_core_field = form_core_field .. "background[0,0;8.5,4.5;ui_formspec_bg_short.png]"
form_core_field = form_core_field .. "field[1,1.75;7,0;text;;${text}]"
form_core_field = form_core_field .. default.ui.button_exit(2.75, 3, 3, 1, "", "Write", false)
default.ui.register_page("core_field", form_core_field)
local form_crafting = default.ui.get_page("core_2part")
form_crafting = form_crafting .. "list[current_player;main;0.25,4.75;8,4;]"
form_crafting = form_crafting .. "listring[current_player;main]"
form_crafting = form_crafting .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
form_crafting = form_crafting .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
form_crafting = form_crafting .. "list[current_player;craft;2.25,0.75;3,3;]"
form_crafting = form_crafting .. "listring[current_player;craft]"
form_crafting = form_crafting .. "image[5.25,1.75;1,1;ui_arrow.png^[transformR270]"
form_crafting = form_crafting .. "list[current_player;craftpreview;6.25,1.75;1,1;]"
form_crafting = form_crafting .. default.ui.get_itemslot_bg(2.25, 0.75, 3, 3)
form_crafting = form_crafting .. default.ui.get_itemslot_bg(6.25, 1.75, 1, 1)
default.ui.register_page("core_crafting", form_crafting)
local form_bookshelf = default.ui.get_page("core_2part")
form_bookshelf = form_bookshelf .. "list[current_player;main;0.25,4.75;8,4;]"
form_bookshelf = form_bookshelf .. "listring[current_player;main]"
form_bookshelf = form_bookshelf .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
form_bookshelf = form_bookshelf .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
form_bookshelf = form_bookshelf .. "list[current_name;main;2.25,1.25;4,2;]"
form_bookshelf = form_bookshelf .. "listring[current_name;main]"
form_bookshelf = form_bookshelf .. default.ui.get_itemslot_bg(2.25, 1.25, 4, 2)
default.ui.register_page("core_bookshelf", form_bookshelf)
function default.ui.receive_fields(player, form_name, fields)
local name = player:get_player_name()
-- print("Received formspec fields from '"..name.."': "..dump(fields))
if fields.tab_crafting then
minetest.show_formspec(name, "core_crafting", default.ui.get_page("core_crafting"))
elseif minetest.get_modpath("craftingguide") ~= nil and fields.tab_craftingguide then
minetest.show_formspec(name, "core_craftingguide", craftingguide.get_formspec(name))
elseif minetest.get_modpath("armor") ~= nil and fields.tab_armor then
minetest.show_formspec(name, "core_armor", default.ui.get_page("core_armor"))
elseif minetest.get_modpath("achievements") ~= nil and fields.tab_achievements then
minetest.show_formspec(name, "core_achievements", default.ui.get_page("core_achievements"))
end
end
minetest.register_on_player_receive_fields(
function(player, form_name, fields)
default.ui.receive_fields(player, form_name, fields)
end)
minetest.register_on_joinplayer(
function(player)
local function cb(player)
--minetest.chat_send_player(player:get_player_name(), "Welcome!")
end
minetest.after(1.0, cb, player)
player:set_inventory_formspec(default.ui.get_page("core_crafting"))
end) | cc0-1.0 |
DavidIngraham/ardupilot | libraries/AP_Scripting/examples/rangefinder_test.lua | 24 | 1193 | -- This script checks RangeFinder
local rotation_downward = 25
local rotation_forward = 0
function update()
local sensor_count = rangefinder:num_sensors()
gcs:send_text(0, string.format("%d rangefinder sensors found.", sensor_count))
for i = 0, rangefinder:num_sensors() do
if rangefinder:has_data_orient(rotation_downward) then
info(rotation_downward)
elseif rangefinder:has_data_orient(rotation_forward) then
info(rotation_forward)
end
end
return update, 1000 -- check again in 1Hz
end
function info(rotation)
local ground_clearance = rangefinder:ground_clearance_cm_orient(rotation)
local distance_min = rangefinder:min_distance_cm_orient(rotation)
local distance_max = rangefinder:max_distance_cm_orient(rotation)
local offset = rangefinder:get_pos_offset_orient(rotation)
local distance_cm = rangefinder:distance_cm_orient(rotation)
gcs:send_text(0, string.format("Ratation %d %.0f cm range %d - %d offset %.0f %.0f %.0f ground clearance %.0f", rotation, distance_cm, distance_min, distance_max, offset:x(), offset:y(), offset:z(), ground_clearance))
end
return update(), 1000 -- first message may be displayed 1 seconds after start-up | gpl-3.0 |
pablo93/TrinityCore | Data/Interface/FrameXML/TabardFrame.lua | 1 | 3778 |
function TabardFrame_OnLoad(self)
self:RegisterEvent("OPEN_TABARD_FRAME");
self:RegisterEvent("CLOSE_TABARD_FRAME");
self:RegisterEvent("TABARD_CANSAVE_CHANGED");
self:RegisterEvent("TABARD_SAVE_PENDING");
self:RegisterEvent("UNIT_MODEL_CHANGED");
TabardFrameCostFrame:SetBackdropBorderColor(0.4, 0.4, 0.4);
TabardFrameCostFrame:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b);
MoneyFrame_Update("TabardFrameCostMoneyFrame",GetTabardCreationCost());
local backgroundAlpha = 0.40;
TabardFrameEmblemTopRight:SetAlpha(backgroundAlpha);
TabardFrameEmblemTopLeft:SetAlpha(backgroundAlpha);
TabardFrameEmblemBottomRight:SetAlpha(backgroundAlpha);
TabardFrameEmblemBottomLeft:SetAlpha(backgroundAlpha);
end
function TabardCharacterModelFrame_OnLoad(self)
self.rotation = 0;
TabardModel:SetRotation(self.rotation);
end
function TabardFrame_OnEvent(self, event, ...)
local unit = ...;
if ( event == "OPEN_TABARD_FRAME" ) then
TabardModel:SetUnit("player");
SetPortraitTexture(TabardFramePortrait,"npc");
TabardFrameNameText:SetText(UnitName("npc"));
TabardModel:InitializeTabardColors();
TabardFrame_UpdateTextures();
TabardFrame_UpdateButtons();
ShowUIPanel(TabardFrame);
if ( not TabardFrame:IsShown() ) then
CloseTabardCreation();
end
elseif ( event == "CLOSE_TABARD_FRAME" ) then
HideUIPanel(TabardFrame);
elseif ( event == "TABARD_CANSAVE_CHANGED" or event == "TABARD_SAVE_PENDING" ) then
TabardFrame_UpdateButtons();
elseif ( event == "UNIT_MODEL_CHANGED" ) then
if ( unit == "player" ) then
TabardModel:SetUnit("player");
end
end
end
function TabardCharacterModelRotateLeftButton_OnClick()
TabardModel.rotation = TabardModel.rotation - .03;
TabardModel:SetRotation(TabardModel.rotation);
PlaySound("igInventoryRotateCharacter");
end
function TabardCharacterModelRotateRightButton_OnClick()
TabardModel.rotation = TabardModel.rotation + .03;
TabardModel:SetRotation(TabardModel.rotation);
PlaySound("igInventoryRotateCharacter");
end
function TabardCharacterModelFrame_OnUpdate(self, elapsedTime)
if ( TabardCharacterModelRotateRightButton:GetButtonState() == "PUSHED" ) then
self.rotation = self.rotation + (elapsedTime * 2 * PI * ROTATIONS_PER_SECOND);
if ( self.rotation < 0 ) then
self.rotation = self.rotation + (2 * PI);
end
self:SetRotation(self.rotation);
end
if ( TabardCharacterModelRotateLeftButton:GetButtonState() == "PUSHED" ) then
self.rotation = self.rotation - (elapsedTime * 2 * PI * ROTATIONS_PER_SECOND);
if ( self.rotation > (2 * PI) ) then
self.rotation = self.rotation - (2 * PI);
end
self:SetRotation(self.rotation);
end
end
function TabardCustomization_Left(id)
PlaySound("gsCharacterCreationLook");
TabardModel:CycleVariation(id,-1);
TabardFrame_UpdateTextures();
end
function TabardCustomization_Right(id)
PlaySound("gsCharacterCreationLook");
TabardModel:CycleVariation(id,1);
TabardFrame_UpdateTextures();
end
function TabardFrame_UpdateTextures()
TabardModel:GetUpperEmblemTexture(TabardFrameEmblemTopLeft);
TabardModel:GetUpperEmblemTexture(TabardFrameEmblemTopRight);
TabardModel:GetLowerEmblemTexture(TabardFrameEmblemBottomLeft);
TabardModel:GetLowerEmblemTexture(TabardFrameEmblemBottomRight);
end
function TabardFrame_UpdateButtons()
local guildName, rankName, rank = GetGuildInfo("player");
if ( guildName == nil or rankName == nil or ( rank > 0 ) ) then
TabardFrameGreetingText:SetText(TABARDVENDORNOGUILDGREETING);
TabardFrameAcceptButton:Disable();
else
TabardFrameGreetingText:SetText(TABARDVENDORGREETING);
if( TabardModel:CanSaveTabardNow() ) then
TabardFrameAcceptButton:Enable();
else
TabardFrameAcceptButton:Disable();
end
end
end | gpl-2.0 |
xponen/Zero-K | LuaUI/Widgets/cmd_unit_mover.lua | 12 | 3001 | -- $Id: cmd_unit_mover.lua 3171 2008-11-06 09:06:29Z det $
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: cmd_unit_mover.lua
-- brief: Allows combat engineers to use repeat when building mobile units (use 2 or more build spots)
-- author: Owen Martindell
--
-- Copyright (C) 2007.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:GetInfo()
return {
name = "Unit Mover",
desc = "Allows combat engineers to use repeat when building mobile units (use 2 or more build spots)",
author = "TheFatController",
date = "Mar 20, 2007",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
--------------------------------------------------------------------------------
local GetCommandQueue = Spring.GetCommandQueue
local GetPlayerInfo = Spring.GetPlayerInfo
local GetUnitPosition = Spring.GetUnitPosition
local GiveOrderToUnit = Spring.GiveOrderToUnit
local GetMyTeamID = Spring.GetMyTeamID
--------------------------------------------------------------------------------
local countDown = -1
local DELAY = 0.2
local moveUnits = {}
local myID = 0
local function checkSpec()
local _, _, spec = GetPlayerInfo(myID)
if spec then
widgetHandler:RemoveWidget()
end
end
function widget:Initialize()
myID = Spring.GetMyPlayerID()
checkSpec()
end
function widget:Update(deltaTime)
if (countDown == -1) then
return
else
countDown = countDown + deltaTime
end
if (countDown > DELAY) then
for unitID,_ in pairs(moveUnits) do
local cQueue = GetCommandQueue(unitID, 1)
if (table.getn(cQueue) == 0) then
local x, y, z = GetUnitPosition(unitID)
if (math.random(1,2) == 1) then
x = x + math.random(50,100)
else
x = x - math.random(50,100)
end
if (math.random(1,2) == 1) then
z = z + math.random(50,100)
else
z = z - math.random(50,100)
end
GiveOrderToUnit(unitID, CMD.FIGHT, { x, y, z}, { "" })
end
end
moveUnits = {}
countDown = -1
end
end
function widget:UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders)
for uID,_ in pairs(moveUnits) do
if (uID == unitID) then
table.remove(moveUnits,uID)
break
end
end
end
function widget:UnitFinished(unitID, unitDefID, unitTeam)
if (unitTeam ~= GetMyTeamID()) then
return
end
local ud = UnitDefs[unitDefID]
if (ud and (not ud.customParams.commtype) and (ud.speed > 0)) then
checkSpec()
moveUnits[unitID] = true
countDown = 0
end
end
--------------------------------------------------------------------------------
| gpl-2.0 |
lambd0x/Awesome-wm-Funtoo-GreenInfinity | awesome/vicious/widgets/cpu_linux.lua | 4 | 2069 | ---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2011, Adrian C. <anrxc@sysphere.org>
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
-- * (c) 2011, Jörg Thalheim <jthalheim@gmail.com>
---------------------------------------------------
-- {{{ Grab environment
local ipairs = ipairs
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local table = { insert = table.insert }
local string = {
sub = string.sub,
gmatch = string.gmatch
}
-- }}}
-- Cpu: provides CPU usage for all available CPUs/cores
-- vicious.widgets.cpu
local cpu_linux = {}
-- Initialize function tables
local cpu_usage = {}
local cpu_total = {}
local cpu_active = {}
-- {{{ CPU widget type
local function worker(format)
local cpu_lines = {}
-- Get CPU stats
local f = io.open("/proc/stat")
for line in f:lines() do
if string.sub(line, 1, 3) ~= "cpu" then break end
cpu_lines[#cpu_lines+1] = {}
for i in string.gmatch(line, "[%s]+([^%s]+)") do
table.insert(cpu_lines[#cpu_lines], i)
end
end
f:close()
-- Ensure tables are initialized correctly
for i = #cpu_total + 1, #cpu_lines do
cpu_total[i] = 0
cpu_usage[i] = 0
cpu_active[i] = 0
end
for i, v in ipairs(cpu_lines) do
-- Calculate totals
local total_new = 0
for j = 1, #v do
total_new = total_new + v[j]
end
local active_new = total_new - (v[4] + v[5])
-- Calculate percentage
local diff_total = total_new - cpu_total[i]
local diff_active = active_new - cpu_active[i]
if diff_total == 0 then diff_total = 1E-6 end
cpu_usage[i] = math.floor((diff_active / diff_total) * 100)
-- Store totals
cpu_total[i] = total_new
cpu_active[i] = active_new
end
return cpu_usage
end
-- }}}
return setmetatable(cpu_linux, { __call = function(_, ...) return worker(...) end })
| gpl-2.0 |
Canaan-Creative/luci | applications/luci-olsr/luasrc/model/cbi/olsr/olsrdhna.lua | 78 | 1844 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
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
$Id$
]]--
local uci = require "luci.model.uci".cursor()
local ipv = uci:get_first("olsrd", "olsrd", "IpVersion", "4")
mh = Map("olsrd", translate("OLSR - HNA-Announcements"), translate("Hosts in a OLSR routed network can announce connecitivity " ..
"to external networks using HNA messages."))
if ipv == "6and4" or ipv == "4" then
hna4 = mh:section(TypedSection, "Hna4", translate("Hna4"), translate("Both values must use the dotted decimal notation."))
hna4.addremove = true
hna4.anonymous = true
hna4.template = "cbi/tblsection"
net4 = hna4:option(Value, "netaddr", translate("Network address"))
net4.datatype = "ip4addr"
net4.placeholder = "10.11.12.13"
net4.default = "10.11.12.13"
msk4 = hna4:option(Value, "netmask", translate("Netmask"))
msk4.datatype = "ip4addr"
msk4.placeholder = "255.255.255.255"
msk4.default = "255.255.255.255"
end
if ipv == "6and4" or ipv == "6" then
hna6 = mh:section(TypedSection, "Hna6", translate("Hna6"), translate("IPv6 network must be given in full notation, " ..
"prefix must be in CIDR notation."))
hna6.addremove = true
hna6.anonymous = true
hna6.template = "cbi/tblsection"
net6 = hna6:option(Value, "netaddr", translate("Network address"))
net6.datatype = "ip6addr"
net6.placeholder = "fec0:2200:106:0:0:0:0:0"
net6.default = "fec0:2200:106:0:0:0:0:0"
msk6 = hna6:option(Value, "prefix", translate("Prefix"))
msk6.datatype = "range(0,128)"
msk6.placeholder = "128"
msk6.default = "128"
end
return mh
| apache-2.0 |
gpedro/forgottenserver | data/creaturescripts/scripts/droploot.lua | 10 | 1176 | function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if getPlayerFlagValue(player, PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
local isPlayer = false
if killer:isPlayer() then
isPlayer = true
else
local master = killer:getMaster()
if master and master:isPlayer() then
isPlayer = true
end
end
if not isPlayer or not player:hasBlessing(6) then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
if item then
if isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) or math.random(item:isContainer() and 100 or 1000) <= player:getLossPercent() then
if not item:moveTo(corpse) then
item:remove()
end
end
end
end
end
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
| gpl-2.0 |
nexusstar/dotfiles | neovim/.config/nvim/lua/config/gitsigns.lua | 6 | 1658 | local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
return
end
gitsigns.setup {
signs = {
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter_opts = {
relative_time = false,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
yadm = {
enable = false,
},
}
| unlicense |
Canaan-Creative/luci | applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua | 74 | 2324 | --[[
LuCI - Lua Configuration Interface
Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
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
$Id$
]]--
local sid = arg[1]
local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - RDNSS"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
"It listens to router solicitations and sends router advertisements " ..
"as described in RFC 4861."))
m.redirect = luci.dispatcher.build_url("admin/network/radvd")
if m.uci:get("radvd", sid) ~= "rdnss" then
luci.http.redirect(m.redirect)
return
end
s = m:section(NamedSection, sid, "interface", translate("RDNSS Configuration"))
s.addremove = false
--
-- General
--
o = s:option(Flag, "ignore", translate("Enable"))
o.rmempty = false
function o.cfgvalue(...)
local v = Flag.cfgvalue(...)
return v == "1" and "0" or "1"
end
function o.write(self, section, value)
Flag.write(self, section, value == "1" and "0" or "1")
end
o = s:option(Value, "interface", translate("Interface"),
translate("Specifies the logical interface name this section belongs to"))
o.template = "cbi/network_netlist"
o.nocreate = true
o.optional = false
function o.formvalue(...)
return Value.formvalue(...) or "-"
end
function o.validate(self, value)
if value == "-" then
return nil, translate("Interface required")
end
return value
end
function o.write(self, section, value)
m.uci:set("radvd", section, "ignore", 0)
m.uci:set("radvd", section, "interface", value)
end
o = s:option(DynamicList, "addr", translate("Addresses"),
translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used"))
o.optional = false
o.rmempty = true
o.datatype = "ip6addr"
o.placeholder = translate("default")
function o.cfgvalue(self, section)
local l = { }
local v = m.uci:get_list("radvd", section, "addr")
for v in utl.imatch(v) do
l[#l+1] = v
end
return l
end
o = s:option(Value, "AdvRDNSSLifetime", translate("Lifetime"),
translate("Specifies the maximum duration how long the RDNSS entries are used for name resolution."))
o.datatype = 'or(uinteger,"infinity")'
o.placeholder = 1200
return m
| apache-2.0 |
enoposix/mpv | TOOLS/lua/autodeint.lua | 20 | 5073 | -- This script uses the lavfi idet filter to automatically insert the
-- appropriate deinterlacing filter based on a short section of the
-- currently playing video.
--
-- It registers the key-binding ctrl+d, which when pressed, inserts the filters
-- ``vf=lavfi=idet,pullup,vf=lavfi=idet``. After 4 seconds, it removes these
-- filters and decides whether the content is progressive, interlaced, or
-- telecined and the interlacing field dominance.
--
-- Based on this information, it may set mpv's ``deinterlace`` property (which
-- usually inserts the yadif filter), or insert the ``pullup`` filter if the
-- content is telecined. It also sets mpv's ``field-dominance`` property.
--
-- OPTIONS:
-- The default detection time may be overridden by adding
--
-- --script-opts=autodeint.detect_seconds=<number of seconds>
--
-- to mpv's arguments. This may be desirable to allow idet more
-- time to collect data.
--
-- To see counts of the various types of frames for each detection phase,
-- the verbosity can be increased with
--
-- --msg-level autodeint=v
--
-- This script requires a recent version of ffmpeg for which the idet
-- filter adds the required metadata.
require "mp.msg"
script_name = mp.get_script_name()
detect_label = string.format("%s-detect", script_name)
pullup_label = string.format("%s", script_name)
ivtc_detect_label = string.format("%s-ivtc-detect", script_name)
-- number of seconds to gather cropdetect data
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
if not detect_seconds then
detect_seconds = 4
end
function del_filter_if_present(label)
-- necessary because mp.command('vf del @label:filter') raises an
-- error if the filter doesn't exist
local vfs = mp.get_property_native("vf")
for i,vf in pairs(vfs) do
if vf["label"] == label then
table.remove(vfs, i)
mp.set_property_native("vf", vfs)
return true
end
end
return false
end
function start_detect()
-- exit if detection is already in progress
if timer then
mp.msg.warn("already detecting!")
return
end
mp.set_property("deinterlace","no")
del_filter_if_present(pullup_label)
-- insert the detection filter
local cmd = string.format('vf add @%s:lavfi=graph="idet",@%s:pullup,@%s:lavfi=graph="idet"',
detect_label, pullup_label, ivtc_detect_label)
if not mp.command(cmd) then
mp.msg.error("failed to insert detection filters")
return
end
-- wait to gather data
timer = mp.add_timeout(detect_seconds, select_filter)
end
function stop_detect()
del_filter_if_present(detect_label)
del_filter_if_present(ivtc_detect_label)
timer = nil
end
progressive, interlaced_tff, interlaced_bff, interlaced = 0, 1, 2, 3, 4
function judge(label)
-- get the metadata
local result = mp.get_property_native(string.format("vf-metadata/%s", label))
num_tff = tonumber(result["lavfi.idet.multiple.tff"])
num_bff = tonumber(result["lavfi.idet.multiple.bff"])
num_progressive = tonumber(result["lavfi.idet.multiple.progressive"])
num_undetermined = tonumber(result["lavfi.idet.multiple.undetermined"])
num_interlaced = num_tff + num_bff
num_determined = num_interlaced + num_progressive
mp.msg.verbose(label.." progressive = "..num_progressive)
mp.msg.verbose(label.." interlaced-tff = "..num_tff)
mp.msg.verbose(label.." interlaced-bff = "..num_bff)
mp.msg.verbose(label.." undetermined = "..num_undetermined)
if num_determined < num_undetermined then
mp.msg.warn("majority undetermined frames")
end
if num_progressive > 20*num_interlaced then
return progressive
elseif num_tff > 10*num_bff then
return interlaced_tff
elseif num_bff > 10*num_tff then
return interlaced_bff
else
return interlaced
end
end
function select_filter()
-- handle the first detection filter results
verdict = judge(detect_label)
if verdict == progressive then
mp.msg.info("progressive: doing nothing")
stop_detect()
return
elseif verdict == interlaced_tff then
mp.set_property("field-dominance", "top")
elseif verdict == interlaced_bff then
mp.set_property("field-dominance", "bottom")
elseif verdict == interlaced then
mp.set_property("field-dominance", "auto")
end
-- handle the ivtc detection filter results
verdict = judge(ivtc_detect_label)
if verdict == progressive then
mp.msg.info(string.format("telecinied with %s field dominance: using pullup", mp.get_property("field-dominance")))
stop_detect()
else
mp.msg.info(string.format("interlaced with %s field dominance: setting deinterlace property", mp.get_property("field-dominance")))
del_filter_if_present(pullup_label)
mp.set_property("deinterlace","yes")
stop_detect()
end
end
mp.add_key_binding("ctrl+d", script_name, start_detect)
| gpl-2.0 |
alexandergall/snabbswitch | src/lib/pmu_cpu.lua | 15 | 475439 | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
-- AUTOMATICALLY GENERATED FILE
-- Date: Fri Aug 14 14:34:23 CEST 2015
-- Cmd: scripts/generate-pmu.sh
return
{
{"GenuineIntel-6-2E", "V1", "core",
{
-- source: NHM-EX/NehalemEX_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_all_ref.any"] = 0x0143,
["l1d_all_ref.cacheable"] = 0x0243,
["l1d_cache_ld.e_state"] = 0x0440,
["l1d_cache_ld.i_state"] = 0x0140,
["l1d_cache_ld.m_state"] = 0x0840,
["l1d_cache_ld.mesi"] = 0x0f40,
["l1d_cache_ld.s_state"] = 0x0240,
["l1d_cache_lock.e_state"] = 0x0442,
["l1d_cache_lock.hit"] = 0x0142,
["l1d_cache_lock.m_state"] = 0x0842,
["l1d_cache_lock.s_state"] = 0x0242,
["l1d_cache_lock_fb_hit"] = 0x0153,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_cache_st.e_state"] = 0x0441,
["l1d_cache_st.m_state"] = 0x0841,
["l1d_cache_st.s_state"] = 0x0241,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-1E", "V1", "core",
{
-- source: NHM-EP/NehalemEP_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_all_ref.any"] = 0x0143,
["l1d_all_ref.cacheable"] = 0x0243,
["l1d_cache_ld.e_state"] = 0x0440,
["l1d_cache_ld.i_state"] = 0x0140,
["l1d_cache_ld.m_state"] = 0x0840,
["l1d_cache_ld.mesi"] = 0x0f40,
["l1d_cache_ld.s_state"] = 0x0240,
["l1d_cache_lock.e_state"] = 0x0442,
["l1d_cache_lock.hit"] = 0x0142,
["l1d_cache_lock.m_state"] = 0x0842,
["l1d_cache_lock.s_state"] = 0x0242,
["l1d_cache_lock_fb_hit"] = 0x0153,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_cache_st.e_state"] = 0x0441,
["l1d_cache_st.m_state"] = 0x0841,
["l1d_cache_st.s_state"] = 0x0241,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["mem_uncore_retired.local_dram"] = 0x200f,
["mem_uncore_retired.other_core_l2_hitm"] = 0x020f,
["mem_uncore_retired.remote_cache_local_home_hit"] = 0x080f,
["mem_uncore_retired.remote_dram"] = 0x100f,
["mem_uncore_retired.uncacheable"] = 0x800f,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-1F", "V1", "core",
{
-- source: NHM-EP/NehalemEP_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_all_ref.any"] = 0x0143,
["l1d_all_ref.cacheable"] = 0x0243,
["l1d_cache_ld.e_state"] = 0x0440,
["l1d_cache_ld.i_state"] = 0x0140,
["l1d_cache_ld.m_state"] = 0x0840,
["l1d_cache_ld.mesi"] = 0x0f40,
["l1d_cache_ld.s_state"] = 0x0240,
["l1d_cache_lock.e_state"] = 0x0442,
["l1d_cache_lock.hit"] = 0x0142,
["l1d_cache_lock.m_state"] = 0x0842,
["l1d_cache_lock.s_state"] = 0x0242,
["l1d_cache_lock_fb_hit"] = 0x0153,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_cache_st.e_state"] = 0x0441,
["l1d_cache_st.m_state"] = 0x0841,
["l1d_cache_st.s_state"] = 0x0241,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["mem_uncore_retired.local_dram"] = 0x200f,
["mem_uncore_retired.other_core_l2_hitm"] = 0x020f,
["mem_uncore_retired.remote_cache_local_home_hit"] = 0x080f,
["mem_uncore_retired.remote_dram"] = 0x100f,
["mem_uncore_retired.uncacheable"] = 0x800f,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-1A", "V1", "core",
{
-- source: NHM-EP/NehalemEP_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_all_ref.any"] = 0x0143,
["l1d_all_ref.cacheable"] = 0x0243,
["l1d_cache_ld.e_state"] = 0x0440,
["l1d_cache_ld.i_state"] = 0x0140,
["l1d_cache_ld.m_state"] = 0x0840,
["l1d_cache_ld.mesi"] = 0x0f40,
["l1d_cache_ld.s_state"] = 0x0240,
["l1d_cache_lock.e_state"] = 0x0442,
["l1d_cache_lock.hit"] = 0x0142,
["l1d_cache_lock.m_state"] = 0x0842,
["l1d_cache_lock.s_state"] = 0x0242,
["l1d_cache_lock_fb_hit"] = 0x0153,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_cache_st.e_state"] = 0x0441,
["l1d_cache_st.m_state"] = 0x0841,
["l1d_cache_st.s_state"] = 0x0241,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["mem_uncore_retired.local_dram"] = 0x200f,
["mem_uncore_retired.other_core_l2_hitm"] = 0x020f,
["mem_uncore_retired.remote_cache_local_home_hit"] = 0x080f,
["mem_uncore_retired.remote_dram"] = 0x100f,
["mem_uncore_retired.uncacheable"] = 0x800f,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-2F", "V1", "core",
{
-- source: WSM-EX/WestmereEX_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.all_branches"] = 0x04c5,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.large_walk_completed"] = 0x8008,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_load_misses.walk_cycles"] = 0x0408,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.large_walk_completed"] = 0x8049,
["dtlb_misses.pde_miss"] = 0x2049,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["dtlb_misses.walk_cycles"] = 0x0449,
["ept.walk_cycles"] = 0x104f,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.large_walk_completed"] = 0x8085,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_cycles"] = 0x0485,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_block.overlap_store"] = 0x0203,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["mem_uncore_retired.local_hitm"] = 0x020f,
["mem_uncore_retired.local_dram_and_remote_cache_hit"] = 0x080f,
["mem_uncore_retired.remote_dram"] = 0x200f,
["mem_uncore_retired.uncacheable"] = 0x800f,
["mem_uncore_retired.remote_hitm"] = 0x040f,
["misalign_mem_ref.store"] = 0x0205,
["offcore_requests.any"] = 0x80b0,
["offcore_requests.any.read"] = 0x08b0,
["offcore_requests.any.rfo"] = 0x10b0,
["offcore_requests.demand.read_code"] = 0x02b0,
["offcore_requests.demand.read_data"] = 0x01b0,
["offcore_requests.demand.rfo"] = 0x04b0,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_outstanding.any.read"] = 0x0860,
["offcore_requests_outstanding.any.read_not_empty"] = 0x0860,
["offcore_requests_outstanding.demand.read_code"] = 0x0260,
["offcore_requests_outstanding.demand.read_code_not_empty"] = 0x0260,
["offcore_requests_outstanding.demand.read_data"] = 0x0160,
["offcore_requests_outstanding.demand.read_data_not_empty"] = 0x0160,
["offcore_requests_outstanding.demand.rfo"] = 0x0460,
["offcore_requests_outstanding.demand.rfo_not_empty"] = 0x0460,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["snoopq_requests.code"] = 0x04b4,
["snoopq_requests.data"] = 0x01b4,
["snoopq_requests.invalidate"] = 0x02b4,
["snoopq_requests_outstanding.code"] = 0x04b3,
["snoopq_requests_outstanding.code_not_empty"] = 0x04b3,
["snoopq_requests_outstanding.data"] = 0x01b3,
["snoopq_requests_outstanding.data_not_empty"] = 0x01b3,
["snoopq_requests_outstanding.invalidate"] = 0x02b3,
["snoopq_requests_outstanding.invalidate_not_empty"] = 0x02b3,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.lru_hints"] = 0x04f4,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["br_misp_retired.all_branches"] = 0x04c5,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-25", "V1", "core",
{
-- source: WSM-EP-SP/WestmereEP-SP_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.all_branches"] = 0x04c5,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_load_misses.walk_cycles"] = 0x0408,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.large_walk_completed"] = 0x8049,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["dtlb_misses.walk_cycles"] = 0x0449,
["ept.walk_cycles"] = 0x104f,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_cycles"] = 0x0485,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_block.overlap_store"] = 0x0203,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["mem_uncore_retired.local_dram"] = 0x100f,
["mem_uncore_retired.other_core_l2_hitm"] = 0x020f,
["mem_uncore_retired.remote_cache_local_home_hit"] = 0x080f,
["mem_uncore_retired.remote_dram"] = 0x200f,
["mem_uncore_retired.uncacheable"] = 0x800f,
["offcore_requests.any"] = 0x80b0,
["offcore_requests.any.read"] = 0x08b0,
["offcore_requests.any.rfo"] = 0x10b0,
["offcore_requests.demand.read_code"] = 0x02b0,
["offcore_requests.demand.read_data"] = 0x01b0,
["offcore_requests.demand.rfo"] = 0x04b0,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests.uncached_mem"] = 0x20b0,
["offcore_requests_outstanding.any.read"] = 0x0860,
["offcore_requests_outstanding.any.read_not_empty"] = 0x0860,
["offcore_requests_outstanding.demand.read_code"] = 0x0260,
["offcore_requests_outstanding.demand.read_code_not_empty"] = 0x0260,
["offcore_requests_outstanding.demand.read_data"] = 0x0160,
["offcore_requests_outstanding.demand.read_data_not_empty"] = 0x0160,
["offcore_requests_outstanding.demand.rfo"] = 0x0460,
["offcore_requests_outstanding.demand.rfo_not_empty"] = 0x0460,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["snoopq_requests.code"] = 0x04b4,
["snoopq_requests.data"] = 0x01b4,
["snoopq_requests.invalidate"] = 0x02b4,
["snoopq_requests_outstanding.code"] = 0x04b3,
["snoopq_requests_outstanding.code_not_empty"] = 0x04b3,
["snoopq_requests_outstanding.data"] = 0x01b3,
["snoopq_requests_outstanding.data_not_empty"] = 0x01b3,
["snoopq_requests_outstanding.invalidate"] = 0x02b3,
["snoopq_requests_outstanding.invalidate_not_empty"] = 0x02b3,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.lru_hints"] = 0x04f4,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["br_misp_retired.all_branches"] = 0x04c5,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-2C", "V1", "core",
{
-- source: WSM-EP-DP/WestmereEP-DP_core_V1.tsv
["arith.cycles_div_busy"] = 0x0114,
["arith.div"] = 0x0114,
["arith.mul"] = 0x0214,
["baclear.bad_target"] = 0x02e6,
["baclear.clear"] = 0x01e6,
["baclear_force_iq"] = 0x01a7,
["bpu_clears.early"] = 0x01e8,
["bpu_clears.late"] = 0x02e8,
["bpu_missed_call_ret"] = 0x01e5,
["br_inst_decoded"] = 0x01e0,
["br_inst_exec.any"] = 0x7f88,
["br_inst_exec.cond"] = 0x0188,
["br_inst_exec.direct"] = 0x0288,
["br_inst_exec.direct_near_call"] = 0x1088,
["br_inst_exec.indirect_near_call"] = 0x2088,
["br_inst_exec.indirect_non_call"] = 0x0488,
["br_inst_exec.near_calls"] = 0x3088,
["br_inst_exec.non_calls"] = 0x0788,
["br_inst_exec.return_near"] = 0x0888,
["br_inst_exec.taken"] = 0x4088,
["br_inst_retired.all_branches"] = 0x04c4,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_exec.any"] = 0x7f89,
["br_misp_exec.cond"] = 0x0189,
["br_misp_exec.direct"] = 0x0289,
["br_misp_exec.direct_near_call"] = 0x1089,
["br_misp_exec.indirect_near_call"] = 0x2089,
["br_misp_exec.indirect_non_call"] = 0x0489,
["br_misp_exec.near_calls"] = 0x3089,
["br_misp_exec.non_calls"] = 0x0789,
["br_misp_exec.return_near"] = 0x0889,
["br_misp_exec.taken"] = 0x4089,
["br_misp_retired.all_branches"] = 0x04c5,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.near_call"] = 0x02c5,
["cache_lock_cycles.l1d"] = 0x0263,
["cache_lock_cycles.l1d_l2"] = 0x0163,
["cpu_clk_unhalted.ref"] = 0x0000,
["cpu_clk_unhalted.ref_p"] = 0x013c,
["cpu_clk_unhalted.thread"] = 0x0000,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_unhalted.total_cycles"] = 0x003c,
["dtlb_load_misses.any"] = 0x0108,
["dtlb_load_misses.large_walk_completed"] = 0x8008,
["dtlb_load_misses.pde_miss"] = 0x2008,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_load_misses.walk_cycles"] = 0x0408,
["dtlb_misses.any"] = 0x0149,
["dtlb_misses.large_walk_completed"] = 0x8049,
["dtlb_misses.pde_miss"] = 0x2049,
["dtlb_misses.stlb_hit"] = 0x1049,
["dtlb_misses.walk_completed"] = 0x0249,
["dtlb_misses.walk_cycles"] = 0x0449,
["ept.walk_cycles"] = 0x104f,
["es_reg_renames"] = 0x01d5,
["fp_assist.all"] = 0x01f7,
["fp_assist.input"] = 0x04f7,
["fp_assist.output"] = 0x02f7,
["fp_comp_ops_exe.mmx"] = 0x0210,
["fp_comp_ops_exe.sse_double_precision"] = 0x8010,
["fp_comp_ops_exe.sse_fp"] = 0x0410,
["fp_comp_ops_exe.sse_fp_packed"] = 0x1010,
["fp_comp_ops_exe.sse_fp_scalar"] = 0x2010,
["fp_comp_ops_exe.sse_single_precision"] = 0x4010,
["fp_comp_ops_exe.sse2_integer"] = 0x0810,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_mmx_trans.any"] = 0x03cc,
["fp_mmx_trans.to_fp"] = 0x01cc,
["fp_mmx_trans.to_mmx"] = 0x02cc,
["ild_stall.any"] = 0x0f87,
["ild_stall.iq_full"] = 0x0487,
["ild_stall.lcp"] = 0x0187,
["ild_stall.mru"] = 0x0287,
["ild_stall.regen"] = 0x0887,
["inst_decoded.dec0"] = 0x0118,
["inst_queue_write_cycles"] = 0x011e,
["inst_queue_writes"] = 0x0117,
["inst_retired.any"] = 0x0000,
["inst_retired.any_p"] = 0x01c0,
["inst_retired.mmx"] = 0x04c0,
["inst_retired.total_cycles"] = 0x01c0,
["inst_retired.x87"] = 0x02c0,
["io_transactions"] = 0x016c,
["itlb_flush"] = 0x01ae,
["itlb_miss_retired"] = 0x20c8,
["itlb_misses.any"] = 0x0185,
["itlb_misses.large_walk_completed"] = 0x8085,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_cycles"] = 0x0485,
["l1d.m_evict"] = 0x0451,
["l1d.m_repl"] = 0x0251,
["l1d.m_snoop_evict"] = 0x0851,
["l1d.repl"] = 0x0151,
["l1d_cache_prefetch_lock_fb_hit"] = 0x0152,
["l1d_prefetch.miss"] = 0x024e,
["l1d_prefetch.requests"] = 0x014e,
["l1d_prefetch.triggers"] = 0x044e,
["l1d_wb_l2.e_state"] = 0x0428,
["l1d_wb_l2.i_state"] = 0x0128,
["l1d_wb_l2.m_state"] = 0x0828,
["l1d_wb_l2.mesi"] = 0x0f28,
["l1d_wb_l2.s_state"] = 0x0228,
["l1i.cycles_stalled"] = 0x0480,
["l1i.hits"] = 0x0180,
["l1i.misses"] = 0x0280,
["l1i.reads"] = 0x0380,
["l2_data_rqsts.any"] = 0xff26,
["l2_data_rqsts.demand.e_state"] = 0x0426,
["l2_data_rqsts.demand.i_state"] = 0x0126,
["l2_data_rqsts.demand.m_state"] = 0x0826,
["l2_data_rqsts.demand.mesi"] = 0x0f26,
["l2_data_rqsts.demand.s_state"] = 0x0226,
["l2_data_rqsts.prefetch.e_state"] = 0x4026,
["l2_data_rqsts.prefetch.i_state"] = 0x1026,
["l2_data_rqsts.prefetch.m_state"] = 0x8026,
["l2_data_rqsts.prefetch.mesi"] = 0xf026,
["l2_data_rqsts.prefetch.s_state"] = 0x2026,
["l2_lines_in.any"] = 0x07f1,
["l2_lines_in.e_state"] = 0x04f1,
["l2_lines_in.s_state"] = 0x02f1,
["l2_lines_out.any"] = 0x0ff2,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.prefetch_clean"] = 0x04f2,
["l2_lines_out.prefetch_dirty"] = 0x08f2,
["l2_rqsts.ifetch_hit"] = 0x1024,
["l2_rqsts.ifetch_miss"] = 0x2024,
["l2_rqsts.ifetches"] = 0x3024,
["l2_rqsts.ld_hit"] = 0x0124,
["l2_rqsts.ld_miss"] = 0x0224,
["l2_rqsts.loads"] = 0x0324,
["l2_rqsts.miss"] = 0xaa24,
["l2_rqsts.prefetch_hit"] = 0x4024,
["l2_rqsts.prefetch_miss"] = 0x8024,
["l2_rqsts.prefetches"] = 0xc024,
["l2_rqsts.references"] = 0xff24,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.rfos"] = 0x0c24,
["l2_transactions.any"] = 0x80f0,
["l2_transactions.fill"] = 0x20f0,
["l2_transactions.ifetch"] = 0x04f0,
["l2_transactions.l1d_wb"] = 0x10f0,
["l2_transactions.load"] = 0x01f0,
["l2_transactions.prefetch"] = 0x08f0,
["l2_transactions.rfo"] = 0x02f0,
["l2_transactions.wb"] = 0x40f0,
["l2_write.lock.e_state"] = 0x4027,
["l2_write.lock.hit"] = 0xe027,
["l2_write.lock.i_state"] = 0x1027,
["l2_write.lock.m_state"] = 0x8027,
["l2_write.lock.mesi"] = 0xf027,
["l2_write.lock.s_state"] = 0x2027,
["l2_write.rfo.hit"] = 0x0e27,
["l2_write.rfo.i_state"] = 0x0127,
["l2_write.rfo.m_state"] = 0x0827,
["l2_write.rfo.mesi"] = 0x0f27,
["l2_write.rfo.s_state"] = 0x0227,
["large_itlb.hit"] = 0x0182,
["load_block.overlap_store"] = 0x0203,
["load_dispatch.any"] = 0x0713,
["load_dispatch.mob"] = 0x0413,
["load_dispatch.rs"] = 0x0113,
["load_dispatch.rs_delayed"] = 0x0213,
["load_hit_pre"] = 0x014c,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["lsd.active"] = 0x01a8,
["lsd.inactive"] = 0x01a8,
["lsd_overflow"] = 0x0120,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.mem_order"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["macro_insts.decoded"] = 0x01d0,
["macro_insts.fusions_decoded"] = 0x01a6,
["mem_inst_retired.loads"] = 0x010b,
["mem_inst_retired.stores"] = 0x020b,
["mem_load_retired.dtlb_miss"] = 0x80cb,
["mem_load_retired.hit_lfb"] = 0x40cb,
["mem_load_retired.l1d_hit"] = 0x01cb,
["mem_load_retired.l2_hit"] = 0x02cb,
["mem_load_retired.llc_miss"] = 0x10cb,
["mem_load_retired.llc_unshared_hit"] = 0x04cb,
["mem_load_retired.other_core_l2_hit_hitm"] = 0x08cb,
["mem_store_retired.dtlb_miss"] = 0x010c,
["misalign_mem_ref.store"] = 0x0205,
["offcore_requests.any"] = 0x80b0,
["offcore_requests.any.read"] = 0x08b0,
["offcore_requests.any.rfo"] = 0x10b0,
["offcore_requests.demand.read_code"] = 0x02b0,
["offcore_requests.demand.read_data"] = 0x01b0,
["offcore_requests.demand.rfo"] = 0x04b0,
["offcore_requests.l1d_writeback"] = 0x40b0,
["offcore_requests_outstanding.any.read"] = 0x0860,
["offcore_requests_outstanding.any.read_not_empty"] = 0x0860,
["offcore_requests_outstanding.demand.read_code"] = 0x0260,
["offcore_requests_outstanding.demand.read_code_not_empty"] = 0x0260,
["offcore_requests_outstanding.demand.read_data"] = 0x0160,
["offcore_requests_outstanding.demand.read_data_not_empty"] = 0x0160,
["offcore_requests_outstanding.demand.rfo"] = 0x0460,
["offcore_requests_outstanding.demand.rfo_not_empty"] = 0x0460,
["offcore_requests_sq_full"] = 0x01b2,
["partial_address_alias"] = 0x0107,
["rat_stalls.any"] = 0x0fd2,
["rat_stalls.flags"] = 0x01d2,
["rat_stalls.registers"] = 0x02d2,
["rat_stalls.rob_read_port"] = 0x04d2,
["rat_stalls.scoreboard"] = 0x08d2,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.fpcw"] = 0x20a2,
["resource_stalls.load"] = 0x02a2,
["resource_stalls.mxcsr"] = 0x40a2,
["resource_stalls.other"] = 0x80a2,
["resource_stalls.rob_full"] = 0x10a2,
["resource_stalls.rs_full"] = 0x04a2,
["resource_stalls.store"] = 0x08a2,
["sb_drain.any"] = 0x0704,
["seg_rename_stalls"] = 0x01d4,
["simd_int_128.pack"] = 0x0412,
["simd_int_128.packed_arith"] = 0x2012,
["simd_int_128.packed_logical"] = 0x1012,
["simd_int_128.packed_mpy"] = 0x0112,
["simd_int_128.packed_shift"] = 0x0212,
["simd_int_128.shuffle_move"] = 0x4012,
["simd_int_128.unpack"] = 0x0812,
["simd_int_64.pack"] = 0x04fd,
["simd_int_64.packed_arith"] = 0x20fd,
["simd_int_64.packed_logical"] = 0x10fd,
["simd_int_64.packed_mpy"] = 0x01fd,
["simd_int_64.packed_shift"] = 0x02fd,
["simd_int_64.shuffle_move"] = 0x40fd,
["simd_int_64.unpack"] = 0x08fd,
["snoop_response.hit"] = 0x01b8,
["snoop_response.hite"] = 0x02b8,
["snoop_response.hitm"] = 0x04b8,
["snoopq_requests.code"] = 0x04b4,
["snoopq_requests.data"] = 0x01b4,
["snoopq_requests.invalidate"] = 0x02b4,
["snoopq_requests_outstanding.code"] = 0x04b3,
["snoopq_requests_outstanding.code_not_empty"] = 0x04b3,
["snoopq_requests_outstanding.data"] = 0x01b3,
["snoopq_requests_outstanding.data_not_empty"] = 0x01b3,
["snoopq_requests_outstanding.invalidate"] = 0x02b3,
["snoopq_requests_outstanding.invalidate_not_empty"] = 0x02b3,
["sq_full_stall_cycles"] = 0x01f6,
["sq_misc.lru_hints"] = 0x04f4,
["sq_misc.split_lock"] = 0x10f4,
["ssex_uops_retired.packed_double"] = 0x04c7,
["ssex_uops_retired.packed_single"] = 0x01c7,
["ssex_uops_retired.scalar_double"] = 0x08c7,
["ssex_uops_retired.scalar_single"] = 0x02c7,
["ssex_uops_retired.vector_integer"] = 0x10c7,
["store_blocks.at_ret"] = 0x0406,
["store_blocks.l1d_block"] = 0x0806,
["two_uop_insts_decoded"] = 0x0119,
["uop_unfusion"] = 0x01db,
["uops_decoded.esp_folding"] = 0x04d1,
["uops_decoded.esp_sync"] = 0x08d1,
["uops_decoded.ms_cycles_active"] = 0x02d1,
["uops_decoded.stall_cycles"] = 0x01d1,
["uops_executed.core_active_cycles"] = 0x3fb1,
["uops_executed.core_active_cycles_no_port5"] = 0x1fb1,
["uops_executed.core_stall_count"] = 0x3fb1,
["uops_executed.core_stall_count_no_port5"] = 0x1fb1,
["uops_executed.core_stall_cycles"] = 0x3fb1,
["uops_executed.core_stall_cycles_no_port5"] = 0x1fb1,
["uops_executed.port0"] = 0x01b1,
["uops_executed.port015"] = 0x40b1,
["uops_executed.port015_stall_cycles"] = 0x40b1,
["uops_executed.port1"] = 0x02b1,
["uops_executed.port2_core"] = 0x04b1,
["uops_executed.port234_core"] = 0x80b1,
["uops_executed.port3_core"] = 0x08b1,
["uops_executed.port4_core"] = 0x10b1,
["uops_executed.port5"] = 0x20b1,
["uops_issued.any"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.cycles_all_threads"] = 0x010e,
["uops_issued.fused"] = 0x020e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_retired.active_cycles"] = 0x01c2,
["uops_retired.any"] = 0x01c2,
["uops_retired.macro_fused"] = 0x04c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.all_branches"] = 0x04c4,
["br_misp_retired.all_branches"] = 0x04c5,
["mem_inst_retired.latency_above_threshold_0"] = 0x100b,
["mem_inst_retired.latency_above_threshold_1024"] = 0x100b,
["mem_inst_retired.latency_above_threshold_128"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16"] = 0x100b,
["mem_inst_retired.latency_above_threshold_16384"] = 0x100b,
["mem_inst_retired.latency_above_threshold_2048"] = 0x100b,
["mem_inst_retired.latency_above_threshold_256"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32"] = 0x100b,
["mem_inst_retired.latency_above_threshold_32768"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4"] = 0x100b,
["mem_inst_retired.latency_above_threshold_4096"] = 0x100b,
["mem_inst_retired.latency_above_threshold_512"] = 0x100b,
["mem_inst_retired.latency_above_threshold_64"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8"] = 0x100b,
["mem_inst_retired.latency_above_threshold_8192"] = 0x100b,
},
},
{"GenuineIntel-6-37", "V8", "core",
{
-- source: SLM/Silvermont_core_V10.tsv
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.jcc"] = 0x7ec4,
["br_inst_retired.taken_jcc"] = 0xfec4,
["br_inst_retired.call"] = 0xf9c4,
["br_inst_retired.rel_call"] = 0xfdc4,
["br_inst_retired.ind_call"] = 0xfbc4,
["br_inst_retired.return"] = 0xf7c4,
["br_inst_retired.non_return_ind"] = 0xebc4,
["br_inst_retired.far_branch"] = 0xbfc4,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.jcc"] = 0x7ec5,
["br_misp_retired.taken_jcc"] = 0xfec5,
["br_misp_retired.ind_call"] = 0xfbc5,
["br_misp_retired.return"] = 0xf7c5,
["br_misp_retired.non_return_ind"] = 0xebc5,
["uops_retired.ms"] = 0x01c2,
["uops_retired.all"] = 0x10c2,
["machine_clears.smc"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.fp_assist"] = 0x04c3,
["machine_clears.all"] = 0x08c3,
["no_alloc_cycles.rob_full"] = 0x01ca,
["no_alloc_cycles.mispredicts"] = 0x04ca,
["no_alloc_cycles.rat_stall"] = 0x20ca,
["no_alloc_cycles.not_delivered"] = 0x50ca,
["no_alloc_cycles.all"] = 0x3fca,
["rs_full_stall.mec"] = 0x01cb,
["rs_full_stall.all"] = 0x1fcb,
["inst_retired.any_p"] = 0x00c0,
["cycles_div_busy.all"] = 0x01cd,
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.core"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.ref"] = 0x013c,
["l2_reject_xq.all"] = 0x0030,
["core_reject_l2q.all"] = 0x0031,
["longest_lat_cache.reference"] = 0x4f2e,
["longest_lat_cache.miss"] = 0x412e,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["fetch_stall.icache_fill_pending_cycles"] = 0x0486,
["baclears.all"] = 0x01e6,
["baclears.return"] = 0x08e6,
["baclears.cond"] = 0x10e6,
["ms_decoded.ms_entry"] = 0x01e7,
["decode_restriction.predecode_wrong"] = 0x01e9,
["rehabq.ld_block_st_forward"] = 0x0103,
["rehabq.ld_block_std_notready"] = 0x0203,
["rehabq.st_splits"] = 0x0403,
["rehabq.ld_splits"] = 0x0803,
["rehabq.lock"] = 0x1003,
["rehabq.sta_full"] = 0x2003,
["rehabq.any_ld"] = 0x4003,
["rehabq.any_st"] = 0x8003,
["mem_uops_retired.l1_miss_loads"] = 0x0104,
["mem_uops_retired.l2_hit_loads"] = 0x0204,
["mem_uops_retired.l2_miss_loads"] = 0x0404,
["mem_uops_retired.dtlb_miss_loads"] = 0x0804,
["mem_uops_retired.utlb_miss"] = 0x1004,
["mem_uops_retired.hitm"] = 0x2004,
["mem_uops_retired.all_loads"] = 0x4004,
["mem_uops_retired.all_stores"] = 0x8004,
["page_walks.d_side_walks"] = 0x0105,
["page_walks.d_side_cycles"] = 0x0105,
["page_walks.i_side_walks"] = 0x0205,
["page_walks.i_side_cycles"] = 0x0205,
["page_walks.walks"] = 0x0305,
["page_walks.cycles"] = 0x0305,
["offcore_response"] = 0x01b7,
},
},
{"GenuineIntel-6-37", "V8", "offcore",
{
-- source: SLM/Silvermont_matrix_V10.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-4D", "V8", "core",
{
-- source: SLM/Silvermont_core_V10.tsv
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.jcc"] = 0x7ec4,
["br_inst_retired.taken_jcc"] = 0xfec4,
["br_inst_retired.call"] = 0xf9c4,
["br_inst_retired.rel_call"] = 0xfdc4,
["br_inst_retired.ind_call"] = 0xfbc4,
["br_inst_retired.return"] = 0xf7c4,
["br_inst_retired.non_return_ind"] = 0xebc4,
["br_inst_retired.far_branch"] = 0xbfc4,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.jcc"] = 0x7ec5,
["br_misp_retired.taken_jcc"] = 0xfec5,
["br_misp_retired.ind_call"] = 0xfbc5,
["br_misp_retired.return"] = 0xf7c5,
["br_misp_retired.non_return_ind"] = 0xebc5,
["uops_retired.ms"] = 0x01c2,
["uops_retired.all"] = 0x10c2,
["machine_clears.smc"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.fp_assist"] = 0x04c3,
["machine_clears.all"] = 0x08c3,
["no_alloc_cycles.rob_full"] = 0x01ca,
["no_alloc_cycles.mispredicts"] = 0x04ca,
["no_alloc_cycles.rat_stall"] = 0x20ca,
["no_alloc_cycles.not_delivered"] = 0x50ca,
["no_alloc_cycles.all"] = 0x3fca,
["rs_full_stall.mec"] = 0x01cb,
["rs_full_stall.all"] = 0x1fcb,
["inst_retired.any_p"] = 0x00c0,
["cycles_div_busy.all"] = 0x01cd,
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.core"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.ref"] = 0x013c,
["l2_reject_xq.all"] = 0x0030,
["core_reject_l2q.all"] = 0x0031,
["longest_lat_cache.reference"] = 0x4f2e,
["longest_lat_cache.miss"] = 0x412e,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["fetch_stall.icache_fill_pending_cycles"] = 0x0486,
["baclears.all"] = 0x01e6,
["baclears.return"] = 0x08e6,
["baclears.cond"] = 0x10e6,
["ms_decoded.ms_entry"] = 0x01e7,
["decode_restriction.predecode_wrong"] = 0x01e9,
["rehabq.ld_block_st_forward"] = 0x0103,
["rehabq.ld_block_std_notready"] = 0x0203,
["rehabq.st_splits"] = 0x0403,
["rehabq.ld_splits"] = 0x0803,
["rehabq.lock"] = 0x1003,
["rehabq.sta_full"] = 0x2003,
["rehabq.any_ld"] = 0x4003,
["rehabq.any_st"] = 0x8003,
["mem_uops_retired.l1_miss_loads"] = 0x0104,
["mem_uops_retired.l2_hit_loads"] = 0x0204,
["mem_uops_retired.l2_miss_loads"] = 0x0404,
["mem_uops_retired.dtlb_miss_loads"] = 0x0804,
["mem_uops_retired.utlb_miss"] = 0x1004,
["mem_uops_retired.hitm"] = 0x2004,
["mem_uops_retired.all_loads"] = 0x4004,
["mem_uops_retired.all_stores"] = 0x8004,
["page_walks.d_side_walks"] = 0x0105,
["page_walks.d_side_cycles"] = 0x0105,
["page_walks.i_side_walks"] = 0x0205,
["page_walks.i_side_cycles"] = 0x0205,
["page_walks.walks"] = 0x0305,
["page_walks.cycles"] = 0x0305,
["offcore_response"] = 0x01b7,
},
},
{"GenuineIntel-6-4D", "V8", "offcore",
{
-- source: SLM/Silvermont_matrix_V10.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-1C", "V1", "core",
{
-- source: BNL/Bonnell_core_V1.tsv
["store_forwards.any"] = 0x8302,
["store_forwards.good"] = 0x8102,
["reissue.any"] = 0x7f03,
["reissue.any.ar"] = 0xff03,
["misalign_mem_ref.split"] = 0x0f05,
["misalign_mem_ref.ld_split"] = 0x0905,
["misalign_mem_ref.st_split"] = 0x0a05,
["misalign_mem_ref.split.ar"] = 0x8f05,
["misalign_mem_ref.ld_split.ar"] = 0x8905,
["misalign_mem_ref.st_split.ar"] = 0x8a05,
["misalign_mem_ref.rmw_split"] = 0x8c05,
["misalign_mem_ref.bubble"] = 0x9705,
["misalign_mem_ref.ld_bubble"] = 0x9105,
["misalign_mem_ref.st_bubble"] = 0x9205,
["misalign_mem_ref.rmw_bubble"] = 0x9405,
["segment_reg_loads.any"] = 0x8006,
["prefetch.prefetcht0"] = 0x8107,
["prefetch.prefetcht1"] = 0x8207,
["prefetch.prefetcht2"] = 0x8407,
["prefetch.sw_l2"] = 0x8607,
["prefetch.prefetchnta"] = 0x8807,
["prefetch.hw_prefetch"] = 0x1007,
["prefetch.software_prefetch"] = 0x0f07,
["prefetch.software_prefetch.ar"] = 0x8f07,
["data_tlb_misses.dtlb_miss"] = 0x0708,
["data_tlb_misses.dtlb_miss_ld"] = 0x0508,
["data_tlb_misses.l0_dtlb_miss_ld"] = 0x0908,
["data_tlb_misses.dtlb_miss_st"] = 0x0608,
["data_tlb_misses.l0_dtlb_miss_st"] = 0x0a08,
["dispatch_blocked.any"] = 0x2009,
["page_walks.walks"] = 0x030c,
["page_walks.cycles"] = 0x030c,
["page_walks.d_side_walks"] = 0x010c,
["page_walks.d_side_cycles"] = 0x010c,
["page_walks.i_side_walks"] = 0x020c,
["page_walks.i_side_cycles"] = 0x020c,
["x87_comp_ops_exe.any.s"] = 0x0110,
["x87_comp_ops_exe.any.ar"] = 0x8110,
["x87_comp_ops_exe.fxch.s"] = 0x0210,
["x87_comp_ops_exe.fxch.ar"] = 0x8210,
["fp_assist.s"] = 0x0111,
["fp_assist.ar"] = 0x8111,
["mul.s"] = 0x0112,
["mul.ar"] = 0x8112,
["div.s"] = 0x0113,
["div.ar"] = 0x8113,
["cycles_div_busy"] = 0x0114,
["l2_ads.self"] = 0x4021,
["l2_dbus_busy.self"] = 0x4022,
["l2_dbus_busy_rd.self"] = 0x4023,
["l2_lines_in.self.any"] = 0x7024,
["l2_lines_in.self.demand"] = 0x4024,
["l2_lines_in.self.prefetch"] = 0x5024,
["l2_m_lines_in.self"] = 0x4025,
["l2_lines_out.self.any"] = 0x7026,
["l2_lines_out.self.demand"] = 0x4026,
["l2_lines_out.self.prefetch"] = 0x5026,
["l2_m_lines_out.self.any"] = 0x7027,
["l2_m_lines_out.self.demand"] = 0x4027,
["l2_m_lines_out.self.prefetch"] = 0x5027,
["l2_ifetch.self.e_state"] = 0x4428,
["l2_ifetch.self.i_state"] = 0x4128,
["l2_ifetch.self.m_state"] = 0x4828,
["l2_ifetch.self.s_state"] = 0x4228,
["l2_ifetch.self.mesi"] = 0x4f28,
["l2_ld.self.any.e_state"] = 0x7429,
["l2_ld.self.any.i_state"] = 0x7129,
["l2_ld.self.any.m_state"] = 0x7829,
["l2_ld.self.any.s_state"] = 0x7229,
["l2_ld.self.any.mesi"] = 0x7f29,
["l2_ld.self.demand.e_state"] = 0x4429,
["l2_ld.self.demand.i_state"] = 0x4129,
["l2_ld.self.demand.m_state"] = 0x4829,
["l2_ld.self.demand.s_state"] = 0x4229,
["l2_ld.self.demand.mesi"] = 0x4f29,
["l2_ld.self.prefetch.e_state"] = 0x5429,
["l2_ld.self.prefetch.i_state"] = 0x5129,
["l2_ld.self.prefetch.m_state"] = 0x5829,
["l2_ld.self.prefetch.s_state"] = 0x5229,
["l2_ld.self.prefetch.mesi"] = 0x5f29,
["l2_st.self.e_state"] = 0x442a,
["l2_st.self.i_state"] = 0x412a,
["l2_st.self.m_state"] = 0x482a,
["l2_st.self.s_state"] = 0x422a,
["l2_st.self.mesi"] = 0x4f2a,
["l2_lock.self.e_state"] = 0x442b,
["l2_lock.self.i_state"] = 0x412b,
["l2_lock.self.m_state"] = 0x482b,
["l2_lock.self.s_state"] = 0x422b,
["l2_lock.self.mesi"] = 0x4f2b,
["l2_data_rqsts.self.e_state"] = 0x442c,
["l2_data_rqsts.self.i_state"] = 0x412c,
["l2_data_rqsts.self.m_state"] = 0x482c,
["l2_data_rqsts.self.s_state"] = 0x422c,
["l2_data_rqsts.self.mesi"] = 0x4f2c,
["l2_ld_ifetch.self.e_state"] = 0x442d,
["l2_ld_ifetch.self.i_state"] = 0x412d,
["l2_ld_ifetch.self.m_state"] = 0x482d,
["l2_ld_ifetch.self.s_state"] = 0x422d,
["l2_ld_ifetch.self.mesi"] = 0x4f2d,
["l2_rqsts.self.any.e_state"] = 0x742e,
["l2_rqsts.self.any.i_state"] = 0x712e,
["l2_rqsts.self.any.m_state"] = 0x782e,
["l2_rqsts.self.any.s_state"] = 0x722e,
["l2_rqsts.self.any.mesi"] = 0x7f2e,
["l2_rqsts.self.demand.e_state"] = 0x442e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.m_state"] = 0x482e,
["l2_rqsts.self.demand.s_state"] = 0x422e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_rqsts.self.prefetch.e_state"] = 0x542e,
["l2_rqsts.self.prefetch.i_state"] = 0x512e,
["l2_rqsts.self.prefetch.m_state"] = 0x582e,
["l2_rqsts.self.prefetch.s_state"] = 0x522e,
["l2_rqsts.self.prefetch.mesi"] = 0x5f2e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_reject_busq.self.any.e_state"] = 0x7430,
["l2_reject_busq.self.any.i_state"] = 0x7130,
["l2_reject_busq.self.any.m_state"] = 0x7830,
["l2_reject_busq.self.any.s_state"] = 0x7230,
["l2_reject_busq.self.any.mesi"] = 0x7f30,
["l2_reject_busq.self.demand.e_state"] = 0x4430,
["l2_reject_busq.self.demand.i_state"] = 0x4130,
["l2_reject_busq.self.demand.m_state"] = 0x4830,
["l2_reject_busq.self.demand.s_state"] = 0x4230,
["l2_reject_busq.self.demand.mesi"] = 0x4f30,
["l2_reject_busq.self.prefetch.e_state"] = 0x5430,
["l2_reject_busq.self.prefetch.i_state"] = 0x5130,
["l2_reject_busq.self.prefetch.m_state"] = 0x5830,
["l2_reject_busq.self.prefetch.s_state"] = 0x5230,
["l2_reject_busq.self.prefetch.mesi"] = 0x5f30,
["l2_no_req.self"] = 0x4032,
["eist_trans"] = 0x003a,
["thermal_trip"] = 0xc03b,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.bus"] = 0x013c,
["cpu_clk_unhalted.core"] = 0x000a,
["cpu_clk_unhalted.ref"] = 0x000a,
["l1d_cache.ld"] = 0xa140,
["l1d_cache.st"] = 0xa240,
["l1d_cache.all_ref"] = 0x8340,
["l1d_cache.all_cache_ref"] = 0xa340,
["l1d_cache.repl"] = 0x0840,
["l1d_cache.replm"] = 0x4840,
["l1d_cache.evict"] = 0x1040,
["bus_request_outstanding.all_agents"] = 0xe060,
["bus_request_outstanding.self"] = 0x4060,
["bus_bnr_drv.all_agents"] = 0x2061,
["bus_bnr_drv.this_agent"] = 0x0061,
["bus_drdy_clocks.all_agents"] = 0x2062,
["bus_drdy_clocks.this_agent"] = 0x0062,
["bus_lock_clocks.all_agents"] = 0xe063,
["bus_lock_clocks.self"] = 0x4063,
["bus_data_rcv.self"] = 0x4064,
["bus_trans_brd.all_agents"] = 0xe065,
["bus_trans_brd.self"] = 0x4065,
["bus_trans_rfo.all_agents"] = 0xe066,
["bus_trans_rfo.self"] = 0x4066,
["bus_trans_wb.all_agents"] = 0xe067,
["bus_trans_wb.self"] = 0x4067,
["bus_trans_ifetch.all_agents"] = 0xe068,
["bus_trans_ifetch.self"] = 0x4068,
["bus_trans_inval.all_agents"] = 0xe069,
["bus_trans_inval.self"] = 0x4069,
["bus_trans_pwr.all_agents"] = 0xe06a,
["bus_trans_pwr.self"] = 0x406a,
["bus_trans_p.all_agents"] = 0xe06b,
["bus_trans_p.self"] = 0x406b,
["bus_trans_io.all_agents"] = 0xe06c,
["bus_trans_io.self"] = 0x406c,
["bus_trans_def.all_agents"] = 0xe06d,
["bus_trans_def.self"] = 0x406d,
["bus_trans_burst.all_agents"] = 0xe06e,
["bus_trans_burst.self"] = 0x406e,
["bus_trans_mem.all_agents"] = 0xe06f,
["bus_trans_mem.self"] = 0x406f,
["bus_trans_any.all_agents"] = 0xe070,
["bus_trans_any.self"] = 0x4070,
["ext_snoop.this_agent.any"] = 0x0b77,
["ext_snoop.this_agent.clean"] = 0x0177,
["ext_snoop.this_agent.hit"] = 0x0277,
["ext_snoop.this_agent.hitm"] = 0x0877,
["ext_snoop.all_agents.any"] = 0x2b77,
["ext_snoop.all_agents.clean"] = 0x2177,
["ext_snoop.all_agents.hit"] = 0x2277,
["ext_snoop.all_agents.hitm"] = 0x2877,
["bus_hit_drv.all_agents"] = 0x207a,
["bus_hit_drv.this_agent"] = 0x007a,
["bus_hitm_drv.all_agents"] = 0x207b,
["bus_hitm_drv.this_agent"] = 0x007b,
["busq_empty.self"] = 0x407d,
["snoop_stall_drv.all_agents"] = 0xe07e,
["snoop_stall_drv.self"] = 0x407e,
["bus_io_wait.self"] = 0x407f,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["itlb.hit"] = 0x0182,
["itlb.flush"] = 0x0482,
["itlb.misses"] = 0x0282,
["cycles_icache_mem_stalled.icache_mem_stalled"] = 0x0186,
["decode_stall.pfb_empty"] = 0x0187,
["decode_stall.iq_full"] = 0x0287,
["br_inst_type_retired.cond"] = 0x0188,
["br_inst_type_retired.uncond"] = 0x0288,
["br_inst_type_retired.ind"] = 0x0488,
["br_inst_type_retired.ret"] = 0x0888,
["br_inst_type_retired.dir_call"] = 0x1088,
["br_inst_type_retired.ind_call"] = 0x2088,
["br_inst_type_retired.cond_taken"] = 0x4188,
["br_missp_type_retired.cond"] = 0x0189,
["br_missp_type_retired.ind"] = 0x0289,
["br_missp_type_retired.return"] = 0x0489,
["br_missp_type_retired.ind_call"] = 0x0889,
["br_missp_type_retired.cond_taken"] = 0x1189,
["macro_insts.non_cisc_decoded"] = 0x01aa,
["macro_insts.cisc_decoded"] = 0x02aa,
["macro_insts.all_decoded"] = 0x03aa,
["simd_uops_exec.s"] = 0x00b0,
["simd_uops_exec.ar"] = 0x80b0,
["simd_sat_uop_exec.s"] = 0x00b1,
["simd_sat_uop_exec.ar"] = 0x80b1,
["simd_uop_type_exec.mul.s"] = 0x01b3,
["simd_uop_type_exec.mul.ar"] = 0x81b3,
["simd_uop_type_exec.shift.s"] = 0x02b3,
["simd_uop_type_exec.shift.ar"] = 0x82b3,
["simd_uop_type_exec.pack.s"] = 0x04b3,
["simd_uop_type_exec.pack.ar"] = 0x84b3,
["simd_uop_type_exec.unpack.s"] = 0x08b3,
["simd_uop_type_exec.unpack.ar"] = 0x88b3,
["simd_uop_type_exec.logical.s"] = 0x10b3,
["simd_uop_type_exec.logical.ar"] = 0x90b3,
["simd_uop_type_exec.arithmetic.s"] = 0x20b3,
["simd_uop_type_exec.arithmetic.ar"] = 0xa0b3,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.any"] = 0x000a,
["uops_retired.any"] = 0x10c2,
["uops_retired.stalled_cycles"] = 0x10c2,
["uops_retired.stalls"] = 0x10c2,
["uops.ms_cycles"] = 0x01a9,
["machine_clears.smc"] = 0x01c3,
["br_inst_retired.any"] = 0x00c4,
["br_inst_retired.pred_not_taken"] = 0x01c4,
["br_inst_retired.mispred_not_taken"] = 0x02c4,
["br_inst_retired.pred_taken"] = 0x04c4,
["br_inst_retired.mispred_taken"] = 0x08c4,
["br_inst_retired.taken"] = 0x0cc4,
["br_inst_retired.any1"] = 0x0fc4,
["br_inst_retired.mispred"] = 0x00c5,
["cycles_int_masked.cycles_int_masked"] = 0x01c6,
["cycles_int_masked.cycles_int_pending_and_masked"] = 0x02c6,
["simd_inst_retired.packed_single"] = 0x01c7,
["simd_inst_retired.scalar_single"] = 0x02c7,
["simd_inst_retired.scalar_double"] = 0x08c7,
["simd_inst_retired.vector"] = 0x10c7,
["hw_int_rcv"] = 0x00c8,
["simd_comp_inst_retired.packed_single"] = 0x01ca,
["simd_comp_inst_retired.scalar_single"] = 0x02ca,
["simd_comp_inst_retired.scalar_double"] = 0x08ca,
["mem_load_retired.l2_hit"] = 0x01cb,
["mem_load_retired.l2_miss"] = 0x02cb,
["mem_load_retired.dtlb_miss"] = 0x04cb,
["simd_assist"] = 0x00cd,
["simd_instr_retired"] = 0x00ce,
["simd_sat_instr_retired"] = 0x00cf,
["resource_stalls.div_busy"] = 0x02dc,
["br_inst_decoded"] = 0x01e0,
["bogus_br"] = 0x01e4,
["baclears.any"] = 0x01e6,
["reissue.overlap_store"] = 0x0103,
["reissue.overlap_store.ar"] = 0x8103,
},
},
{"GenuineIntel-6-26", "V1", "core",
{
-- source: BNL/Bonnell_core_V1.tsv
["store_forwards.any"] = 0x8302,
["store_forwards.good"] = 0x8102,
["reissue.any"] = 0x7f03,
["reissue.any.ar"] = 0xff03,
["misalign_mem_ref.split"] = 0x0f05,
["misalign_mem_ref.ld_split"] = 0x0905,
["misalign_mem_ref.st_split"] = 0x0a05,
["misalign_mem_ref.split.ar"] = 0x8f05,
["misalign_mem_ref.ld_split.ar"] = 0x8905,
["misalign_mem_ref.st_split.ar"] = 0x8a05,
["misalign_mem_ref.rmw_split"] = 0x8c05,
["misalign_mem_ref.bubble"] = 0x9705,
["misalign_mem_ref.ld_bubble"] = 0x9105,
["misalign_mem_ref.st_bubble"] = 0x9205,
["misalign_mem_ref.rmw_bubble"] = 0x9405,
["segment_reg_loads.any"] = 0x8006,
["prefetch.prefetcht0"] = 0x8107,
["prefetch.prefetcht1"] = 0x8207,
["prefetch.prefetcht2"] = 0x8407,
["prefetch.sw_l2"] = 0x8607,
["prefetch.prefetchnta"] = 0x8807,
["prefetch.hw_prefetch"] = 0x1007,
["prefetch.software_prefetch"] = 0x0f07,
["prefetch.software_prefetch.ar"] = 0x8f07,
["data_tlb_misses.dtlb_miss"] = 0x0708,
["data_tlb_misses.dtlb_miss_ld"] = 0x0508,
["data_tlb_misses.l0_dtlb_miss_ld"] = 0x0908,
["data_tlb_misses.dtlb_miss_st"] = 0x0608,
["data_tlb_misses.l0_dtlb_miss_st"] = 0x0a08,
["dispatch_blocked.any"] = 0x2009,
["page_walks.walks"] = 0x030c,
["page_walks.cycles"] = 0x030c,
["page_walks.d_side_walks"] = 0x010c,
["page_walks.d_side_cycles"] = 0x010c,
["page_walks.i_side_walks"] = 0x020c,
["page_walks.i_side_cycles"] = 0x020c,
["x87_comp_ops_exe.any.s"] = 0x0110,
["x87_comp_ops_exe.any.ar"] = 0x8110,
["x87_comp_ops_exe.fxch.s"] = 0x0210,
["x87_comp_ops_exe.fxch.ar"] = 0x8210,
["fp_assist.s"] = 0x0111,
["fp_assist.ar"] = 0x8111,
["mul.s"] = 0x0112,
["mul.ar"] = 0x8112,
["div.s"] = 0x0113,
["div.ar"] = 0x8113,
["cycles_div_busy"] = 0x0114,
["l2_ads.self"] = 0x4021,
["l2_dbus_busy.self"] = 0x4022,
["l2_dbus_busy_rd.self"] = 0x4023,
["l2_lines_in.self.any"] = 0x7024,
["l2_lines_in.self.demand"] = 0x4024,
["l2_lines_in.self.prefetch"] = 0x5024,
["l2_m_lines_in.self"] = 0x4025,
["l2_lines_out.self.any"] = 0x7026,
["l2_lines_out.self.demand"] = 0x4026,
["l2_lines_out.self.prefetch"] = 0x5026,
["l2_m_lines_out.self.any"] = 0x7027,
["l2_m_lines_out.self.demand"] = 0x4027,
["l2_m_lines_out.self.prefetch"] = 0x5027,
["l2_ifetch.self.e_state"] = 0x4428,
["l2_ifetch.self.i_state"] = 0x4128,
["l2_ifetch.self.m_state"] = 0x4828,
["l2_ifetch.self.s_state"] = 0x4228,
["l2_ifetch.self.mesi"] = 0x4f28,
["l2_ld.self.any.e_state"] = 0x7429,
["l2_ld.self.any.i_state"] = 0x7129,
["l2_ld.self.any.m_state"] = 0x7829,
["l2_ld.self.any.s_state"] = 0x7229,
["l2_ld.self.any.mesi"] = 0x7f29,
["l2_ld.self.demand.e_state"] = 0x4429,
["l2_ld.self.demand.i_state"] = 0x4129,
["l2_ld.self.demand.m_state"] = 0x4829,
["l2_ld.self.demand.s_state"] = 0x4229,
["l2_ld.self.demand.mesi"] = 0x4f29,
["l2_ld.self.prefetch.e_state"] = 0x5429,
["l2_ld.self.prefetch.i_state"] = 0x5129,
["l2_ld.self.prefetch.m_state"] = 0x5829,
["l2_ld.self.prefetch.s_state"] = 0x5229,
["l2_ld.self.prefetch.mesi"] = 0x5f29,
["l2_st.self.e_state"] = 0x442a,
["l2_st.self.i_state"] = 0x412a,
["l2_st.self.m_state"] = 0x482a,
["l2_st.self.s_state"] = 0x422a,
["l2_st.self.mesi"] = 0x4f2a,
["l2_lock.self.e_state"] = 0x442b,
["l2_lock.self.i_state"] = 0x412b,
["l2_lock.self.m_state"] = 0x482b,
["l2_lock.self.s_state"] = 0x422b,
["l2_lock.self.mesi"] = 0x4f2b,
["l2_data_rqsts.self.e_state"] = 0x442c,
["l2_data_rqsts.self.i_state"] = 0x412c,
["l2_data_rqsts.self.m_state"] = 0x482c,
["l2_data_rqsts.self.s_state"] = 0x422c,
["l2_data_rqsts.self.mesi"] = 0x4f2c,
["l2_ld_ifetch.self.e_state"] = 0x442d,
["l2_ld_ifetch.self.i_state"] = 0x412d,
["l2_ld_ifetch.self.m_state"] = 0x482d,
["l2_ld_ifetch.self.s_state"] = 0x422d,
["l2_ld_ifetch.self.mesi"] = 0x4f2d,
["l2_rqsts.self.any.e_state"] = 0x742e,
["l2_rqsts.self.any.i_state"] = 0x712e,
["l2_rqsts.self.any.m_state"] = 0x782e,
["l2_rqsts.self.any.s_state"] = 0x722e,
["l2_rqsts.self.any.mesi"] = 0x7f2e,
["l2_rqsts.self.demand.e_state"] = 0x442e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.m_state"] = 0x482e,
["l2_rqsts.self.demand.s_state"] = 0x422e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_rqsts.self.prefetch.e_state"] = 0x542e,
["l2_rqsts.self.prefetch.i_state"] = 0x512e,
["l2_rqsts.self.prefetch.m_state"] = 0x582e,
["l2_rqsts.self.prefetch.s_state"] = 0x522e,
["l2_rqsts.self.prefetch.mesi"] = 0x5f2e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_reject_busq.self.any.e_state"] = 0x7430,
["l2_reject_busq.self.any.i_state"] = 0x7130,
["l2_reject_busq.self.any.m_state"] = 0x7830,
["l2_reject_busq.self.any.s_state"] = 0x7230,
["l2_reject_busq.self.any.mesi"] = 0x7f30,
["l2_reject_busq.self.demand.e_state"] = 0x4430,
["l2_reject_busq.self.demand.i_state"] = 0x4130,
["l2_reject_busq.self.demand.m_state"] = 0x4830,
["l2_reject_busq.self.demand.s_state"] = 0x4230,
["l2_reject_busq.self.demand.mesi"] = 0x4f30,
["l2_reject_busq.self.prefetch.e_state"] = 0x5430,
["l2_reject_busq.self.prefetch.i_state"] = 0x5130,
["l2_reject_busq.self.prefetch.m_state"] = 0x5830,
["l2_reject_busq.self.prefetch.s_state"] = 0x5230,
["l2_reject_busq.self.prefetch.mesi"] = 0x5f30,
["l2_no_req.self"] = 0x4032,
["eist_trans"] = 0x003a,
["thermal_trip"] = 0xc03b,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.bus"] = 0x013c,
["cpu_clk_unhalted.core"] = 0x000a,
["cpu_clk_unhalted.ref"] = 0x000a,
["l1d_cache.ld"] = 0xa140,
["l1d_cache.st"] = 0xa240,
["l1d_cache.all_ref"] = 0x8340,
["l1d_cache.all_cache_ref"] = 0xa340,
["l1d_cache.repl"] = 0x0840,
["l1d_cache.replm"] = 0x4840,
["l1d_cache.evict"] = 0x1040,
["bus_request_outstanding.all_agents"] = 0xe060,
["bus_request_outstanding.self"] = 0x4060,
["bus_bnr_drv.all_agents"] = 0x2061,
["bus_bnr_drv.this_agent"] = 0x0061,
["bus_drdy_clocks.all_agents"] = 0x2062,
["bus_drdy_clocks.this_agent"] = 0x0062,
["bus_lock_clocks.all_agents"] = 0xe063,
["bus_lock_clocks.self"] = 0x4063,
["bus_data_rcv.self"] = 0x4064,
["bus_trans_brd.all_agents"] = 0xe065,
["bus_trans_brd.self"] = 0x4065,
["bus_trans_rfo.all_agents"] = 0xe066,
["bus_trans_rfo.self"] = 0x4066,
["bus_trans_wb.all_agents"] = 0xe067,
["bus_trans_wb.self"] = 0x4067,
["bus_trans_ifetch.all_agents"] = 0xe068,
["bus_trans_ifetch.self"] = 0x4068,
["bus_trans_inval.all_agents"] = 0xe069,
["bus_trans_inval.self"] = 0x4069,
["bus_trans_pwr.all_agents"] = 0xe06a,
["bus_trans_pwr.self"] = 0x406a,
["bus_trans_p.all_agents"] = 0xe06b,
["bus_trans_p.self"] = 0x406b,
["bus_trans_io.all_agents"] = 0xe06c,
["bus_trans_io.self"] = 0x406c,
["bus_trans_def.all_agents"] = 0xe06d,
["bus_trans_def.self"] = 0x406d,
["bus_trans_burst.all_agents"] = 0xe06e,
["bus_trans_burst.self"] = 0x406e,
["bus_trans_mem.all_agents"] = 0xe06f,
["bus_trans_mem.self"] = 0x406f,
["bus_trans_any.all_agents"] = 0xe070,
["bus_trans_any.self"] = 0x4070,
["ext_snoop.this_agent.any"] = 0x0b77,
["ext_snoop.this_agent.clean"] = 0x0177,
["ext_snoop.this_agent.hit"] = 0x0277,
["ext_snoop.this_agent.hitm"] = 0x0877,
["ext_snoop.all_agents.any"] = 0x2b77,
["ext_snoop.all_agents.clean"] = 0x2177,
["ext_snoop.all_agents.hit"] = 0x2277,
["ext_snoop.all_agents.hitm"] = 0x2877,
["bus_hit_drv.all_agents"] = 0x207a,
["bus_hit_drv.this_agent"] = 0x007a,
["bus_hitm_drv.all_agents"] = 0x207b,
["bus_hitm_drv.this_agent"] = 0x007b,
["busq_empty.self"] = 0x407d,
["snoop_stall_drv.all_agents"] = 0xe07e,
["snoop_stall_drv.self"] = 0x407e,
["bus_io_wait.self"] = 0x407f,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["itlb.hit"] = 0x0182,
["itlb.flush"] = 0x0482,
["itlb.misses"] = 0x0282,
["cycles_icache_mem_stalled.icache_mem_stalled"] = 0x0186,
["decode_stall.pfb_empty"] = 0x0187,
["decode_stall.iq_full"] = 0x0287,
["br_inst_type_retired.cond"] = 0x0188,
["br_inst_type_retired.uncond"] = 0x0288,
["br_inst_type_retired.ind"] = 0x0488,
["br_inst_type_retired.ret"] = 0x0888,
["br_inst_type_retired.dir_call"] = 0x1088,
["br_inst_type_retired.ind_call"] = 0x2088,
["br_inst_type_retired.cond_taken"] = 0x4188,
["br_missp_type_retired.cond"] = 0x0189,
["br_missp_type_retired.ind"] = 0x0289,
["br_missp_type_retired.return"] = 0x0489,
["br_missp_type_retired.ind_call"] = 0x0889,
["br_missp_type_retired.cond_taken"] = 0x1189,
["macro_insts.non_cisc_decoded"] = 0x01aa,
["macro_insts.cisc_decoded"] = 0x02aa,
["macro_insts.all_decoded"] = 0x03aa,
["simd_uops_exec.s"] = 0x00b0,
["simd_uops_exec.ar"] = 0x80b0,
["simd_sat_uop_exec.s"] = 0x00b1,
["simd_sat_uop_exec.ar"] = 0x80b1,
["simd_uop_type_exec.mul.s"] = 0x01b3,
["simd_uop_type_exec.mul.ar"] = 0x81b3,
["simd_uop_type_exec.shift.s"] = 0x02b3,
["simd_uop_type_exec.shift.ar"] = 0x82b3,
["simd_uop_type_exec.pack.s"] = 0x04b3,
["simd_uop_type_exec.pack.ar"] = 0x84b3,
["simd_uop_type_exec.unpack.s"] = 0x08b3,
["simd_uop_type_exec.unpack.ar"] = 0x88b3,
["simd_uop_type_exec.logical.s"] = 0x10b3,
["simd_uop_type_exec.logical.ar"] = 0x90b3,
["simd_uop_type_exec.arithmetic.s"] = 0x20b3,
["simd_uop_type_exec.arithmetic.ar"] = 0xa0b3,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.any"] = 0x000a,
["uops_retired.any"] = 0x10c2,
["uops_retired.stalled_cycles"] = 0x10c2,
["uops_retired.stalls"] = 0x10c2,
["uops.ms_cycles"] = 0x01a9,
["machine_clears.smc"] = 0x01c3,
["br_inst_retired.any"] = 0x00c4,
["br_inst_retired.pred_not_taken"] = 0x01c4,
["br_inst_retired.mispred_not_taken"] = 0x02c4,
["br_inst_retired.pred_taken"] = 0x04c4,
["br_inst_retired.mispred_taken"] = 0x08c4,
["br_inst_retired.taken"] = 0x0cc4,
["br_inst_retired.any1"] = 0x0fc4,
["br_inst_retired.mispred"] = 0x00c5,
["cycles_int_masked.cycles_int_masked"] = 0x01c6,
["cycles_int_masked.cycles_int_pending_and_masked"] = 0x02c6,
["simd_inst_retired.packed_single"] = 0x01c7,
["simd_inst_retired.scalar_single"] = 0x02c7,
["simd_inst_retired.scalar_double"] = 0x08c7,
["simd_inst_retired.vector"] = 0x10c7,
["hw_int_rcv"] = 0x00c8,
["simd_comp_inst_retired.packed_single"] = 0x01ca,
["simd_comp_inst_retired.scalar_single"] = 0x02ca,
["simd_comp_inst_retired.scalar_double"] = 0x08ca,
["mem_load_retired.l2_hit"] = 0x01cb,
["mem_load_retired.l2_miss"] = 0x02cb,
["mem_load_retired.dtlb_miss"] = 0x04cb,
["simd_assist"] = 0x00cd,
["simd_instr_retired"] = 0x00ce,
["simd_sat_instr_retired"] = 0x00cf,
["resource_stalls.div_busy"] = 0x02dc,
["br_inst_decoded"] = 0x01e0,
["bogus_br"] = 0x01e4,
["baclears.any"] = 0x01e6,
["reissue.overlap_store"] = 0x0103,
["reissue.overlap_store.ar"] = 0x8103,
},
},
{"GenuineIntel-6-27", "V1", "core",
{
-- source: BNL/Bonnell_core_V1.tsv
["store_forwards.any"] = 0x8302,
["store_forwards.good"] = 0x8102,
["reissue.any"] = 0x7f03,
["reissue.any.ar"] = 0xff03,
["misalign_mem_ref.split"] = 0x0f05,
["misalign_mem_ref.ld_split"] = 0x0905,
["misalign_mem_ref.st_split"] = 0x0a05,
["misalign_mem_ref.split.ar"] = 0x8f05,
["misalign_mem_ref.ld_split.ar"] = 0x8905,
["misalign_mem_ref.st_split.ar"] = 0x8a05,
["misalign_mem_ref.rmw_split"] = 0x8c05,
["misalign_mem_ref.bubble"] = 0x9705,
["misalign_mem_ref.ld_bubble"] = 0x9105,
["misalign_mem_ref.st_bubble"] = 0x9205,
["misalign_mem_ref.rmw_bubble"] = 0x9405,
["segment_reg_loads.any"] = 0x8006,
["prefetch.prefetcht0"] = 0x8107,
["prefetch.prefetcht1"] = 0x8207,
["prefetch.prefetcht2"] = 0x8407,
["prefetch.sw_l2"] = 0x8607,
["prefetch.prefetchnta"] = 0x8807,
["prefetch.hw_prefetch"] = 0x1007,
["prefetch.software_prefetch"] = 0x0f07,
["prefetch.software_prefetch.ar"] = 0x8f07,
["data_tlb_misses.dtlb_miss"] = 0x0708,
["data_tlb_misses.dtlb_miss_ld"] = 0x0508,
["data_tlb_misses.l0_dtlb_miss_ld"] = 0x0908,
["data_tlb_misses.dtlb_miss_st"] = 0x0608,
["data_tlb_misses.l0_dtlb_miss_st"] = 0x0a08,
["dispatch_blocked.any"] = 0x2009,
["page_walks.walks"] = 0x030c,
["page_walks.cycles"] = 0x030c,
["page_walks.d_side_walks"] = 0x010c,
["page_walks.d_side_cycles"] = 0x010c,
["page_walks.i_side_walks"] = 0x020c,
["page_walks.i_side_cycles"] = 0x020c,
["x87_comp_ops_exe.any.s"] = 0x0110,
["x87_comp_ops_exe.any.ar"] = 0x8110,
["x87_comp_ops_exe.fxch.s"] = 0x0210,
["x87_comp_ops_exe.fxch.ar"] = 0x8210,
["fp_assist.s"] = 0x0111,
["fp_assist.ar"] = 0x8111,
["mul.s"] = 0x0112,
["mul.ar"] = 0x8112,
["div.s"] = 0x0113,
["div.ar"] = 0x8113,
["cycles_div_busy"] = 0x0114,
["l2_ads.self"] = 0x4021,
["l2_dbus_busy.self"] = 0x4022,
["l2_dbus_busy_rd.self"] = 0x4023,
["l2_lines_in.self.any"] = 0x7024,
["l2_lines_in.self.demand"] = 0x4024,
["l2_lines_in.self.prefetch"] = 0x5024,
["l2_m_lines_in.self"] = 0x4025,
["l2_lines_out.self.any"] = 0x7026,
["l2_lines_out.self.demand"] = 0x4026,
["l2_lines_out.self.prefetch"] = 0x5026,
["l2_m_lines_out.self.any"] = 0x7027,
["l2_m_lines_out.self.demand"] = 0x4027,
["l2_m_lines_out.self.prefetch"] = 0x5027,
["l2_ifetch.self.e_state"] = 0x4428,
["l2_ifetch.self.i_state"] = 0x4128,
["l2_ifetch.self.m_state"] = 0x4828,
["l2_ifetch.self.s_state"] = 0x4228,
["l2_ifetch.self.mesi"] = 0x4f28,
["l2_ld.self.any.e_state"] = 0x7429,
["l2_ld.self.any.i_state"] = 0x7129,
["l2_ld.self.any.m_state"] = 0x7829,
["l2_ld.self.any.s_state"] = 0x7229,
["l2_ld.self.any.mesi"] = 0x7f29,
["l2_ld.self.demand.e_state"] = 0x4429,
["l2_ld.self.demand.i_state"] = 0x4129,
["l2_ld.self.demand.m_state"] = 0x4829,
["l2_ld.self.demand.s_state"] = 0x4229,
["l2_ld.self.demand.mesi"] = 0x4f29,
["l2_ld.self.prefetch.e_state"] = 0x5429,
["l2_ld.self.prefetch.i_state"] = 0x5129,
["l2_ld.self.prefetch.m_state"] = 0x5829,
["l2_ld.self.prefetch.s_state"] = 0x5229,
["l2_ld.self.prefetch.mesi"] = 0x5f29,
["l2_st.self.e_state"] = 0x442a,
["l2_st.self.i_state"] = 0x412a,
["l2_st.self.m_state"] = 0x482a,
["l2_st.self.s_state"] = 0x422a,
["l2_st.self.mesi"] = 0x4f2a,
["l2_lock.self.e_state"] = 0x442b,
["l2_lock.self.i_state"] = 0x412b,
["l2_lock.self.m_state"] = 0x482b,
["l2_lock.self.s_state"] = 0x422b,
["l2_lock.self.mesi"] = 0x4f2b,
["l2_data_rqsts.self.e_state"] = 0x442c,
["l2_data_rqsts.self.i_state"] = 0x412c,
["l2_data_rqsts.self.m_state"] = 0x482c,
["l2_data_rqsts.self.s_state"] = 0x422c,
["l2_data_rqsts.self.mesi"] = 0x4f2c,
["l2_ld_ifetch.self.e_state"] = 0x442d,
["l2_ld_ifetch.self.i_state"] = 0x412d,
["l2_ld_ifetch.self.m_state"] = 0x482d,
["l2_ld_ifetch.self.s_state"] = 0x422d,
["l2_ld_ifetch.self.mesi"] = 0x4f2d,
["l2_rqsts.self.any.e_state"] = 0x742e,
["l2_rqsts.self.any.i_state"] = 0x712e,
["l2_rqsts.self.any.m_state"] = 0x782e,
["l2_rqsts.self.any.s_state"] = 0x722e,
["l2_rqsts.self.any.mesi"] = 0x7f2e,
["l2_rqsts.self.demand.e_state"] = 0x442e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.m_state"] = 0x482e,
["l2_rqsts.self.demand.s_state"] = 0x422e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_rqsts.self.prefetch.e_state"] = 0x542e,
["l2_rqsts.self.prefetch.i_state"] = 0x512e,
["l2_rqsts.self.prefetch.m_state"] = 0x582e,
["l2_rqsts.self.prefetch.s_state"] = 0x522e,
["l2_rqsts.self.prefetch.mesi"] = 0x5f2e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_reject_busq.self.any.e_state"] = 0x7430,
["l2_reject_busq.self.any.i_state"] = 0x7130,
["l2_reject_busq.self.any.m_state"] = 0x7830,
["l2_reject_busq.self.any.s_state"] = 0x7230,
["l2_reject_busq.self.any.mesi"] = 0x7f30,
["l2_reject_busq.self.demand.e_state"] = 0x4430,
["l2_reject_busq.self.demand.i_state"] = 0x4130,
["l2_reject_busq.self.demand.m_state"] = 0x4830,
["l2_reject_busq.self.demand.s_state"] = 0x4230,
["l2_reject_busq.self.demand.mesi"] = 0x4f30,
["l2_reject_busq.self.prefetch.e_state"] = 0x5430,
["l2_reject_busq.self.prefetch.i_state"] = 0x5130,
["l2_reject_busq.self.prefetch.m_state"] = 0x5830,
["l2_reject_busq.self.prefetch.s_state"] = 0x5230,
["l2_reject_busq.self.prefetch.mesi"] = 0x5f30,
["l2_no_req.self"] = 0x4032,
["eist_trans"] = 0x003a,
["thermal_trip"] = 0xc03b,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.bus"] = 0x013c,
["cpu_clk_unhalted.core"] = 0x000a,
["cpu_clk_unhalted.ref"] = 0x000a,
["l1d_cache.ld"] = 0xa140,
["l1d_cache.st"] = 0xa240,
["l1d_cache.all_ref"] = 0x8340,
["l1d_cache.all_cache_ref"] = 0xa340,
["l1d_cache.repl"] = 0x0840,
["l1d_cache.replm"] = 0x4840,
["l1d_cache.evict"] = 0x1040,
["bus_request_outstanding.all_agents"] = 0xe060,
["bus_request_outstanding.self"] = 0x4060,
["bus_bnr_drv.all_agents"] = 0x2061,
["bus_bnr_drv.this_agent"] = 0x0061,
["bus_drdy_clocks.all_agents"] = 0x2062,
["bus_drdy_clocks.this_agent"] = 0x0062,
["bus_lock_clocks.all_agents"] = 0xe063,
["bus_lock_clocks.self"] = 0x4063,
["bus_data_rcv.self"] = 0x4064,
["bus_trans_brd.all_agents"] = 0xe065,
["bus_trans_brd.self"] = 0x4065,
["bus_trans_rfo.all_agents"] = 0xe066,
["bus_trans_rfo.self"] = 0x4066,
["bus_trans_wb.all_agents"] = 0xe067,
["bus_trans_wb.self"] = 0x4067,
["bus_trans_ifetch.all_agents"] = 0xe068,
["bus_trans_ifetch.self"] = 0x4068,
["bus_trans_inval.all_agents"] = 0xe069,
["bus_trans_inval.self"] = 0x4069,
["bus_trans_pwr.all_agents"] = 0xe06a,
["bus_trans_pwr.self"] = 0x406a,
["bus_trans_p.all_agents"] = 0xe06b,
["bus_trans_p.self"] = 0x406b,
["bus_trans_io.all_agents"] = 0xe06c,
["bus_trans_io.self"] = 0x406c,
["bus_trans_def.all_agents"] = 0xe06d,
["bus_trans_def.self"] = 0x406d,
["bus_trans_burst.all_agents"] = 0xe06e,
["bus_trans_burst.self"] = 0x406e,
["bus_trans_mem.all_agents"] = 0xe06f,
["bus_trans_mem.self"] = 0x406f,
["bus_trans_any.all_agents"] = 0xe070,
["bus_trans_any.self"] = 0x4070,
["ext_snoop.this_agent.any"] = 0x0b77,
["ext_snoop.this_agent.clean"] = 0x0177,
["ext_snoop.this_agent.hit"] = 0x0277,
["ext_snoop.this_agent.hitm"] = 0x0877,
["ext_snoop.all_agents.any"] = 0x2b77,
["ext_snoop.all_agents.clean"] = 0x2177,
["ext_snoop.all_agents.hit"] = 0x2277,
["ext_snoop.all_agents.hitm"] = 0x2877,
["bus_hit_drv.all_agents"] = 0x207a,
["bus_hit_drv.this_agent"] = 0x007a,
["bus_hitm_drv.all_agents"] = 0x207b,
["bus_hitm_drv.this_agent"] = 0x007b,
["busq_empty.self"] = 0x407d,
["snoop_stall_drv.all_agents"] = 0xe07e,
["snoop_stall_drv.self"] = 0x407e,
["bus_io_wait.self"] = 0x407f,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["itlb.hit"] = 0x0182,
["itlb.flush"] = 0x0482,
["itlb.misses"] = 0x0282,
["cycles_icache_mem_stalled.icache_mem_stalled"] = 0x0186,
["decode_stall.pfb_empty"] = 0x0187,
["decode_stall.iq_full"] = 0x0287,
["br_inst_type_retired.cond"] = 0x0188,
["br_inst_type_retired.uncond"] = 0x0288,
["br_inst_type_retired.ind"] = 0x0488,
["br_inst_type_retired.ret"] = 0x0888,
["br_inst_type_retired.dir_call"] = 0x1088,
["br_inst_type_retired.ind_call"] = 0x2088,
["br_inst_type_retired.cond_taken"] = 0x4188,
["br_missp_type_retired.cond"] = 0x0189,
["br_missp_type_retired.ind"] = 0x0289,
["br_missp_type_retired.return"] = 0x0489,
["br_missp_type_retired.ind_call"] = 0x0889,
["br_missp_type_retired.cond_taken"] = 0x1189,
["macro_insts.non_cisc_decoded"] = 0x01aa,
["macro_insts.cisc_decoded"] = 0x02aa,
["macro_insts.all_decoded"] = 0x03aa,
["simd_uops_exec.s"] = 0x00b0,
["simd_uops_exec.ar"] = 0x80b0,
["simd_sat_uop_exec.s"] = 0x00b1,
["simd_sat_uop_exec.ar"] = 0x80b1,
["simd_uop_type_exec.mul.s"] = 0x01b3,
["simd_uop_type_exec.mul.ar"] = 0x81b3,
["simd_uop_type_exec.shift.s"] = 0x02b3,
["simd_uop_type_exec.shift.ar"] = 0x82b3,
["simd_uop_type_exec.pack.s"] = 0x04b3,
["simd_uop_type_exec.pack.ar"] = 0x84b3,
["simd_uop_type_exec.unpack.s"] = 0x08b3,
["simd_uop_type_exec.unpack.ar"] = 0x88b3,
["simd_uop_type_exec.logical.s"] = 0x10b3,
["simd_uop_type_exec.logical.ar"] = 0x90b3,
["simd_uop_type_exec.arithmetic.s"] = 0x20b3,
["simd_uop_type_exec.arithmetic.ar"] = 0xa0b3,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.any"] = 0x000a,
["uops_retired.any"] = 0x10c2,
["uops_retired.stalled_cycles"] = 0x10c2,
["uops_retired.stalls"] = 0x10c2,
["uops.ms_cycles"] = 0x01a9,
["machine_clears.smc"] = 0x01c3,
["br_inst_retired.any"] = 0x00c4,
["br_inst_retired.pred_not_taken"] = 0x01c4,
["br_inst_retired.mispred_not_taken"] = 0x02c4,
["br_inst_retired.pred_taken"] = 0x04c4,
["br_inst_retired.mispred_taken"] = 0x08c4,
["br_inst_retired.taken"] = 0x0cc4,
["br_inst_retired.any1"] = 0x0fc4,
["br_inst_retired.mispred"] = 0x00c5,
["cycles_int_masked.cycles_int_masked"] = 0x01c6,
["cycles_int_masked.cycles_int_pending_and_masked"] = 0x02c6,
["simd_inst_retired.packed_single"] = 0x01c7,
["simd_inst_retired.scalar_single"] = 0x02c7,
["simd_inst_retired.scalar_double"] = 0x08c7,
["simd_inst_retired.vector"] = 0x10c7,
["hw_int_rcv"] = 0x00c8,
["simd_comp_inst_retired.packed_single"] = 0x01ca,
["simd_comp_inst_retired.scalar_single"] = 0x02ca,
["simd_comp_inst_retired.scalar_double"] = 0x08ca,
["mem_load_retired.l2_hit"] = 0x01cb,
["mem_load_retired.l2_miss"] = 0x02cb,
["mem_load_retired.dtlb_miss"] = 0x04cb,
["simd_assist"] = 0x00cd,
["simd_instr_retired"] = 0x00ce,
["simd_sat_instr_retired"] = 0x00cf,
["resource_stalls.div_busy"] = 0x02dc,
["br_inst_decoded"] = 0x01e0,
["bogus_br"] = 0x01e4,
["baclears.any"] = 0x01e6,
["reissue.overlap_store"] = 0x0103,
["reissue.overlap_store.ar"] = 0x8103,
},
},
{"GenuineIntel-6-36", "V1", "core",
{
-- source: BNL/Bonnell_core_V1.tsv
["store_forwards.any"] = 0x8302,
["store_forwards.good"] = 0x8102,
["reissue.any"] = 0x7f03,
["reissue.any.ar"] = 0xff03,
["misalign_mem_ref.split"] = 0x0f05,
["misalign_mem_ref.ld_split"] = 0x0905,
["misalign_mem_ref.st_split"] = 0x0a05,
["misalign_mem_ref.split.ar"] = 0x8f05,
["misalign_mem_ref.ld_split.ar"] = 0x8905,
["misalign_mem_ref.st_split.ar"] = 0x8a05,
["misalign_mem_ref.rmw_split"] = 0x8c05,
["misalign_mem_ref.bubble"] = 0x9705,
["misalign_mem_ref.ld_bubble"] = 0x9105,
["misalign_mem_ref.st_bubble"] = 0x9205,
["misalign_mem_ref.rmw_bubble"] = 0x9405,
["segment_reg_loads.any"] = 0x8006,
["prefetch.prefetcht0"] = 0x8107,
["prefetch.prefetcht1"] = 0x8207,
["prefetch.prefetcht2"] = 0x8407,
["prefetch.sw_l2"] = 0x8607,
["prefetch.prefetchnta"] = 0x8807,
["prefetch.hw_prefetch"] = 0x1007,
["prefetch.software_prefetch"] = 0x0f07,
["prefetch.software_prefetch.ar"] = 0x8f07,
["data_tlb_misses.dtlb_miss"] = 0x0708,
["data_tlb_misses.dtlb_miss_ld"] = 0x0508,
["data_tlb_misses.l0_dtlb_miss_ld"] = 0x0908,
["data_tlb_misses.dtlb_miss_st"] = 0x0608,
["data_tlb_misses.l0_dtlb_miss_st"] = 0x0a08,
["dispatch_blocked.any"] = 0x2009,
["page_walks.walks"] = 0x030c,
["page_walks.cycles"] = 0x030c,
["page_walks.d_side_walks"] = 0x010c,
["page_walks.d_side_cycles"] = 0x010c,
["page_walks.i_side_walks"] = 0x020c,
["page_walks.i_side_cycles"] = 0x020c,
["x87_comp_ops_exe.any.s"] = 0x0110,
["x87_comp_ops_exe.any.ar"] = 0x8110,
["x87_comp_ops_exe.fxch.s"] = 0x0210,
["x87_comp_ops_exe.fxch.ar"] = 0x8210,
["fp_assist.s"] = 0x0111,
["fp_assist.ar"] = 0x8111,
["mul.s"] = 0x0112,
["mul.ar"] = 0x8112,
["div.s"] = 0x0113,
["div.ar"] = 0x8113,
["cycles_div_busy"] = 0x0114,
["l2_ads.self"] = 0x4021,
["l2_dbus_busy.self"] = 0x4022,
["l2_dbus_busy_rd.self"] = 0x4023,
["l2_lines_in.self.any"] = 0x7024,
["l2_lines_in.self.demand"] = 0x4024,
["l2_lines_in.self.prefetch"] = 0x5024,
["l2_m_lines_in.self"] = 0x4025,
["l2_lines_out.self.any"] = 0x7026,
["l2_lines_out.self.demand"] = 0x4026,
["l2_lines_out.self.prefetch"] = 0x5026,
["l2_m_lines_out.self.any"] = 0x7027,
["l2_m_lines_out.self.demand"] = 0x4027,
["l2_m_lines_out.self.prefetch"] = 0x5027,
["l2_ifetch.self.e_state"] = 0x4428,
["l2_ifetch.self.i_state"] = 0x4128,
["l2_ifetch.self.m_state"] = 0x4828,
["l2_ifetch.self.s_state"] = 0x4228,
["l2_ifetch.self.mesi"] = 0x4f28,
["l2_ld.self.any.e_state"] = 0x7429,
["l2_ld.self.any.i_state"] = 0x7129,
["l2_ld.self.any.m_state"] = 0x7829,
["l2_ld.self.any.s_state"] = 0x7229,
["l2_ld.self.any.mesi"] = 0x7f29,
["l2_ld.self.demand.e_state"] = 0x4429,
["l2_ld.self.demand.i_state"] = 0x4129,
["l2_ld.self.demand.m_state"] = 0x4829,
["l2_ld.self.demand.s_state"] = 0x4229,
["l2_ld.self.demand.mesi"] = 0x4f29,
["l2_ld.self.prefetch.e_state"] = 0x5429,
["l2_ld.self.prefetch.i_state"] = 0x5129,
["l2_ld.self.prefetch.m_state"] = 0x5829,
["l2_ld.self.prefetch.s_state"] = 0x5229,
["l2_ld.self.prefetch.mesi"] = 0x5f29,
["l2_st.self.e_state"] = 0x442a,
["l2_st.self.i_state"] = 0x412a,
["l2_st.self.m_state"] = 0x482a,
["l2_st.self.s_state"] = 0x422a,
["l2_st.self.mesi"] = 0x4f2a,
["l2_lock.self.e_state"] = 0x442b,
["l2_lock.self.i_state"] = 0x412b,
["l2_lock.self.m_state"] = 0x482b,
["l2_lock.self.s_state"] = 0x422b,
["l2_lock.self.mesi"] = 0x4f2b,
["l2_data_rqsts.self.e_state"] = 0x442c,
["l2_data_rqsts.self.i_state"] = 0x412c,
["l2_data_rqsts.self.m_state"] = 0x482c,
["l2_data_rqsts.self.s_state"] = 0x422c,
["l2_data_rqsts.self.mesi"] = 0x4f2c,
["l2_ld_ifetch.self.e_state"] = 0x442d,
["l2_ld_ifetch.self.i_state"] = 0x412d,
["l2_ld_ifetch.self.m_state"] = 0x482d,
["l2_ld_ifetch.self.s_state"] = 0x422d,
["l2_ld_ifetch.self.mesi"] = 0x4f2d,
["l2_rqsts.self.any.e_state"] = 0x742e,
["l2_rqsts.self.any.i_state"] = 0x712e,
["l2_rqsts.self.any.m_state"] = 0x782e,
["l2_rqsts.self.any.s_state"] = 0x722e,
["l2_rqsts.self.any.mesi"] = 0x7f2e,
["l2_rqsts.self.demand.e_state"] = 0x442e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.m_state"] = 0x482e,
["l2_rqsts.self.demand.s_state"] = 0x422e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_rqsts.self.prefetch.e_state"] = 0x542e,
["l2_rqsts.self.prefetch.i_state"] = 0x512e,
["l2_rqsts.self.prefetch.m_state"] = 0x582e,
["l2_rqsts.self.prefetch.s_state"] = 0x522e,
["l2_rqsts.self.prefetch.mesi"] = 0x5f2e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_reject_busq.self.any.e_state"] = 0x7430,
["l2_reject_busq.self.any.i_state"] = 0x7130,
["l2_reject_busq.self.any.m_state"] = 0x7830,
["l2_reject_busq.self.any.s_state"] = 0x7230,
["l2_reject_busq.self.any.mesi"] = 0x7f30,
["l2_reject_busq.self.demand.e_state"] = 0x4430,
["l2_reject_busq.self.demand.i_state"] = 0x4130,
["l2_reject_busq.self.demand.m_state"] = 0x4830,
["l2_reject_busq.self.demand.s_state"] = 0x4230,
["l2_reject_busq.self.demand.mesi"] = 0x4f30,
["l2_reject_busq.self.prefetch.e_state"] = 0x5430,
["l2_reject_busq.self.prefetch.i_state"] = 0x5130,
["l2_reject_busq.self.prefetch.m_state"] = 0x5830,
["l2_reject_busq.self.prefetch.s_state"] = 0x5230,
["l2_reject_busq.self.prefetch.mesi"] = 0x5f30,
["l2_no_req.self"] = 0x4032,
["eist_trans"] = 0x003a,
["thermal_trip"] = 0xc03b,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.bus"] = 0x013c,
["cpu_clk_unhalted.core"] = 0x000a,
["cpu_clk_unhalted.ref"] = 0x000a,
["l1d_cache.ld"] = 0xa140,
["l1d_cache.st"] = 0xa240,
["l1d_cache.all_ref"] = 0x8340,
["l1d_cache.all_cache_ref"] = 0xa340,
["l1d_cache.repl"] = 0x0840,
["l1d_cache.replm"] = 0x4840,
["l1d_cache.evict"] = 0x1040,
["bus_request_outstanding.all_agents"] = 0xe060,
["bus_request_outstanding.self"] = 0x4060,
["bus_bnr_drv.all_agents"] = 0x2061,
["bus_bnr_drv.this_agent"] = 0x0061,
["bus_drdy_clocks.all_agents"] = 0x2062,
["bus_drdy_clocks.this_agent"] = 0x0062,
["bus_lock_clocks.all_agents"] = 0xe063,
["bus_lock_clocks.self"] = 0x4063,
["bus_data_rcv.self"] = 0x4064,
["bus_trans_brd.all_agents"] = 0xe065,
["bus_trans_brd.self"] = 0x4065,
["bus_trans_rfo.all_agents"] = 0xe066,
["bus_trans_rfo.self"] = 0x4066,
["bus_trans_wb.all_agents"] = 0xe067,
["bus_trans_wb.self"] = 0x4067,
["bus_trans_ifetch.all_agents"] = 0xe068,
["bus_trans_ifetch.self"] = 0x4068,
["bus_trans_inval.all_agents"] = 0xe069,
["bus_trans_inval.self"] = 0x4069,
["bus_trans_pwr.all_agents"] = 0xe06a,
["bus_trans_pwr.self"] = 0x406a,
["bus_trans_p.all_agents"] = 0xe06b,
["bus_trans_p.self"] = 0x406b,
["bus_trans_io.all_agents"] = 0xe06c,
["bus_trans_io.self"] = 0x406c,
["bus_trans_def.all_agents"] = 0xe06d,
["bus_trans_def.self"] = 0x406d,
["bus_trans_burst.all_agents"] = 0xe06e,
["bus_trans_burst.self"] = 0x406e,
["bus_trans_mem.all_agents"] = 0xe06f,
["bus_trans_mem.self"] = 0x406f,
["bus_trans_any.all_agents"] = 0xe070,
["bus_trans_any.self"] = 0x4070,
["ext_snoop.this_agent.any"] = 0x0b77,
["ext_snoop.this_agent.clean"] = 0x0177,
["ext_snoop.this_agent.hit"] = 0x0277,
["ext_snoop.this_agent.hitm"] = 0x0877,
["ext_snoop.all_agents.any"] = 0x2b77,
["ext_snoop.all_agents.clean"] = 0x2177,
["ext_snoop.all_agents.hit"] = 0x2277,
["ext_snoop.all_agents.hitm"] = 0x2877,
["bus_hit_drv.all_agents"] = 0x207a,
["bus_hit_drv.this_agent"] = 0x007a,
["bus_hitm_drv.all_agents"] = 0x207b,
["bus_hitm_drv.this_agent"] = 0x007b,
["busq_empty.self"] = 0x407d,
["snoop_stall_drv.all_agents"] = 0xe07e,
["snoop_stall_drv.self"] = 0x407e,
["bus_io_wait.self"] = 0x407f,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["itlb.hit"] = 0x0182,
["itlb.flush"] = 0x0482,
["itlb.misses"] = 0x0282,
["cycles_icache_mem_stalled.icache_mem_stalled"] = 0x0186,
["decode_stall.pfb_empty"] = 0x0187,
["decode_stall.iq_full"] = 0x0287,
["br_inst_type_retired.cond"] = 0x0188,
["br_inst_type_retired.uncond"] = 0x0288,
["br_inst_type_retired.ind"] = 0x0488,
["br_inst_type_retired.ret"] = 0x0888,
["br_inst_type_retired.dir_call"] = 0x1088,
["br_inst_type_retired.ind_call"] = 0x2088,
["br_inst_type_retired.cond_taken"] = 0x4188,
["br_missp_type_retired.cond"] = 0x0189,
["br_missp_type_retired.ind"] = 0x0289,
["br_missp_type_retired.return"] = 0x0489,
["br_missp_type_retired.ind_call"] = 0x0889,
["br_missp_type_retired.cond_taken"] = 0x1189,
["macro_insts.non_cisc_decoded"] = 0x01aa,
["macro_insts.cisc_decoded"] = 0x02aa,
["macro_insts.all_decoded"] = 0x03aa,
["simd_uops_exec.s"] = 0x00b0,
["simd_uops_exec.ar"] = 0x80b0,
["simd_sat_uop_exec.s"] = 0x00b1,
["simd_sat_uop_exec.ar"] = 0x80b1,
["simd_uop_type_exec.mul.s"] = 0x01b3,
["simd_uop_type_exec.mul.ar"] = 0x81b3,
["simd_uop_type_exec.shift.s"] = 0x02b3,
["simd_uop_type_exec.shift.ar"] = 0x82b3,
["simd_uop_type_exec.pack.s"] = 0x04b3,
["simd_uop_type_exec.pack.ar"] = 0x84b3,
["simd_uop_type_exec.unpack.s"] = 0x08b3,
["simd_uop_type_exec.unpack.ar"] = 0x88b3,
["simd_uop_type_exec.logical.s"] = 0x10b3,
["simd_uop_type_exec.logical.ar"] = 0x90b3,
["simd_uop_type_exec.arithmetic.s"] = 0x20b3,
["simd_uop_type_exec.arithmetic.ar"] = 0xa0b3,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.any"] = 0x000a,
["uops_retired.any"] = 0x10c2,
["uops_retired.stalled_cycles"] = 0x10c2,
["uops_retired.stalls"] = 0x10c2,
["uops.ms_cycles"] = 0x01a9,
["machine_clears.smc"] = 0x01c3,
["br_inst_retired.any"] = 0x00c4,
["br_inst_retired.pred_not_taken"] = 0x01c4,
["br_inst_retired.mispred_not_taken"] = 0x02c4,
["br_inst_retired.pred_taken"] = 0x04c4,
["br_inst_retired.mispred_taken"] = 0x08c4,
["br_inst_retired.taken"] = 0x0cc4,
["br_inst_retired.any1"] = 0x0fc4,
["br_inst_retired.mispred"] = 0x00c5,
["cycles_int_masked.cycles_int_masked"] = 0x01c6,
["cycles_int_masked.cycles_int_pending_and_masked"] = 0x02c6,
["simd_inst_retired.packed_single"] = 0x01c7,
["simd_inst_retired.scalar_single"] = 0x02c7,
["simd_inst_retired.scalar_double"] = 0x08c7,
["simd_inst_retired.vector"] = 0x10c7,
["hw_int_rcv"] = 0x00c8,
["simd_comp_inst_retired.packed_single"] = 0x01ca,
["simd_comp_inst_retired.scalar_single"] = 0x02ca,
["simd_comp_inst_retired.scalar_double"] = 0x08ca,
["mem_load_retired.l2_hit"] = 0x01cb,
["mem_load_retired.l2_miss"] = 0x02cb,
["mem_load_retired.dtlb_miss"] = 0x04cb,
["simd_assist"] = 0x00cd,
["simd_instr_retired"] = 0x00ce,
["simd_sat_instr_retired"] = 0x00cf,
["resource_stalls.div_busy"] = 0x02dc,
["br_inst_decoded"] = 0x01e0,
["bogus_br"] = 0x01e4,
["baclears.any"] = 0x01e6,
["reissue.overlap_store"] = 0x0103,
["reissue.overlap_store.ar"] = 0x8103,
},
},
{"GenuineIntel-6-35", "V1", "core",
{
-- source: BNL/Bonnell_core_V1.tsv
["store_forwards.any"] = 0x8302,
["store_forwards.good"] = 0x8102,
["reissue.any"] = 0x7f03,
["reissue.any.ar"] = 0xff03,
["misalign_mem_ref.split"] = 0x0f05,
["misalign_mem_ref.ld_split"] = 0x0905,
["misalign_mem_ref.st_split"] = 0x0a05,
["misalign_mem_ref.split.ar"] = 0x8f05,
["misalign_mem_ref.ld_split.ar"] = 0x8905,
["misalign_mem_ref.st_split.ar"] = 0x8a05,
["misalign_mem_ref.rmw_split"] = 0x8c05,
["misalign_mem_ref.bubble"] = 0x9705,
["misalign_mem_ref.ld_bubble"] = 0x9105,
["misalign_mem_ref.st_bubble"] = 0x9205,
["misalign_mem_ref.rmw_bubble"] = 0x9405,
["segment_reg_loads.any"] = 0x8006,
["prefetch.prefetcht0"] = 0x8107,
["prefetch.prefetcht1"] = 0x8207,
["prefetch.prefetcht2"] = 0x8407,
["prefetch.sw_l2"] = 0x8607,
["prefetch.prefetchnta"] = 0x8807,
["prefetch.hw_prefetch"] = 0x1007,
["prefetch.software_prefetch"] = 0x0f07,
["prefetch.software_prefetch.ar"] = 0x8f07,
["data_tlb_misses.dtlb_miss"] = 0x0708,
["data_tlb_misses.dtlb_miss_ld"] = 0x0508,
["data_tlb_misses.l0_dtlb_miss_ld"] = 0x0908,
["data_tlb_misses.dtlb_miss_st"] = 0x0608,
["data_tlb_misses.l0_dtlb_miss_st"] = 0x0a08,
["dispatch_blocked.any"] = 0x2009,
["page_walks.walks"] = 0x030c,
["page_walks.cycles"] = 0x030c,
["page_walks.d_side_walks"] = 0x010c,
["page_walks.d_side_cycles"] = 0x010c,
["page_walks.i_side_walks"] = 0x020c,
["page_walks.i_side_cycles"] = 0x020c,
["x87_comp_ops_exe.any.s"] = 0x0110,
["x87_comp_ops_exe.any.ar"] = 0x8110,
["x87_comp_ops_exe.fxch.s"] = 0x0210,
["x87_comp_ops_exe.fxch.ar"] = 0x8210,
["fp_assist.s"] = 0x0111,
["fp_assist.ar"] = 0x8111,
["mul.s"] = 0x0112,
["mul.ar"] = 0x8112,
["div.s"] = 0x0113,
["div.ar"] = 0x8113,
["cycles_div_busy"] = 0x0114,
["l2_ads.self"] = 0x4021,
["l2_dbus_busy.self"] = 0x4022,
["l2_dbus_busy_rd.self"] = 0x4023,
["l2_lines_in.self.any"] = 0x7024,
["l2_lines_in.self.demand"] = 0x4024,
["l2_lines_in.self.prefetch"] = 0x5024,
["l2_m_lines_in.self"] = 0x4025,
["l2_lines_out.self.any"] = 0x7026,
["l2_lines_out.self.demand"] = 0x4026,
["l2_lines_out.self.prefetch"] = 0x5026,
["l2_m_lines_out.self.any"] = 0x7027,
["l2_m_lines_out.self.demand"] = 0x4027,
["l2_m_lines_out.self.prefetch"] = 0x5027,
["l2_ifetch.self.e_state"] = 0x4428,
["l2_ifetch.self.i_state"] = 0x4128,
["l2_ifetch.self.m_state"] = 0x4828,
["l2_ifetch.self.s_state"] = 0x4228,
["l2_ifetch.self.mesi"] = 0x4f28,
["l2_ld.self.any.e_state"] = 0x7429,
["l2_ld.self.any.i_state"] = 0x7129,
["l2_ld.self.any.m_state"] = 0x7829,
["l2_ld.self.any.s_state"] = 0x7229,
["l2_ld.self.any.mesi"] = 0x7f29,
["l2_ld.self.demand.e_state"] = 0x4429,
["l2_ld.self.demand.i_state"] = 0x4129,
["l2_ld.self.demand.m_state"] = 0x4829,
["l2_ld.self.demand.s_state"] = 0x4229,
["l2_ld.self.demand.mesi"] = 0x4f29,
["l2_ld.self.prefetch.e_state"] = 0x5429,
["l2_ld.self.prefetch.i_state"] = 0x5129,
["l2_ld.self.prefetch.m_state"] = 0x5829,
["l2_ld.self.prefetch.s_state"] = 0x5229,
["l2_ld.self.prefetch.mesi"] = 0x5f29,
["l2_st.self.e_state"] = 0x442a,
["l2_st.self.i_state"] = 0x412a,
["l2_st.self.m_state"] = 0x482a,
["l2_st.self.s_state"] = 0x422a,
["l2_st.self.mesi"] = 0x4f2a,
["l2_lock.self.e_state"] = 0x442b,
["l2_lock.self.i_state"] = 0x412b,
["l2_lock.self.m_state"] = 0x482b,
["l2_lock.self.s_state"] = 0x422b,
["l2_lock.self.mesi"] = 0x4f2b,
["l2_data_rqsts.self.e_state"] = 0x442c,
["l2_data_rqsts.self.i_state"] = 0x412c,
["l2_data_rqsts.self.m_state"] = 0x482c,
["l2_data_rqsts.self.s_state"] = 0x422c,
["l2_data_rqsts.self.mesi"] = 0x4f2c,
["l2_ld_ifetch.self.e_state"] = 0x442d,
["l2_ld_ifetch.self.i_state"] = 0x412d,
["l2_ld_ifetch.self.m_state"] = 0x482d,
["l2_ld_ifetch.self.s_state"] = 0x422d,
["l2_ld_ifetch.self.mesi"] = 0x4f2d,
["l2_rqsts.self.any.e_state"] = 0x742e,
["l2_rqsts.self.any.i_state"] = 0x712e,
["l2_rqsts.self.any.m_state"] = 0x782e,
["l2_rqsts.self.any.s_state"] = 0x722e,
["l2_rqsts.self.any.mesi"] = 0x7f2e,
["l2_rqsts.self.demand.e_state"] = 0x442e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.m_state"] = 0x482e,
["l2_rqsts.self.demand.s_state"] = 0x422e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_rqsts.self.prefetch.e_state"] = 0x542e,
["l2_rqsts.self.prefetch.i_state"] = 0x512e,
["l2_rqsts.self.prefetch.m_state"] = 0x582e,
["l2_rqsts.self.prefetch.s_state"] = 0x522e,
["l2_rqsts.self.prefetch.mesi"] = 0x5f2e,
["l2_rqsts.self.demand.i_state"] = 0x412e,
["l2_rqsts.self.demand.mesi"] = 0x4f2e,
["l2_reject_busq.self.any.e_state"] = 0x7430,
["l2_reject_busq.self.any.i_state"] = 0x7130,
["l2_reject_busq.self.any.m_state"] = 0x7830,
["l2_reject_busq.self.any.s_state"] = 0x7230,
["l2_reject_busq.self.any.mesi"] = 0x7f30,
["l2_reject_busq.self.demand.e_state"] = 0x4430,
["l2_reject_busq.self.demand.i_state"] = 0x4130,
["l2_reject_busq.self.demand.m_state"] = 0x4830,
["l2_reject_busq.self.demand.s_state"] = 0x4230,
["l2_reject_busq.self.demand.mesi"] = 0x4f30,
["l2_reject_busq.self.prefetch.e_state"] = 0x5430,
["l2_reject_busq.self.prefetch.i_state"] = 0x5130,
["l2_reject_busq.self.prefetch.m_state"] = 0x5830,
["l2_reject_busq.self.prefetch.s_state"] = 0x5230,
["l2_reject_busq.self.prefetch.mesi"] = 0x5f30,
["l2_no_req.self"] = 0x4032,
["eist_trans"] = 0x003a,
["thermal_trip"] = 0xc03b,
["cpu_clk_unhalted.core_p"] = 0x003c,
["cpu_clk_unhalted.bus"] = 0x013c,
["cpu_clk_unhalted.core"] = 0x000a,
["cpu_clk_unhalted.ref"] = 0x000a,
["l1d_cache.ld"] = 0xa140,
["l1d_cache.st"] = 0xa240,
["l1d_cache.all_ref"] = 0x8340,
["l1d_cache.all_cache_ref"] = 0xa340,
["l1d_cache.repl"] = 0x0840,
["l1d_cache.replm"] = 0x4840,
["l1d_cache.evict"] = 0x1040,
["bus_request_outstanding.all_agents"] = 0xe060,
["bus_request_outstanding.self"] = 0x4060,
["bus_bnr_drv.all_agents"] = 0x2061,
["bus_bnr_drv.this_agent"] = 0x0061,
["bus_drdy_clocks.all_agents"] = 0x2062,
["bus_drdy_clocks.this_agent"] = 0x0062,
["bus_lock_clocks.all_agents"] = 0xe063,
["bus_lock_clocks.self"] = 0x4063,
["bus_data_rcv.self"] = 0x4064,
["bus_trans_brd.all_agents"] = 0xe065,
["bus_trans_brd.self"] = 0x4065,
["bus_trans_rfo.all_agents"] = 0xe066,
["bus_trans_rfo.self"] = 0x4066,
["bus_trans_wb.all_agents"] = 0xe067,
["bus_trans_wb.self"] = 0x4067,
["bus_trans_ifetch.all_agents"] = 0xe068,
["bus_trans_ifetch.self"] = 0x4068,
["bus_trans_inval.all_agents"] = 0xe069,
["bus_trans_inval.self"] = 0x4069,
["bus_trans_pwr.all_agents"] = 0xe06a,
["bus_trans_pwr.self"] = 0x406a,
["bus_trans_p.all_agents"] = 0xe06b,
["bus_trans_p.self"] = 0x406b,
["bus_trans_io.all_agents"] = 0xe06c,
["bus_trans_io.self"] = 0x406c,
["bus_trans_def.all_agents"] = 0xe06d,
["bus_trans_def.self"] = 0x406d,
["bus_trans_burst.all_agents"] = 0xe06e,
["bus_trans_burst.self"] = 0x406e,
["bus_trans_mem.all_agents"] = 0xe06f,
["bus_trans_mem.self"] = 0x406f,
["bus_trans_any.all_agents"] = 0xe070,
["bus_trans_any.self"] = 0x4070,
["ext_snoop.this_agent.any"] = 0x0b77,
["ext_snoop.this_agent.clean"] = 0x0177,
["ext_snoop.this_agent.hit"] = 0x0277,
["ext_snoop.this_agent.hitm"] = 0x0877,
["ext_snoop.all_agents.any"] = 0x2b77,
["ext_snoop.all_agents.clean"] = 0x2177,
["ext_snoop.all_agents.hit"] = 0x2277,
["ext_snoop.all_agents.hitm"] = 0x2877,
["bus_hit_drv.all_agents"] = 0x207a,
["bus_hit_drv.this_agent"] = 0x007a,
["bus_hitm_drv.all_agents"] = 0x207b,
["bus_hitm_drv.this_agent"] = 0x007b,
["busq_empty.self"] = 0x407d,
["snoop_stall_drv.all_agents"] = 0xe07e,
["snoop_stall_drv.self"] = 0x407e,
["bus_io_wait.self"] = 0x407f,
["icache.accesses"] = 0x0380,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["itlb.hit"] = 0x0182,
["itlb.flush"] = 0x0482,
["itlb.misses"] = 0x0282,
["cycles_icache_mem_stalled.icache_mem_stalled"] = 0x0186,
["decode_stall.pfb_empty"] = 0x0187,
["decode_stall.iq_full"] = 0x0287,
["br_inst_type_retired.cond"] = 0x0188,
["br_inst_type_retired.uncond"] = 0x0288,
["br_inst_type_retired.ind"] = 0x0488,
["br_inst_type_retired.ret"] = 0x0888,
["br_inst_type_retired.dir_call"] = 0x1088,
["br_inst_type_retired.ind_call"] = 0x2088,
["br_inst_type_retired.cond_taken"] = 0x4188,
["br_missp_type_retired.cond"] = 0x0189,
["br_missp_type_retired.ind"] = 0x0289,
["br_missp_type_retired.return"] = 0x0489,
["br_missp_type_retired.ind_call"] = 0x0889,
["br_missp_type_retired.cond_taken"] = 0x1189,
["macro_insts.non_cisc_decoded"] = 0x01aa,
["macro_insts.cisc_decoded"] = 0x02aa,
["macro_insts.all_decoded"] = 0x03aa,
["simd_uops_exec.s"] = 0x00b0,
["simd_uops_exec.ar"] = 0x80b0,
["simd_sat_uop_exec.s"] = 0x00b1,
["simd_sat_uop_exec.ar"] = 0x80b1,
["simd_uop_type_exec.mul.s"] = 0x01b3,
["simd_uop_type_exec.mul.ar"] = 0x81b3,
["simd_uop_type_exec.shift.s"] = 0x02b3,
["simd_uop_type_exec.shift.ar"] = 0x82b3,
["simd_uop_type_exec.pack.s"] = 0x04b3,
["simd_uop_type_exec.pack.ar"] = 0x84b3,
["simd_uop_type_exec.unpack.s"] = 0x08b3,
["simd_uop_type_exec.unpack.ar"] = 0x88b3,
["simd_uop_type_exec.logical.s"] = 0x10b3,
["simd_uop_type_exec.logical.ar"] = 0x90b3,
["simd_uop_type_exec.arithmetic.s"] = 0x20b3,
["simd_uop_type_exec.arithmetic.ar"] = 0xa0b3,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.any"] = 0x000a,
["uops_retired.any"] = 0x10c2,
["uops_retired.stalled_cycles"] = 0x10c2,
["uops_retired.stalls"] = 0x10c2,
["uops.ms_cycles"] = 0x01a9,
["machine_clears.smc"] = 0x01c3,
["br_inst_retired.any"] = 0x00c4,
["br_inst_retired.pred_not_taken"] = 0x01c4,
["br_inst_retired.mispred_not_taken"] = 0x02c4,
["br_inst_retired.pred_taken"] = 0x04c4,
["br_inst_retired.mispred_taken"] = 0x08c4,
["br_inst_retired.taken"] = 0x0cc4,
["br_inst_retired.any1"] = 0x0fc4,
["br_inst_retired.mispred"] = 0x00c5,
["cycles_int_masked.cycles_int_masked"] = 0x01c6,
["cycles_int_masked.cycles_int_pending_and_masked"] = 0x02c6,
["simd_inst_retired.packed_single"] = 0x01c7,
["simd_inst_retired.scalar_single"] = 0x02c7,
["simd_inst_retired.scalar_double"] = 0x08c7,
["simd_inst_retired.vector"] = 0x10c7,
["hw_int_rcv"] = 0x00c8,
["simd_comp_inst_retired.packed_single"] = 0x01ca,
["simd_comp_inst_retired.scalar_single"] = 0x02ca,
["simd_comp_inst_retired.scalar_double"] = 0x08ca,
["mem_load_retired.l2_hit"] = 0x01cb,
["mem_load_retired.l2_miss"] = 0x02cb,
["mem_load_retired.dtlb_miss"] = 0x04cb,
["simd_assist"] = 0x00cd,
["simd_instr_retired"] = 0x00ce,
["simd_sat_instr_retired"] = 0x00cf,
["resource_stalls.div_busy"] = 0x02dc,
["br_inst_decoded"] = 0x01e0,
["bogus_br"] = 0x01e4,
["baclears.any"] = 0x01e6,
["reissue.overlap_store"] = 0x0103,
["reissue.overlap_store.ar"] = 0x8103,
},
},
{"GenuineIntel-6-4E", "V11", "core",
{
-- source: SKL/Skylake_core_V11.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["icache_16b.ifdata_stall"] = 0x0480,
["icache_64b.iftag_hit"] = 0x0183,
["icache_64b.iftag_miss"] = 0x0283,
["icache_64b.iftag_stall"] = 0x0483,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["baclears.any"] = 0x01e6,
["itlb.itlb_flush"] = 0x01ae,
["lsd.uops"] = 0x01a8,
["ild_stall.lcp"] = 0x0187,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["int_misc.recovery_cycles"] = 0x010d,
["int_misc.clear_resteer_cycles"] = 0x800d,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.sb"] = 0x08a2,
["uops_issued.any"] = 0x010e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.stall_cycles"] = 0x010e,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["rs_events.empty_end"] = 0x015e,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_mem"] = 0x08c8,
["hle_retired.aborted_timer"] = 0x10c8,
["hle_retired.aborted_unfriendly"] = 0x20c8,
["hle_retired.aborted_memtype"] = 0x40c8,
["hle_retired.aborted_events"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_mem"] = 0x08c9,
["rtm_retired.aborted_timer"] = 0x10c9,
["rtm_retired.aborted_unfriendly"] = 0x20c9,
["rtm_retired.aborted_memtype"] = 0x40c9,
["rtm_retired.aborted_events"] = 0x80c9,
["machine_clears.count"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["hw_interrupts.received"] = 0x01cb,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.near_taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_arith_inst_retired.scalar_double"] = 0x01c7,
["fp_arith_inst_retired.scalar_single"] = 0x02c7,
["fp_arith_inst_retired.128b_packed_double"] = 0x04c7,
["fp_arith_inst_retired.128b_packed_single"] = 0x08c7,
["fp_arith_inst_retired.256b_packed_double"] = 0x10c7,
["fp_arith_inst_retired.256b_packed_single"] = 0x20c7,
["fp_assist.any"] = 0x1eca,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_inst_retired.stlb_miss_loads"] = 0x11d0,
["mem_inst_retired.stlb_miss_stores"] = 0x12d0,
["mem_inst_retired.lock_loads"] = 0x21d0,
["mem_inst_retired.split_loads"] = 0x41d0,
["mem_inst_retired.split_stores"] = 0x42d0,
["mem_inst_retired.all_loads"] = 0x81d0,
["mem_inst_retired.all_stores"] = 0x82d0,
["mem_load_retired.l1_hit"] = 0x01d1,
["mem_load_retired.l2_hit"] = 0x02d1,
["mem_load_retired.l3_hit"] = 0x04d1,
["mem_load_retired.l1_miss"] = 0x08d1,
["mem_load_retired.l2_miss"] = 0x10d1,
["mem_load_retired.l3_miss"] = 0x20d1,
["mem_load_retired.fb_hit"] = 0x40d1,
["mem_load_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_l3_hit_retired.xsnp_none"] = 0x08d2,
["frontend_retired.dsb_miss"] = 0x01c6,
["frontend_retired.l1i_miss"] = 0x01c6,
["frontend_retired.l2_miss"] = 0x01c6,
["frontend_retired.itlb_miss"] = 0x01c6,
["frontend_retired.stlb_miss"] = 0x01c6,
["frontend_retired.latency_ge_2"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_2"] = 0x01c6,
["frontend_retired.latency_ge_4"] = 0x01c6,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.x87"] = 0x10b1,
["uops_executed.stall_cycles"] = 0x01b1,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["exe_activity.exe_bound_0_ports"] = 0x01a6,
["exe_activity.1_ports_util"] = 0x02a6,
["exe_activity.2_ports_util"] = 0x04a6,
["exe_activity.3_ports_util"] = 0x08a6,
["exe_activity.4_ports_util"] = 0x10a6,
["exe_activity.bound_on_stores"] = 0x40a6,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cycle_activity.stalls_total"] = 0x04a3,
["ept.walk_pending"] = 0x104f,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_pending"] = 0x1085,
["itlb_misses.stlb_hit"] = 0x2085,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_pending"] = 0x1008,
["dtlb_load_misses.stlb_hit"] = 0x2008,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_pending"] = 0x1049,
["dtlb_store_misses.stlb_hit"] = 0x2049,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["load_hit_pre.sw_pf"] = 0x014c,
["lock_cycles.cache_lock_duration"] = 0x0263,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["ld_blocks_partial.address_alias"] = 0x0107,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["offcore_requests.l3_miss_demand_data_rd"] = 0x10b0,
["offcore_requests.all_requests"] = 0x80b0,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.l3_miss_demand_data_rd"] = 0x1060,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.cycles_mem_any"] = 0x10a3,
["cycle_activity.stalls_mem_any"] = 0x14a3,
["l2_trans.l2_wb"] = 0x40f0,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["offcore_response"] = 0x01b7,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_rqsts.pf_miss"] = 0x3824,
["l2_rqsts.pf_hit"] = 0xd824,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["idq.ms_switches"] = 0x3079,
["itlb_misses.walk_completed"] = 0x0e85,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["idq.ms_uops"] = 0x3079,
["l2_lines_in.all"] = 0x07f1,
["offcore_requests_outstanding.cycles_with_demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["arith.divider_active"] = 0x0114,
["cycle_activity.cycles_l3_miss"] = 0x02a3,
["cycle_activity.stalls_l3_miss"] = 0x06a3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["other_assists.any"] = 0x3fc1,
["offcore_requests_outstanding.cycles_with_l3_miss_demand_data_rd"] = 0x1060,
["offcore_requests_outstanding.l3_miss_demand_data_rd_ge_6"] = 0x1060,
["frontend_retired.latency_ge_8"] = 0x01c6,
["frontend_retired.latency_ge_16"] = 0x01c6,
["frontend_retired.latency_ge_32"] = 0x01c6,
["frontend_retired.latency_ge_64"] = 0x01c6,
["frontend_retired.latency_ge_128"] = 0x01c6,
["frontend_retired.latency_ge_256"] = 0x01c6,
["frontend_retired.latency_ge_512"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_1"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_3"] = 0x01c6,
["dtlb_store_misses.walk_active"] = 0x1049,
["dtlb_load_misses.walk_active"] = 0x1008,
["uops_issued.vector_width_mismatch"] = 0x020e,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x010d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
},
},
{"GenuineIntel-6-5E", "V11", "core",
{
-- source: SKL/Skylake_core_V11.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["icache_16b.ifdata_stall"] = 0x0480,
["icache_64b.iftag_hit"] = 0x0183,
["icache_64b.iftag_miss"] = 0x0283,
["icache_64b.iftag_stall"] = 0x0483,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["baclears.any"] = 0x01e6,
["itlb.itlb_flush"] = 0x01ae,
["lsd.uops"] = 0x01a8,
["ild_stall.lcp"] = 0x0187,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["int_misc.recovery_cycles"] = 0x010d,
["int_misc.clear_resteer_cycles"] = 0x800d,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.sb"] = 0x08a2,
["uops_issued.any"] = 0x010e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.stall_cycles"] = 0x010e,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["rs_events.empty_end"] = 0x015e,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_mem"] = 0x08c8,
["hle_retired.aborted_timer"] = 0x10c8,
["hle_retired.aborted_unfriendly"] = 0x20c8,
["hle_retired.aborted_memtype"] = 0x40c8,
["hle_retired.aborted_events"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_mem"] = 0x08c9,
["rtm_retired.aborted_timer"] = 0x10c9,
["rtm_retired.aborted_unfriendly"] = 0x20c9,
["rtm_retired.aborted_memtype"] = 0x40c9,
["rtm_retired.aborted_events"] = 0x80c9,
["machine_clears.count"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["hw_interrupts.received"] = 0x01cb,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.near_taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_arith_inst_retired.scalar_double"] = 0x01c7,
["fp_arith_inst_retired.scalar_single"] = 0x02c7,
["fp_arith_inst_retired.128b_packed_double"] = 0x04c7,
["fp_arith_inst_retired.128b_packed_single"] = 0x08c7,
["fp_arith_inst_retired.256b_packed_double"] = 0x10c7,
["fp_arith_inst_retired.256b_packed_single"] = 0x20c7,
["fp_assist.any"] = 0x1eca,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_inst_retired.stlb_miss_loads"] = 0x11d0,
["mem_inst_retired.stlb_miss_stores"] = 0x12d0,
["mem_inst_retired.lock_loads"] = 0x21d0,
["mem_inst_retired.split_loads"] = 0x41d0,
["mem_inst_retired.split_stores"] = 0x42d0,
["mem_inst_retired.all_loads"] = 0x81d0,
["mem_inst_retired.all_stores"] = 0x82d0,
["mem_load_retired.l1_hit"] = 0x01d1,
["mem_load_retired.l2_hit"] = 0x02d1,
["mem_load_retired.l3_hit"] = 0x04d1,
["mem_load_retired.l1_miss"] = 0x08d1,
["mem_load_retired.l2_miss"] = 0x10d1,
["mem_load_retired.l3_miss"] = 0x20d1,
["mem_load_retired.fb_hit"] = 0x40d1,
["mem_load_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_l3_hit_retired.xsnp_none"] = 0x08d2,
["frontend_retired.dsb_miss"] = 0x01c6,
["frontend_retired.l1i_miss"] = 0x01c6,
["frontend_retired.l2_miss"] = 0x01c6,
["frontend_retired.itlb_miss"] = 0x01c6,
["frontend_retired.stlb_miss"] = 0x01c6,
["frontend_retired.latency_ge_2"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_2"] = 0x01c6,
["frontend_retired.latency_ge_4"] = 0x01c6,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.x87"] = 0x10b1,
["uops_executed.stall_cycles"] = 0x01b1,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["exe_activity.exe_bound_0_ports"] = 0x01a6,
["exe_activity.1_ports_util"] = 0x02a6,
["exe_activity.2_ports_util"] = 0x04a6,
["exe_activity.3_ports_util"] = 0x08a6,
["exe_activity.4_ports_util"] = 0x10a6,
["exe_activity.bound_on_stores"] = 0x40a6,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cycle_activity.stalls_total"] = 0x04a3,
["ept.walk_pending"] = 0x104f,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_pending"] = 0x1085,
["itlb_misses.stlb_hit"] = 0x2085,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_pending"] = 0x1008,
["dtlb_load_misses.stlb_hit"] = 0x2008,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_pending"] = 0x1049,
["dtlb_store_misses.stlb_hit"] = 0x2049,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["load_hit_pre.sw_pf"] = 0x014c,
["lock_cycles.cache_lock_duration"] = 0x0263,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["ld_blocks_partial.address_alias"] = 0x0107,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["offcore_requests.l3_miss_demand_data_rd"] = 0x10b0,
["offcore_requests.all_requests"] = 0x80b0,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.l3_miss_demand_data_rd"] = 0x1060,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.cycles_mem_any"] = 0x10a3,
["cycle_activity.stalls_mem_any"] = 0x14a3,
["l2_trans.l2_wb"] = 0x40f0,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["offcore_response"] = 0x01b7,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_rqsts.pf_miss"] = 0x3824,
["l2_rqsts.pf_hit"] = 0xd824,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["idq.ms_switches"] = 0x3079,
["itlb_misses.walk_completed"] = 0x0e85,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["idq.ms_uops"] = 0x3079,
["l2_lines_in.all"] = 0x07f1,
["offcore_requests_outstanding.cycles_with_demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["arith.divider_active"] = 0x0114,
["cycle_activity.cycles_l3_miss"] = 0x02a3,
["cycle_activity.stalls_l3_miss"] = 0x06a3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["other_assists.any"] = 0x3fc1,
["offcore_requests_outstanding.cycles_with_l3_miss_demand_data_rd"] = 0x1060,
["offcore_requests_outstanding.l3_miss_demand_data_rd_ge_6"] = 0x1060,
["frontend_retired.latency_ge_8"] = 0x01c6,
["frontend_retired.latency_ge_16"] = 0x01c6,
["frontend_retired.latency_ge_32"] = 0x01c6,
["frontend_retired.latency_ge_64"] = 0x01c6,
["frontend_retired.latency_ge_128"] = 0x01c6,
["frontend_retired.latency_ge_256"] = 0x01c6,
["frontend_retired.latency_ge_512"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_1"] = 0x01c6,
["frontend_retired.latency_ge_2_bubbles_ge_3"] = 0x01c6,
["dtlb_store_misses.walk_active"] = 0x1049,
["dtlb_load_misses.walk_active"] = 0x1008,
["uops_issued.vector_width_mismatch"] = 0x020e,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x010d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
},
},
{"GenuineIntel-6-2A", "V12", "core",
{
-- source: SNB/SandyBridge_core_V12.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.taken_direct_near_call"] = 0x9089,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_direct_near_call"] = 0xd089,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["itlb.itlb_flush"] = 0x01ae,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["lsd.uops"] = 0x01a8,
["lsd.cycles_active"] = 0x01a8,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["insts_written_to_iq.insts"] = 0x0117,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["dsb2mite_switches.count"] = 0x01ab,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["dsb_fill.other_cancel"] = 0x02ac,
["dsb_fill.exceed_dsb_lines"] = 0x08ac,
["int_misc.rat_stall_cycles"] = 0x400d,
["partial_rat_stalls.flags_merge_uop"] = 0x2059,
["partial_rat_stalls.slow_lea_window"] = 0x4059,
["partial_rat_stalls.mul_single_uop"] = 0x8059,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.lb"] = 0x02a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["resource_stalls2.bob_full"] = 0x405b,
["uops_issued.any"] = 0x010e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["rs_events.empty_cycles"] = 0x015e,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring0_trans"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["inst_retired.any_p"] = 0x00c0,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.near_call"] = 0x02c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.not_taken"] = 0x10c5,
["br_misp_retired.taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["other_assists.itlb_miss_retired"] = 0x02c1,
["other_assists.avx_store"] = 0x08c1,
["other_assists.avx_to_sse"] = 0x10c1,
["other_assists.sse_to_avx"] = 0x20c1,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_trans_retired.precise_store"] = 0x02cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.llc_hit"] = 0x04d1,
["mem_load_uops_retired.llc_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_llc_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_llc_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_llc_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_llc_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_misc_retired.llc_miss"] = 0x02d4,
["arith.fpu_div_active"] = 0x0114,
["arith.fpu_div"] = 0x0114,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_comp_ops_exe.sse_packed_double"] = 0x1010,
["fp_comp_ops_exe.sse_scalar_single"] = 0x2010,
["fp_comp_ops_exe.sse_packed_single"] = 0x4010,
["fp_comp_ops_exe.sse_scalar_double"] = 0x8010,
["simd_fp_256.packed_single"] = 0x0111,
["simd_fp_256.packed_double"] = 0x0211,
["uops_dispatched.thread"] = 0x01b1,
["uops_dispatched.core"] = 0x02b1,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_4"] = 0x40a1,
["uops_dispatched_port.port_5"] = 0x80a1,
["cycle_activity.cycles_no_dispatch"] = 0x04a3,
["cycle_activity.cycles_l1d_pending"] = 0x02a3,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.stalls_l1d_pending"] = 0x06a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["ept.walk_cycles"] = 0x104f,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_duration"] = 0x0485,
["itlb_misses.stlb_hit"] = 0x1085,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_load_misses.walk_duration"] = 0x0408,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x0449,
["dtlb_store_misses.stlb_hit"] = 0x1049,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["page_walks.llc_miss"] = 0x01be,
["l1d.replacement"] = 0x0151,
["l1d.allocated_in_m"] = 0x0251,
["l1d.eviction"] = 0x0451,
["l1d.all_m_replacement"] = 0x0851,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["hw_pre_req.dl1_miss"] = 0x024e,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["ld_blocks.data_unknown"] = 0x0103,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["ld_blocks.all_block"] = 0x1003,
["ld_blocks_partial.address_alias"] = 0x0107,
["ld_blocks_partial.all_sta_block"] = 0x0807,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["agu_bypass_cancel.count"] = 0x01b6,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["l2_rqsts.demand_data_rd_hit"] = 0x0124,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.code_rd_hit"] = 0x1024,
["l2_rqsts.code_rd_miss"] = 0x2024,
["l2_rqsts.pf_hit"] = 0x4024,
["l2_rqsts.pf_miss"] = 0x8024,
["l2_store_lock_rqsts.miss"] = 0x0127,
["l2_store_lock_rqsts.hit_e"] = 0x0427,
["l2_store_lock_rqsts.hit_m"] = 0x0827,
["l2_store_lock_rqsts.all"] = 0x0f27,
["l2_l1d_wb_rqsts.miss"] = 0x0128,
["l2_l1d_wb_rqsts.hit_s"] = 0x0228,
["l2_l1d_wb_rqsts.hit_e"] = 0x0428,
["l2_l1d_wb_rqsts.hit_m"] = 0x0828,
["l2_l1d_wb_rqsts.all"] = 0x0f28,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.pf_clean"] = 0x04f2,
["l2_lines_out.pf_dirty"] = 0x08f2,
["l2_lines_out.dirty_all"] = 0x0af2,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["sq_misc.split_lock"] = 0x10f4,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["br_inst_retired.near_call_r3"] = 0x02c4,
["uops_dispatched_port.port_0_core"] = 0x01a1,
["uops_dispatched_port.port_1_core"] = 0x02a1,
["uops_dispatched_port.port_4_core"] = 0x40a1,
["uops_dispatched_port.port_5_core"] = 0x80a1,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["uops_dispatched_port.port_2"] = 0x0ca1,
["uops_dispatched_port.port_3"] = 0x30a1,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["uops_dispatched_port.port_2_core"] = 0x0ca1,
["uops_dispatched_port.port_3_core"] = 0x30a1,
["inst_retired.prec_dist"] = 0x01c0,
["l2_rqsts.all_demand_data_rd"] = 0x0324,
["l2_rqsts.all_rfo"] = 0x0c24,
["l2_rqsts.all_code_rd"] = 0x3024,
["l2_rqsts.all_pf"] = 0xc024,
["l1d_blocks.bank_conflict_cycles"] = 0x05bf,
["resource_stalls2.all_prf_control"] = 0x0f5b,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["resource_stalls2.all_fl_empty"] = 0x0c5b,
["resource_stalls.mem_rs"] = 0x0ea2,
["resource_stalls.ooo_rsrc"] = 0xf0a2,
["resource_stalls2.ooo_rsrc"] = 0x4f5b,
["resource_stalls.lb_sb"] = 0x0aa2,
["int_misc.recovery_cycles"] = 0x030d,
["partial_rat_stalls.flags_merge_uop_cycles"] = 0x2059,
["idq_uops_not_delivered.cycles_ge_1_uop_deliv.core"] = 0x019c,
["int_misc.recovery_stalls_count"] = 0x030d,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["dsb_fill.all_cancel"] = 0x0aac,
["fp_assist.any"] = 0x1eca,
["baclears.any"] = 0x1fe6,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.all_branches"] = 0xff89,
["idq.mite_all_uops"] = 0x3c79,
["uops_retired.core_stall_cycles"] = 0x01c2,
["lsd.cycles_4_uops"] = 0x01a8,
["machine_clears.count"] = 0x01c3,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["offcore_requests_outstanding.demand_data_rd_c6"] = 0x0160,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-2A", "V12", "offcore",
{
-- source: SNB/SandyBridge_matrix_V12.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-2A", "V12", "uncore",
{
-- source: SNB/SandyBridge_uncore_V12.tsv
["unc_cbo_xsnp_response.miss"] = 0x0122,
["unc_cbo_xsnp_response.inval"] = 0x0222,
["unc_cbo_xsnp_response.hit"] = 0x0422,
["unc_cbo_xsnp_response.hitm"] = 0x0822,
["unc_cbo_xsnp_response.inval_m"] = 0x1022,
["unc_cbo_xsnp_response.external_filter"] = 0x2022,
["unc_cbo_xsnp_response.xcore_filter"] = 0x4022,
["unc_cbo_xsnp_response.eviction_filter"] = 0x8022,
["unc_cbo_cache_lookup.m"] = 0x0134,
["unc_cbo_cache_lookup.e"] = 0x0234,
["unc_cbo_cache_lookup.s"] = 0x0434,
["unc_cbo_cache_lookup.i"] = 0x0834,
["unc_cbo_cache_lookup.read_filter"] = 0x1034,
["unc_cbo_cache_lookup.write_filter"] = 0x2034,
["unc_cbo_cache_lookup.extsnp_filter"] = 0x4034,
["unc_cbo_cache_lookup.any_request_filter"] = 0x8034,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_arb_trk_requests.evictions"] = 0x8081,
["unc_arb_coh_trk_occupancy.all"] = 0x0183,
["unc_arb_coh_trk_requests.all"] = 0x0184,
["unc_arb_trk_occupancy.cycles_with_any_request"] = 0x0180,
["unc_arb_trk_occupancy.cycles_over_half_full"] = 0x0180,
["unc_clock.socket"] = 0x0100,
["unc_cbo_cache_lookup.es"] = 0x0634,
},
},
{"GenuineIntel-6-2D", "V18", "core",
{
-- source: JKT/Jaketown_core_V18.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.taken_direct_near_call"] = 0x9089,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_direct_near_call"] = 0xd089,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["itlb.itlb_flush"] = 0x01ae,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["lsd.uops"] = 0x01a8,
["lsd.cycles_active"] = 0x01a8,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["insts_written_to_iq.insts"] = 0x0117,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["dsb2mite_switches.count"] = 0x01ab,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["dsb_fill.other_cancel"] = 0x02ac,
["dsb_fill.exceed_dsb_lines"] = 0x08ac,
["int_misc.rat_stall_cycles"] = 0x400d,
["partial_rat_stalls.flags_merge_uop"] = 0x2059,
["partial_rat_stalls.slow_lea_window"] = 0x4059,
["partial_rat_stalls.mul_single_uop"] = 0x8059,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.lb"] = 0x02a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["resource_stalls2.bob_full"] = 0x405b,
["uops_issued.any"] = 0x010e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["rs_events.empty_cycles"] = 0x015e,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring0_trans"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["inst_retired.any_p"] = 0x00c0,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.near_call"] = 0x02c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.not_taken"] = 0x10c5,
["br_misp_retired.taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["other_assists.itlb_miss_retired"] = 0x02c1,
["other_assists.avx_store"] = 0x08c1,
["other_assists.avx_to_sse"] = 0x10c1,
["other_assists.sse_to_avx"] = 0x20c1,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_trans_retired.precise_store"] = 0x02cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.llc_hit"] = 0x04d1,
["mem_load_uops_retired.llc_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_llc_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_llc_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_llc_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_llc_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_llc_miss_retired.local_dram"] = 0x01d3,
["mem_load_uops_llc_miss_retired.remote_dram"] = 0x04d3,
["arith.fpu_div_active"] = 0x0114,
["arith.fpu_div"] = 0x0114,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_comp_ops_exe.sse_packed_double"] = 0x1010,
["fp_comp_ops_exe.sse_scalar_single"] = 0x2010,
["fp_comp_ops_exe.sse_packed_single"] = 0x4010,
["fp_comp_ops_exe.sse_scalar_double"] = 0x8010,
["simd_fp_256.packed_single"] = 0x0111,
["simd_fp_256.packed_double"] = 0x0211,
["uops_dispatched.thread"] = 0x01b1,
["uops_dispatched.core"] = 0x02b1,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_4"] = 0x40a1,
["uops_dispatched_port.port_5"] = 0x80a1,
["cycle_activity.cycles_no_dispatch"] = 0x04a3,
["cycle_activity.cycles_l1d_pending"] = 0x02a3,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.stalls_l1d_pending"] = 0x06a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["ept.walk_cycles"] = 0x104f,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_duration"] = 0x0485,
["itlb_misses.stlb_hit"] = 0x1085,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed"] = 0x0208,
["dtlb_load_misses.walk_duration"] = 0x0408,
["dtlb_load_misses.stlb_hit"] = 0x1008,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x0449,
["dtlb_store_misses.stlb_hit"] = 0x1049,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["l1d.replacement"] = 0x0151,
["l1d.allocated_in_m"] = 0x0251,
["l1d.eviction"] = 0x0451,
["l1d.all_m_replacement"] = 0x0851,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["hw_pre_req.dl1_miss"] = 0x024e,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["ld_blocks.data_unknown"] = 0x0103,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["ld_blocks.all_block"] = 0x1003,
["ld_blocks_partial.address_alias"] = 0x0107,
["ld_blocks_partial.all_sta_block"] = 0x0807,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["agu_bypass_cancel.count"] = 0x01b6,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["l2_rqsts.demand_data_rd_hit"] = 0x0124,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.code_rd_hit"] = 0x1024,
["l2_rqsts.code_rd_miss"] = 0x2024,
["l2_rqsts.pf_hit"] = 0x4024,
["l2_rqsts.pf_miss"] = 0x8024,
["l2_store_lock_rqsts.miss"] = 0x0127,
["l2_store_lock_rqsts.hit_e"] = 0x0427,
["l2_store_lock_rqsts.hit_m"] = 0x0827,
["l2_store_lock_rqsts.all"] = 0x0f27,
["l2_l1d_wb_rqsts.miss"] = 0x0128,
["l2_l1d_wb_rqsts.hit_s"] = 0x0228,
["l2_l1d_wb_rqsts.hit_e"] = 0x0428,
["l2_l1d_wb_rqsts.hit_m"] = 0x0828,
["l2_l1d_wb_rqsts.all"] = 0x0f28,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.pf_clean"] = 0x04f2,
["l2_lines_out.pf_dirty"] = 0x08f2,
["l2_lines_out.dirty_all"] = 0x0af2,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["sq_misc.split_lock"] = 0x10f4,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["br_inst_retired.near_call_r3"] = 0x02c4,
["uops_dispatched_port.port_0_core"] = 0x01a1,
["uops_dispatched_port.port_1_core"] = 0x02a1,
["uops_dispatched_port.port_4_core"] = 0x40a1,
["uops_dispatched_port.port_5_core"] = 0x80a1,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["uops_dispatched_port.port_2"] = 0x0ca1,
["uops_dispatched_port.port_3"] = 0x30a1,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["uops_dispatched_port.port_2_core"] = 0x0ca1,
["uops_dispatched_port.port_3_core"] = 0x30a1,
["inst_retired.prec_dist"] = 0x01c0,
["l2_rqsts.all_demand_data_rd"] = 0x0324,
["l2_rqsts.all_rfo"] = 0x0c24,
["l2_rqsts.all_code_rd"] = 0x3024,
["l2_rqsts.all_pf"] = 0xc024,
["l1d_blocks.bank_conflict_cycles"] = 0x05bf,
["resource_stalls2.all_prf_control"] = 0x0f5b,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["resource_stalls2.all_fl_empty"] = 0x0c5b,
["resource_stalls.mem_rs"] = 0x0ea2,
["resource_stalls.ooo_rsrc"] = 0xf0a2,
["resource_stalls2.ooo_rsrc"] = 0x4f5b,
["resource_stalls.lb_sb"] = 0x0aa2,
["int_misc.recovery_cycles"] = 0x030d,
["partial_rat_stalls.flags_merge_uop_cycles"] = 0x2059,
["idq_uops_not_delivered.cycles_ge_1_uop_deliv.core"] = 0x019c,
["int_misc.recovery_stalls_count"] = 0x030d,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["dsb_fill.all_cancel"] = 0x0aac,
["fp_assist.any"] = 0x1eca,
["baclears.any"] = 0x1fe6,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.all_branches"] = 0xff89,
["idq.mite_all_uops"] = 0x3c79,
["uops_retired.core_stall_cycles"] = 0x01c2,
["lsd.cycles_4_uops"] = 0x01a8,
["machine_clears.count"] = 0x01c3,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["offcore_requests_outstanding.demand_data_rd_c6"] = 0x0160,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-2D", "V18", "offcore",
{
-- source: JKT/Jaketown_matrix_V18.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-2D", "V18", "uncore",
{
-- source: JKT/Jaketown_uncore_V18.tsv
["unc_c_clockticks"] = 0x0000,
["unc_c_counter0_occupancy"] = 0x001f,
["unc_c_ismq_drd_miss_occ"] = 0x0021,
["unc_c_llc_lookup.data_read"] = 0x0334,
["unc_c_llc_lookup.nid"] = 0x4134,
["unc_c_llc_lookup.remote_snoop"] = 0x0934,
["unc_c_llc_lookup.write"] = 0x0534,
["unc_c_llc_victims.e_state"] = 0x0237,
["unc_c_llc_victims.miss"] = 0x0837,
["unc_c_llc_victims.m_state"] = 0x0137,
["unc_c_llc_victims.nid"] = 0x4037,
["unc_c_llc_victims.s_state"] = 0x0437,
["unc_c_misc.rfo_hit_s"] = 0x0839,
["unc_c_misc.rspi_was_fse"] = 0x0139,
["unc_c_misc.started"] = 0x0439,
["unc_c_misc.wc_aliasing"] = 0x0239,
["unc_c_ring_ad_used.down_even"] = 0x041b,
["unc_c_ring_ad_used.down_odd"] = 0x081b,
["unc_c_ring_ad_used.up_even"] = 0x011b,
["unc_c_ring_ad_used.up_odd"] = 0x021b,
["unc_c_ring_ak_used.down_even"] = 0x041c,
["unc_c_ring_ak_used.down_odd"] = 0x081c,
["unc_c_ring_ak_used.up_even"] = 0x011c,
["unc_c_ring_ak_used.up_odd"] = 0x021c,
["unc_c_ring_bl_used.down_even"] = 0x041d,
["unc_c_ring_bl_used.down_odd"] = 0x081d,
["unc_c_ring_bl_used.up_even"] = 0x011d,
["unc_c_ring_bl_used.up_odd"] = 0x021d,
["unc_c_ring_bounces.ak_core"] = 0x0205,
["unc_c_ring_bounces.bl_core"] = 0x0405,
["unc_c_ring_bounces.iv_core"] = 0x0805,
["unc_c_ring_iv_used.any"] = 0x0f1e,
["unc_c_ring_sink_starved.ad_cache"] = 0x0106,
["unc_c_ring_sink_starved.ak_core"] = 0x0206,
["unc_c_ring_sink_starved.bl_core"] = 0x0406,
["unc_c_ring_sink_starved.iv_core"] = 0x0806,
["unc_c_ring_src_thrtl"] = 0x0007,
["unc_c_rxr_ext_starved.ipq"] = 0x0212,
["unc_c_rxr_ext_starved.irq"] = 0x0112,
["unc_c_rxr_ext_starved.ismq"] = 0x0412,
["unc_c_rxr_ext_starved.ismq_bids"] = 0x0812,
["unc_c_rxr_inserts.ipq"] = 0x0413,
["unc_c_rxr_inserts.irq"] = 0x0113,
["unc_c_rxr_inserts.irq_rejected"] = 0x0213,
["unc_c_rxr_inserts.vfifo"] = 0x1013,
["unc_c_rxr_int_starved.ipq"] = 0x0414,
["unc_c_rxr_int_starved.irq"] = 0x0114,
["unc_c_rxr_int_starved.ismq"] = 0x0814,
["unc_c_rxr_ipq_retry.addr_conflict"] = 0x0431,
["unc_c_rxr_ipq_retry.any"] = 0x0131,
["unc_c_rxr_ipq_retry.full"] = 0x0231,
["unc_c_rxr_ipq_retry.qpi_credits"] = 0x1031,
["unc_c_rxr_irq_retry.addr_conflict"] = 0x0432,
["unc_c_rxr_irq_retry.any"] = 0x0132,
["unc_c_rxr_irq_retry.full"] = 0x0232,
["unc_c_rxr_irq_retry.qpi_credits"] = 0x1032,
["unc_c_rxr_irq_retry.rtid"] = 0x0832,
["unc_c_rxr_ismq_retry.any"] = 0x0133,
["unc_c_rxr_ismq_retry.full"] = 0x0233,
["unc_c_rxr_ismq_retry.iio_credits"] = 0x2033,
["unc_c_rxr_ismq_retry.qpi_credits"] = 0x1033,
["unc_c_rxr_ismq_retry.rtid"] = 0x0833,
["unc_c_rxr_occupancy.ipq"] = 0x0411,
["unc_c_rxr_occupancy.irq"] = 0x0111,
["unc_c_rxr_occupancy.irq_rejected"] = 0x0211,
["unc_c_rxr_occupancy.vfifo"] = 0x1011,
["unc_c_tor_inserts.eviction"] = 0x0435,
["unc_c_tor_inserts.miss_all"] = 0x0a35,
["unc_c_tor_inserts.miss_opcode"] = 0x0335,
["unc_c_tor_inserts.nid_all"] = 0x4835,
["unc_c_tor_inserts.nid_eviction"] = 0x4435,
["unc_c_tor_inserts.nid_miss_all"] = 0x4a35,
["unc_c_tor_inserts.nid_miss_opcode"] = 0x4335,
["unc_c_tor_inserts.nid_opcode"] = 0x4135,
["unc_c_tor_inserts.nid_wb"] = 0x5035,
["unc_c_tor_inserts.opcode"] = 0x0135,
["unc_c_tor_inserts.wb"] = 0x1035,
["unc_c_tor_occupancy.all"] = 0x0836,
["unc_c_tor_occupancy.eviction"] = 0x0436,
["unc_c_tor_occupancy.miss_all"] = 0x0a36,
["unc_c_tor_occupancy.miss_opcode"] = 0x0336,
["unc_c_tor_occupancy.nid_all"] = 0x4836,
["unc_c_tor_occupancy.nid_eviction"] = 0x4436,
["unc_c_tor_occupancy.nid_miss_all"] = 0x4a36,
["unc_c_tor_occupancy.nid_miss_opcode"] = 0x4336,
["unc_c_tor_occupancy.nid_opcode"] = 0x4136,
["unc_c_tor_occupancy.opcode"] = 0x0136,
["unc_c_txr_ads_used"] = 0x0004,
["unc_c_txr_inserts.ad_cache"] = 0x0102,
["unc_c_txr_inserts.ad_core"] = 0x1002,
["unc_c_txr_inserts.ak_cache"] = 0x0202,
["unc_c_txr_inserts.ak_core"] = 0x2002,
["unc_c_txr_inserts.bl_cache"] = 0x0402,
["unc_c_txr_inserts.bl_core"] = 0x4002,
["unc_c_txr_inserts.iv_cache"] = 0x0802,
["unc_c_txr_starved.ak"] = 0x0203,
["unc_c_txr_starved.bl"] = 0x0403,
["unc_p_clockticks"] = 0x0000,
["unc_p_core0_transition_cycles"] = 0x0003,
["unc_p_core1_transition_cycles"] = 0x0004,
["unc_p_core2_transition_cycles"] = 0x0005,
["unc_p_core3_transition_cycles"] = 0x0006,
["unc_p_core4_transition_cycles"] = 0x0007,
["unc_p_core5_transition_cycles"] = 0x0008,
["unc_p_core6_transition_cycles"] = 0x0009,
["unc_p_core7_transition_cycles"] = 0x000a,
["unc_p_demotions_core0"] = 0x001e,
["unc_p_demotions_core1"] = 0x001f,
["unc_p_demotions_core2"] = 0x0020,
["unc_p_demotions_core3"] = 0x0021,
["unc_p_demotions_core4"] = 0x0022,
["unc_p_demotions_core5"] = 0x0023,
["unc_p_demotions_core6"] = 0x0024,
["unc_p_demotions_core7"] = 0x0025,
["unc_p_freq_band0_cycles"] = 0x000b,
["unc_p_freq_band1_cycles"] = 0x000c,
["unc_p_freq_band2_cycles"] = 0x000d,
["unc_p_freq_band3_cycles"] = 0x000e,
["unc_p_freq_max_current_cycles"] = 0x0007,
["unc_p_freq_max_limit_thermal_cycles"] = 0x0004,
["unc_p_freq_max_os_cycles"] = 0x0006,
["unc_p_freq_max_power_cycles"] = 0x0005,
["unc_p_freq_min_io_p_cycles"] = 0x0001,
["unc_p_freq_min_perf_p_cycles"] = 0x0002,
["unc_p_freq_trans_cycles"] = 0x0000,
["unc_p_memory_phase_shedding_cycles"] = 0x002f,
["unc_p_power_state_occupancy.cores_c0"] = 0x4080,
["unc_p_power_state_occupancy.cores_c3"] = 0x8080,
["unc_p_power_state_occupancy.cores_c6"] = 0xc080,
["unc_p_prochot_external_cycles"] = 0x000a,
["unc_p_prochot_internal_cycles"] = 0x0009,
["unc_p_total_transition_cycles"] = 0x000b,
["unc_p_volt_trans_cycles_change"] = 0x0003,
["unc_p_volt_trans_cycles_decrease"] = 0x0002,
["unc_p_volt_trans_cycles_increase"] = 0x0001,
["unc_p_vr_hot_cycles"] = 0x0032,
["unc_u_event_msg.doorbell_rcvd"] = 0x0842,
["unc_u_event_msg.int_prio"] = 0x1042,
["unc_u_event_msg.ipi_rcvd"] = 0x0442,
["unc_u_event_msg.msi_rcvd"] = 0x0242,
["unc_u_event_msg.vlw_rcvd"] = 0x0142,
["unc_u_filter_match.disable"] = 0x0241,
["unc_u_filter_match.enable"] = 0x0141,
["unc_u_filter_match.u2c_disable"] = 0x0841,
["unc_u_filter_match.u2c_enable"] = 0x0441,
["unc_u_lock_cycles"] = 0x0044,
["unc_u_msg_chnl_size_count.4b"] = 0x0147,
["unc_u_msg_chnl_size_count.8b"] = 0x0247,
["unc_u_phold_cycles.ack_to_deassert"] = 0x0245,
["unc_u_phold_cycles.assert_to_ack"] = 0x0145,
["unc_u_racu_requests.count"] = 0x0146,
["unc_u_u2c_events.cmc"] = 0x1043,
["unc_u_u2c_events.livelock"] = 0x0443,
["unc_u_u2c_events.lterror"] = 0x0843,
["unc_u_u2c_events.monitor_t0"] = 0x0143,
["unc_u_u2c_events.monitor_t1"] = 0x0243,
["unc_u_u2c_events.other"] = 0x8043,
["unc_u_u2c_events.trap"] = 0x4043,
["unc_u_u2c_events.umc"] = 0x2043,
["unc_q_clockticks"] = 0x0014,
["unc_q_cto_count"] = 0x0038,
["unc_q_direct2core.failure_credits"] = 0x0213,
["unc_q_direct2core.failure_credits_rbt"] = 0x0813,
["unc_q_direct2core.failure_rbt"] = 0x0413,
["unc_q_direct2core.success"] = 0x0113,
["unc_q_l1_power_cycles"] = 0x0012,
["unc_q_rxl0p_power_cycles"] = 0x0010,
["unc_q_rxl0_power_cycles"] = 0x000f,
["unc_q_rxl_bypassed"] = 0x0009,
["unc_q_rxl_crc_errors.link_init"] = 0x0103,
["unc_q_rxl_crc_errors.normal_op"] = 0x0203,
["unc_q_rxl_credits_consumed_vn0.drs"] = 0x011e,
["unc_q_rxl_credits_consumed_vn0.hom"] = 0x081e,
["unc_q_rxl_credits_consumed_vn0.ncb"] = 0x021e,
["unc_q_rxl_credits_consumed_vn0.ncs"] = 0x041e,
["unc_q_rxl_credits_consumed_vn0.ndr"] = 0x201e,
["unc_q_rxl_credits_consumed_vn0.snp"] = 0x101e,
["unc_q_rxl_credits_consumed_vna"] = 0x001d,
["unc_q_rxl_cycles_ne"] = 0x000a,
["unc_q_rxl_flits_g0.data"] = 0x0201,
["unc_q_rxl_flits_g0.idle"] = 0x0101,
["unc_q_rxl_flits_g0.non_data"] = 0x0401,
["unc_q_rxl_flits_g1.drs"] = 0x1802,
["unc_q_rxl_flits_g1.drs_data"] = 0x0802,
["unc_q_rxl_flits_g1.drs_nondata"] = 0x1002,
["unc_q_rxl_flits_g1.hom"] = 0x0602,
["unc_q_rxl_flits_g1.hom_nonreq"] = 0x0402,
["unc_q_rxl_flits_g1.hom_req"] = 0x0202,
["unc_q_rxl_flits_g1.snp"] = 0x0102,
["unc_q_rxl_flits_g2.ncb"] = 0x0c03,
["unc_q_rxl_flits_g2.ncb_data"] = 0x0403,
["unc_q_rxl_flits_g2.ncb_nondata"] = 0x0803,
["unc_q_rxl_flits_g2.ncs"] = 0x1003,
["unc_q_rxl_flits_g2.ndr_ad"] = 0x0103,
["unc_q_rxl_flits_g2.ndr_ak"] = 0x0203,
["unc_q_rxl_inserts"] = 0x0008,
["unc_q_rxl_inserts_drs"] = 0x0009,
["unc_q_rxl_inserts_hom"] = 0x000c,
["unc_q_rxl_inserts_ncb"] = 0x000a,
["unc_q_rxl_inserts_ncs"] = 0x000b,
["unc_q_rxl_inserts_ndr"] = 0x000e,
["unc_q_rxl_inserts_snp"] = 0x000d,
["unc_q_rxl_occupancy"] = 0x000b,
["unc_q_rxl_occupancy_drs"] = 0x0015,
["unc_q_rxl_occupancy_hom"] = 0x0018,
["unc_q_rxl_occupancy_ncb"] = 0x0016,
["unc_q_rxl_occupancy_ncs"] = 0x0017,
["unc_q_rxl_occupancy_ndr"] = 0x001a,
["unc_q_rxl_occupancy_snp"] = 0x0019,
["unc_q_rxl_stalls.bgf_drs"] = 0x0135,
["unc_q_rxl_stalls.bgf_hom"] = 0x0835,
["unc_q_rxl_stalls.bgf_ncb"] = 0x0235,
["unc_q_rxl_stalls.bgf_ncs"] = 0x0435,
["unc_q_rxl_stalls.bgf_ndr"] = 0x2035,
["unc_q_rxl_stalls.bgf_snp"] = 0x1035,
["unc_q_rxl_stalls.egress_credits"] = 0x4035,
["unc_q_rxl_stalls.gv"] = 0x8035,
["unc_q_txl0p_power_cycles"] = 0x000d,
["unc_q_txl0_power_cycles"] = 0x000c,
["unc_q_txl_bypassed"] = 0x0005,
["unc_q_txl_crc_no_credits.almost_full"] = 0x0202,
["unc_q_txl_crc_no_credits.full"] = 0x0102,
["unc_q_txl_cycles_ne"] = 0x0006,
["unc_q_txl_flits_g0.data"] = 0x0200,
["unc_q_txl_flits_g0.idle"] = 0x0100,
["unc_q_txl_flits_g0.non_data"] = 0x0400,
["unc_q_txl_flits_g1.drs"] = 0x1800,
["unc_q_txl_flits_g1.drs_data"] = 0x0800,
["unc_q_txl_flits_g1.drs_nondata"] = 0x1000,
["unc_q_txl_flits_g1.hom"] = 0x0600,
["unc_q_txl_flits_g1.hom_nonreq"] = 0x0400,
["unc_q_txl_flits_g1.hom_req"] = 0x0200,
["unc_q_txl_flits_g1.snp"] = 0x0100,
["unc_q_txl_flits_g2.ncb"] = 0x0c01,
["unc_q_txl_flits_g2.ncb_data"] = 0x0401,
["unc_q_txl_flits_g2.ncb_nondata"] = 0x0801,
["unc_q_txl_flits_g2.ncs"] = 0x1001,
["unc_q_txl_flits_g2.ndr_ad"] = 0x0101,
["unc_q_txl_flits_g2.ndr_ak"] = 0x0201,
["unc_q_txl_inserts"] = 0x0004,
["unc_q_txl_occupancy"] = 0x0007,
["unc_q_vna_credit_returns"] = 0x001c,
["unc_q_vna_credit_return_occupancy"] = 0x001b,
["unc_r3_clockticks"] = 0x0001,
["unc_r3_iio_credits_acquired.drs"] = 0x0820,
["unc_r3_iio_credits_acquired.ncb"] = 0x1020,
["unc_r3_iio_credits_acquired.ncs"] = 0x2020,
["unc_r3_iio_credits_reject.drs"] = 0x0821,
["unc_r3_iio_credits_reject.ncb"] = 0x1021,
["unc_r3_iio_credits_reject.ncs"] = 0x2021,
["unc_r3_iio_credits_used.drs"] = 0x0822,
["unc_r3_iio_credits_used.ncb"] = 0x1022,
["unc_r3_iio_credits_used.ncs"] = 0x2022,
["unc_r3_ring_ad_used.ccw_even"] = 0x0407,
["unc_r3_ring_ad_used.ccw_odd"] = 0x0807,
["unc_r3_ring_ad_used.cw_even"] = 0x0107,
["unc_r3_ring_ad_used.cw_odd"] = 0x0207,
["unc_r3_ring_ak_used.ccw_even"] = 0x0408,
["unc_r3_ring_ak_used.ccw_odd"] = 0x0808,
["unc_r3_ring_ak_used.cw_even"] = 0x0108,
["unc_r3_ring_ak_used.cw_odd"] = 0x0208,
["unc_r3_ring_bl_used.ccw_even"] = 0x0409,
["unc_r3_ring_bl_used.ccw_odd"] = 0x0809,
["unc_r3_ring_bl_used.cw_even"] = 0x0109,
["unc_r3_ring_bl_used.cw_odd"] = 0x0209,
["unc_r3_ring_iv_used.any"] = 0x0f0a,
["unc_r3_rxr_bypassed.ad"] = 0x0112,
["unc_r3_rxr_cycles_ne.drs"] = 0x0810,
["unc_r3_rxr_cycles_ne.hom"] = 0x0110,
["unc_r3_rxr_cycles_ne.ncb"] = 0x1010,
["unc_r3_rxr_cycles_ne.ncs"] = 0x2010,
["unc_r3_rxr_cycles_ne.ndr"] = 0x0410,
["unc_r3_rxr_cycles_ne.snp"] = 0x0210,
["unc_r3_rxr_inserts.drs"] = 0x0811,
["unc_r3_rxr_inserts.hom"] = 0x0111,
["unc_r3_rxr_inserts.ncb"] = 0x1011,
["unc_r3_rxr_inserts.ncs"] = 0x2011,
["unc_r3_rxr_inserts.ndr"] = 0x0411,
["unc_r3_rxr_inserts.snp"] = 0x0211,
["unc_r3_rxr_occupancy.drs"] = 0x0813,
["unc_r3_rxr_occupancy.hom"] = 0x0113,
["unc_r3_rxr_occupancy.ncb"] = 0x1013,
["unc_r3_rxr_occupancy.ncs"] = 0x2013,
["unc_r3_rxr_occupancy.ndr"] = 0x0413,
["unc_r3_rxr_occupancy.snp"] = 0x0213,
["unc_r3_vn0_credits_reject.drs"] = 0x0837,
["unc_r3_vn0_credits_reject.hom"] = 0x0137,
["unc_r3_vn0_credits_reject.ncb"] = 0x1037,
["unc_r3_vn0_credits_reject.ncs"] = 0x2037,
["unc_r3_vn0_credits_reject.ndr"] = 0x0437,
["unc_r3_vn0_credits_reject.snp"] = 0x0237,
["unc_r3_vn0_credits_used.drs"] = 0x0836,
["unc_r3_vn0_credits_used.hom"] = 0x0136,
["unc_r3_vn0_credits_used.ncb"] = 0x1036,
["unc_r3_vn0_credits_used.ncs"] = 0x2036,
["unc_r3_vn0_credits_used.ndr"] = 0x0436,
["unc_r3_vn0_credits_used.snp"] = 0x0236,
["unc_r3_vna_credits_acquired"] = 0x0033,
["unc_r3_vna_credits_reject.drs"] = 0x0834,
["unc_r3_vna_credits_reject.hom"] = 0x0134,
["unc_r3_vna_credits_reject.ncb"] = 0x1034,
["unc_r3_vna_credits_reject.ncs"] = 0x2034,
["unc_r3_vna_credits_reject.ndr"] = 0x0434,
["unc_r3_vna_credits_reject.snp"] = 0x0234,
["unc_r3_vna_credit_cycles_out"] = 0x0031,
["unc_r3_vna_credit_cycles_used"] = 0x0032,
["unc_r2_clockticks"] = 0x0001,
["unc_r2_iio_credits_acquired.drs"] = 0x0833,
["unc_r2_iio_credits_acquired.ncb"] = 0x1033,
["unc_r2_iio_credits_acquired.ncs"] = 0x2033,
["unc_r2_iio_credits_reject.drs"] = 0x0834,
["unc_r2_iio_credits_reject.ncb"] = 0x1034,
["unc_r2_iio_credits_reject.ncs"] = 0x2034,
["unc_r2_iio_credits_used.drs"] = 0x0832,
["unc_r2_iio_credits_used.ncb"] = 0x1032,
["unc_r2_iio_credits_used.ncs"] = 0x2032,
["unc_r2_ring_ad_used.ccw_even"] = 0x0407,
["unc_r2_ring_ad_used.ccw_odd"] = 0x0807,
["unc_r2_ring_ad_used.cw_even"] = 0x0107,
["unc_r2_ring_ad_used.cw_odd"] = 0x0207,
["unc_r2_ring_ak_used.ccw_even"] = 0x0408,
["unc_r2_ring_ak_used.ccw_odd"] = 0x0808,
["unc_r2_ring_ak_used.cw_even"] = 0x0108,
["unc_r2_ring_ak_used.cw_odd"] = 0x0208,
["unc_r2_ring_bl_used.ccw_even"] = 0x0409,
["unc_r2_ring_bl_used.ccw_odd"] = 0x0809,
["unc_r2_ring_bl_used.cw_even"] = 0x0109,
["unc_r2_ring_bl_used.cw_odd"] = 0x0209,
["unc_r2_ring_iv_used.any"] = 0x0f0a,
["unc_r2_rxr_ak_bounces"] = 0x0012,
["unc_r2_rxr_cycles_ne.drs"] = 0x0810,
["unc_r2_rxr_cycles_ne.ncb"] = 0x1010,
["unc_r2_rxr_cycles_ne.ncs"] = 0x2010,
["unc_r2_txr_cycles_full.ad"] = 0x0125,
["unc_r2_txr_cycles_full.ak"] = 0x0225,
["unc_r2_txr_cycles_full.bl"] = 0x0425,
["unc_r2_txr_cycles_ne.ad"] = 0x0123,
["unc_r2_txr_cycles_ne.ak"] = 0x0223,
["unc_r2_txr_cycles_ne.bl"] = 0x0423,
["unc_r2_txr_nacks.ad"] = 0x0126,
["unc_r2_txr_nacks.ak"] = 0x0226,
["unc_r2_txr_nacks.bl"] = 0x0426,
["unc_h_addr_opc_match.filt"] = 0x0320,
["unc_h_bypass_imc.not_taken"] = 0x0214,
["unc_h_bypass_imc.taken"] = 0x0114,
["unc_h_clockticks"] = 0x0000,
["unc_h_conflict_cycles.conflict"] = 0x020b,
["unc_h_conflict_cycles.no_conflict"] = 0x010b,
["unc_h_direct2core_count"] = 0x0011,
["unc_h_direct2core_cycles_disabled"] = 0x0012,
["unc_h_direct2core_txn_override"] = 0x0013,
["unc_h_directory_lookup.no_snp"] = 0x020c,
["unc_h_directory_lookup.snp"] = 0x010c,
["unc_h_directory_update.any"] = 0x030d,
["unc_h_directory_update.clear"] = 0x020d,
["unc_h_directory_update.set"] = 0x010d,
["unc_h_igr_no_credit_cycles.ad_qpi0"] = 0x0122,
["unc_h_igr_no_credit_cycles.ad_qpi1"] = 0x0222,
["unc_h_igr_no_credit_cycles.bl_qpi0"] = 0x0422,
["unc_h_igr_no_credit_cycles.bl_qpi1"] = 0x0822,
["unc_h_imc_retry"] = 0x001e,
["unc_h_imc_writes.all"] = 0x0f1a,
["unc_h_imc_writes.full"] = 0x011a,
["unc_h_imc_writes.full_isoch"] = 0x041a,
["unc_h_imc_writes.partial"] = 0x021a,
["unc_h_imc_writes.partial_isoch"] = 0x081a,
["unc_h_requests.reads"] = 0x0301,
["unc_h_requests.writes"] = 0x0c01,
["unc_h_ring_ad_used.ccw_even"] = 0x043e,
["unc_h_ring_ad_used.ccw_odd"] = 0x083e,
["unc_h_ring_ad_used.cw_even"] = 0x013e,
["unc_h_ring_ad_used.cw_odd"] = 0x023e,
["unc_h_ring_ak_used.ccw_even"] = 0x043f,
["unc_h_ring_ak_used.ccw_odd"] = 0x083f,
["unc_h_ring_ak_used.cw_even"] = 0x013f,
["unc_h_ring_ak_used.cw_odd"] = 0x023f,
["unc_h_ring_bl_used.ccw_even"] = 0x0440,
["unc_h_ring_bl_used.ccw_odd"] = 0x0840,
["unc_h_ring_bl_used.cw_even"] = 0x0140,
["unc_h_ring_bl_used.cw_odd"] = 0x0240,
["unc_h_rpq_cycles_no_reg_credits.chn0"] = 0x0115,
["unc_h_rpq_cycles_no_reg_credits.chn1"] = 0x0215,
["unc_h_rpq_cycles_no_reg_credits.chn2"] = 0x0415,
["unc_h_rpq_cycles_no_reg_credits.chn3"] = 0x0815,
["unc_h_rpq_cycles_no_spec_credits.chn0"] = 0x0116,
["unc_h_rpq_cycles_no_spec_credits.chn1"] = 0x0216,
["unc_h_rpq_cycles_no_spec_credits.chn2"] = 0x0416,
["unc_h_rpq_cycles_no_spec_credits.chn3"] = 0x0816,
["unc_h_tad_requests_g0.region0"] = 0x011b,
["unc_h_tad_requests_g0.region1"] = 0x021b,
["unc_h_tad_requests_g0.region2"] = 0x041b,
["unc_h_tad_requests_g0.region3"] = 0x081b,
["unc_h_tad_requests_g0.region4"] = 0x101b,
["unc_h_tad_requests_g0.region5"] = 0x201b,
["unc_h_tad_requests_g0.region6"] = 0x401b,
["unc_h_tad_requests_g0.region7"] = 0x801b,
["unc_h_tad_requests_g1.region10"] = 0x041c,
["unc_h_tad_requests_g1.region11"] = 0x081c,
["unc_h_tad_requests_g1.region8"] = 0x011c,
["unc_h_tad_requests_g1.region9"] = 0x021c,
["unc_h_tracker_inserts.all"] = 0x0306,
["unc_h_txr_ad.ndr"] = 0x010f,
["unc_h_txr_ad.snp"] = 0x020f,
["unc_h_txr_ad_cycles_full.all"] = 0x032a,
["unc_h_txr_ad_cycles_full.sched0"] = 0x012a,
["unc_h_txr_ad_cycles_full.sched1"] = 0x022a,
["unc_h_txr_ad_cycles_ne.all"] = 0x0329,
["unc_h_txr_ad_cycles_ne.sched0"] = 0x0129,
["unc_h_txr_ad_cycles_ne.sched1"] = 0x0229,
["unc_h_txr_ad_inserts.all"] = 0x0327,
["unc_h_txr_ad_inserts.sched0"] = 0x0127,
["unc_h_txr_ad_inserts.sched1"] = 0x0227,
["unc_h_txr_ad_occupancy.all"] = 0x0328,
["unc_h_txr_ad_occupancy.sched0"] = 0x0128,
["unc_h_txr_ad_occupancy.sched1"] = 0x0228,
["unc_h_txr_ak_cycles_full.all"] = 0x0332,
["unc_h_txr_ak_cycles_full.sched0"] = 0x0132,
["unc_h_txr_ak_cycles_full.sched1"] = 0x0232,
["unc_h_txr_ak_cycles_ne.all"] = 0x0331,
["unc_h_txr_ak_cycles_ne.sched0"] = 0x0131,
["unc_h_txr_ak_cycles_ne.sched1"] = 0x0231,
["unc_h_txr_ak_inserts.all"] = 0x032f,
["unc_h_txr_ak_inserts.sched0"] = 0x012f,
["unc_h_txr_ak_inserts.sched1"] = 0x022f,
["unc_h_txr_ak_ndr"] = 0x000e,
["unc_h_txr_ak_occupancy.all"] = 0x0330,
["unc_h_txr_ak_occupancy.sched0"] = 0x0130,
["unc_h_txr_ak_occupancy.sched1"] = 0x0230,
["unc_h_txr_bl.drs_cache"] = 0x0110,
["unc_h_txr_bl.drs_core"] = 0x0210,
["unc_h_txr_bl.drs_qpi"] = 0x0410,
["unc_h_txr_bl_cycles_full.all"] = 0x0336,
["unc_h_txr_bl_cycles_full.sched0"] = 0x0136,
["unc_h_txr_bl_cycles_full.sched1"] = 0x0236,
["unc_h_txr_bl_cycles_ne.all"] = 0x0335,
["unc_h_txr_bl_cycles_ne.sched0"] = 0x0135,
["unc_h_txr_bl_cycles_ne.sched1"] = 0x0235,
["unc_h_txr_bl_inserts.all"] = 0x0333,
["unc_h_txr_bl_inserts.sched0"] = 0x0133,
["unc_h_txr_bl_inserts.sched1"] = 0x0233,
["unc_h_txr_bl_occupancy.all"] = 0x0334,
["unc_h_txr_bl_occupancy.sched0"] = 0x0134,
["unc_h_txr_bl_occupancy.sched1"] = 0x0234,
["unc_h_wpq_cycles_no_reg_credits.chn0"] = 0x0118,
["unc_h_wpq_cycles_no_reg_credits.chn1"] = 0x0218,
["unc_h_wpq_cycles_no_reg_credits.chn2"] = 0x0418,
["unc_h_wpq_cycles_no_reg_credits.chn3"] = 0x0818,
["unc_h_wpq_cycles_no_spec_credits.chn0"] = 0x0119,
["unc_h_wpq_cycles_no_spec_credits.chn1"] = 0x0219,
["unc_h_wpq_cycles_no_spec_credits.chn2"] = 0x0419,
["unc_h_wpq_cycles_no_spec_credits.chn3"] = 0x0819,
["unc_m_act_count"] = 0x0001,
["unc_m_cas_count.all"] = 0x0f04,
["unc_m_cas_count.rd"] = 0x0304,
["unc_m_cas_count.rd_reg"] = 0x0104,
["unc_m_cas_count.rd_underfill"] = 0x0204,
["unc_m_cas_count.wr"] = 0x0c04,
["unc_m_cas_count.wr_rmm"] = 0x0804,
["unc_m_cas_count.wr_wmm"] = 0x0404,
["unc_m_dram_pre_all"] = 0x0006,
["unc_m_dram_refresh.high"] = 0x0405,
["unc_m_dram_refresh.panic"] = 0x0205,
["unc_m_ecc_correctable_errors"] = 0x0009,
["unc_m_major_modes.isoch"] = 0x0807,
["unc_m_major_modes.partial"] = 0x0407,
["unc_m_major_modes.read"] = 0x0107,
["unc_m_major_modes.write"] = 0x0207,
["unc_m_power_channel_dlloff"] = 0x0084,
["unc_m_power_channel_ppd"] = 0x0085,
["unc_m_power_cke_cycles.rank0"] = 0x0183,
["unc_m_power_cke_cycles.rank1"] = 0x0283,
["unc_m_power_cke_cycles.rank2"] = 0x0483,
["unc_m_power_cke_cycles.rank3"] = 0x0883,
["unc_m_power_cke_cycles.rank4"] = 0x1083,
["unc_m_power_cke_cycles.rank5"] = 0x2083,
["unc_m_power_cke_cycles.rank6"] = 0x4083,
["unc_m_power_cke_cycles.rank7"] = 0x8083,
["unc_m_power_critical_throttle_cycles"] = 0x0086,
["unc_m_power_self_refresh"] = 0x0043,
["unc_m_power_throttle_cycles.rank0"] = 0x0141,
["unc_m_power_throttle_cycles.rank1"] = 0x0241,
["unc_m_power_throttle_cycles.rank2"] = 0x0441,
["unc_m_power_throttle_cycles.rank3"] = 0x0841,
["unc_m_power_throttle_cycles.rank4"] = 0x1041,
["unc_m_power_throttle_cycles.rank5"] = 0x2041,
["unc_m_power_throttle_cycles.rank6"] = 0x4041,
["unc_m_power_throttle_cycles.rank7"] = 0x8041,
["unc_m_preemption.rd_preempt_rd"] = 0x0108,
["unc_m_preemption.rd_preempt_wr"] = 0x0208,
["unc_m_pre_count.page_close"] = 0x0202,
["unc_m_pre_count.page_miss"] = 0x0102,
["unc_m_rpq_cycles_full"] = 0x0012,
["unc_m_rpq_cycles_ne"] = 0x0011,
["unc_m_rpq_inserts"] = 0x0010,
["unc_m_rpq_occupancy"] = 0x0080,
["unc_m_wpq_cycles_full"] = 0x0022,
["unc_m_wpq_cycles_ne"] = 0x0021,
["unc_m_wpq_inserts"] = 0x0020,
["unc_m_wpq_occupancy"] = 0x0081,
["unc_m_wpq_read_hit"] = 0x0023,
["unc_m_wpq_write_hit"] = 0x0024,
["unc_u_clockticks"] = 0x0000,
["unc_m_clockticks"] = 0x0000,
["unc_i_address_match.stall_count"] = 0x0117,
["unc_i_address_match.merge_count"] = 0x0217,
["unc_i_cache_ack_pending_occupancy.any"] = 0x0114,
["unc_i_cache_ack_pending_occupancy.source"] = 0x0214,
["unc_i_cache_own_occupancy.any"] = 0x0113,
["unc_i_cache_own_occupancy.source"] = 0x0213,
["unc_i_cache_read_occupancy.any"] = 0x0110,
["unc_i_cache_read_occupancy.source"] = 0x0210,
["unc_i_cache_total_occupancy.any"] = 0x0112,
["unc_i_cache_total_occupancy.source"] = 0x0212,
["unc_i_cache_write_occupancy.any"] = 0x0111,
["unc_i_cache_write_occupancy.source"] = 0x0211,
["unc_i_clockticks"] = 0x0000,
["unc_i_rxr_ak_cycles_full"] = 0x000b,
["unc_i_rxr_ak_inserts"] = 0x000a,
["unc_i_rxr_ak_occupancy"] = 0x000c,
["unc_i_rxr_bl_drs_cycles_full"] = 0x0004,
["unc_i_rxr_bl_drs_inserts"] = 0x0001,
["unc_i_rxr_bl_drs_occupancy"] = 0x0007,
["unc_i_rxr_bl_ncb_cycles_full"] = 0x0005,
["unc_i_rxr_bl_ncb_inserts"] = 0x0002,
["unc_i_rxr_bl_ncb_occupancy"] = 0x0008,
["unc_i_rxr_bl_ncs_cycles_full"] = 0x0006,
["unc_i_rxr_bl_ncs_inserts"] = 0x0003,
["unc_i_rxr_bl_ncs_occupancy"] = 0x0009,
["unc_i_tickles.lost_ownership"] = 0x0116,
["unc_i_tickles.top_of_queue"] = 0x0216,
["unc_i_transactions.reads"] = 0x0115,
["unc_i_transactions.writes"] = 0x0215,
["unc_i_transactions.pd_prefetches"] = 0x0415,
["unc_i_transactions.orderingq"] = 0x0815,
["unc_i_txr_ad_stall_credit_cycles"] = 0x0018,
["unc_i_txr_bl_stall_credit_cycles"] = 0x0019,
["unc_i_txr_data_inserts_ncb"] = 0x000e,
["unc_i_txr_data_inserts_ncs"] = 0x000f,
["unc_i_txr_request_occupancy"] = 0x000d,
["unc_i_write_ordering_stall_cycles"] = 0x001a,
},
},
{"GenuineIntel-6-3A", "V15", "core",
{
-- source: IVB/IvyBridge_core_V15.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.large_page_walk_completed"] = 0x8808,
["int_misc.recovery_cycles"] = 0x030d,
["int_misc.recovery_stalls_count"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_comp_ops_exe.sse_packed_double"] = 0x1010,
["fp_comp_ops_exe.sse_scalar_single"] = 0x2010,
["fp_comp_ops_exe.sse_packed_single"] = 0x4010,
["fp_comp_ops_exe.sse_scalar_double"] = 0x8010,
["simd_fp_256.packed_single"] = 0x0111,
["simd_fp_256.packed_double"] = 0x0211,
["arith.fpu_div_active"] = 0x0114,
["arith.fpu_div"] = 0x0414,
["l2_rqsts.demand_data_rd_hit"] = 0x0124,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.code_rd_hit"] = 0x1024,
["l2_rqsts.code_rd_miss"] = 0x2024,
["l2_rqsts.pf_hit"] = 0x4024,
["l2_rqsts.pf_miss"] = 0x8024,
["l2_rqsts.all_demand_data_rd"] = 0x0324,
["l2_rqsts.all_rfo"] = 0x0c24,
["l2_rqsts.all_code_rd"] = 0x3024,
["l2_rqsts.all_pf"] = 0xc024,
["l2_store_lock_rqsts.miss"] = 0x0127,
["l2_store_lock_rqsts.hit_m"] = 0x0827,
["l2_store_lock_rqsts.all"] = 0x0f27,
["l2_l1d_wb_rqsts.miss"] = 0x0128,
["l2_l1d_wb_rqsts.hit_e"] = 0x0428,
["l2_l1d_wb_rqsts.hit_m"] = 0x0828,
["l2_l1d_wb_rqsts.all"] = 0x0f28,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x0449,
["dtlb_store_misses.stlb_hit"] = 0x1049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["rs_events.empty_cycles"] = 0x015e,
["dtlb_load_misses.stlb_hit"] = 0x045f,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_duration"] = 0x0485,
["itlb_misses.stlb_hit"] = 0x1085,
["itlb_misses.large_page_walk_completed"] = 0x8085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_4"] = 0x40a1,
["uops_dispatched_port.port_5"] = 0x80a1,
["uops_dispatched_port.port_0_core"] = 0x01a1,
["uops_dispatched_port.port_1_core"] = 0x02a1,
["uops_dispatched_port.port_4_core"] = 0x40a1,
["uops_dispatched_port.port_5_core"] = 0x80a1,
["uops_dispatched_port.port_2"] = 0x0ca1,
["uops_dispatched_port.port_3"] = 0x30a1,
["uops_dispatched_port.port_2_core"] = 0x0ca1,
["uops_dispatched_port.port_3_core"] = 0x30a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["lsd.cycles_active"] = 0x01a8,
["dsb2mite_switches.count"] = 0x01ab,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["dsb_fill.exceed_dsb_lines"] = 0x08ac,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["page_walks.llc_miss"] = 0x01be,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_store"] = 0x08c1,
["other_assists.avx_to_sse"] = 0x10c1,
["other_assists.sse_to_avx"] = 0x20c1,
["other_assists.any_wb_assist"] = 0x80c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.near_taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.precise_store"] = 0x02cd,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.llc_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.llc_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_llc_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_llc_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_llc_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_llc_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_llc_miss_retired.local_dram"] = 0x01d3,
["baclears.any"] = 0x1fe6,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.pf_clean"] = 0x04f2,
["l2_lines_out.pf_dirty"] = 0x08f2,
["l2_lines_out.dirty_all"] = 0x0af2,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["dtlb_load_misses.miss_causes_a_walk"] = 0x8108,
["dtlb_load_misses.walk_completed"] = 0x8208,
["dtlb_load_misses.walk_duration"] = 0x8408,
["rs_events.empty_end"] = 0x015e,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_4_uops"] = 0x01a8,
["mem_load_uops_llc_miss_retired.local_dram"] = 0x01d3,
["idq.ms_switches"] = 0x3079,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.cycles_mem_any"] = 0x02a3,
["cycle_activity.stalls_total"] = 0x04a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.stalls_mem_any"] = 0x06a3,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-3A", "V15", "offcore",
{
-- source: IVB/IvyBridge_matrix_V15.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-3A", "V15", "uncore",
{
-- source: IVB/IvyBridge_uncore_V15.tsv
["unc_cbo_xsnp_response.miss"] = 0x0122,
["unc_cbo_xsnp_response.inval"] = 0x0222,
["unc_cbo_xsnp_response.hit"] = 0x0422,
["unc_cbo_xsnp_response.hitm"] = 0x0822,
["unc_cbo_xsnp_response.inval_m"] = 0x1022,
["unc_cbo_xsnp_response.external_filter"] = 0x2022,
["unc_cbo_xsnp_response.xcore_filter"] = 0x4022,
["unc_cbo_xsnp_response.eviction_filter"] = 0x8022,
["unc_cbo_cache_lookup.m"] = 0x0134,
["unc_cbo_cache_lookup.e"] = 0x0234,
["unc_cbo_cache_lookup.s"] = 0x0434,
["unc_cbo_cache_lookup.i"] = 0x0834,
["unc_cbo_cache_lookup.read_filter"] = 0x1034,
["unc_cbo_cache_lookup.write_filter"] = 0x2034,
["unc_cbo_cache_lookup.extsnp_filter"] = 0x4034,
["unc_cbo_cache_lookup.any_request_filter"] = 0x8034,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_arb_trk_requests.evictions"] = 0x8081,
["unc_arb_coh_trk_occupancy.all"] = 0x0183,
["unc_arb_coh_trk_requests.all"] = 0x0184,
["unc_arb_trk_occupancy.cycles_with_any_request"] = 0x0180,
["unc_arb_trk_occupancy.cycles_over_half_full"] = 0x0180,
["unc_clock.socket"] = 0x0100,
["unc_cbo_cache_lookup.es"] = 0x0634,
},
},
{"GenuineIntel-6-3E", "V17", "core",
{
-- source: IVT/IvyTown_core_V17.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.demand_ld_walk_completed"] = 0x8208,
["dtlb_load_misses.demand_ld_walk_duration"] = 0x8408,
["dtlb_load_misses.large_page_walk_completed"] = 0x8808,
["int_misc.recovery_cycles"] = 0x030d,
["int_misc.recovery_stalls_count"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["fp_comp_ops_exe.x87"] = 0x0110,
["fp_comp_ops_exe.sse_packed_double"] = 0x1010,
["fp_comp_ops_exe.sse_scalar_single"] = 0x2010,
["fp_comp_ops_exe.sse_packed_single"] = 0x4010,
["fp_comp_ops_exe.sse_scalar_double"] = 0x8010,
["simd_fp_256.packed_single"] = 0x0111,
["simd_fp_256.packed_double"] = 0x0211,
["arith.fpu_div_active"] = 0x0114,
["arith.fpu_div"] = 0x0414,
["l2_rqsts.demand_data_rd_hit"] = 0x0124,
["l2_rqsts.rfo_hit"] = 0x0424,
["l2_rqsts.rfo_miss"] = 0x0824,
["l2_rqsts.code_rd_hit"] = 0x1024,
["l2_rqsts.code_rd_miss"] = 0x2024,
["l2_rqsts.pf_hit"] = 0x4024,
["l2_rqsts.pf_miss"] = 0x8024,
["l2_rqsts.all_demand_data_rd"] = 0x0324,
["l2_rqsts.all_rfo"] = 0x0c24,
["l2_rqsts.all_code_rd"] = 0x3024,
["l2_rqsts.all_pf"] = 0xc024,
["l2_store_lock_rqsts.miss"] = 0x0127,
["l2_store_lock_rqsts.hit_m"] = 0x0827,
["l2_store_lock_rqsts.all"] = 0x0f27,
["l2_l1d_wb_rqsts.miss"] = 0x0128,
["l2_l1d_wb_rqsts.hit_e"] = 0x0428,
["l2_l1d_wb_rqsts.hit_m"] = 0x0828,
["l2_l1d_wb_rqsts.all"] = 0x0f28,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x0449,
["dtlb_store_misses.stlb_hit"] = 0x1049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["rs_events.empty_cycles"] = 0x015e,
["dtlb_load_misses.stlb_hit"] = 0x045f,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.cycles_with_demand_rfo"] = 0x0460,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed"] = 0x0285,
["itlb_misses.walk_duration"] = 0x0485,
["itlb_misses.stlb_hit"] = 0x1085,
["itlb_misses.large_page_walk_completed"] = 0x8085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_4"] = 0x40a1,
["uops_dispatched_port.port_5"] = 0x80a1,
["uops_dispatched_port.port_0_core"] = 0x01a1,
["uops_dispatched_port.port_1_core"] = 0x02a1,
["uops_dispatched_port.port_4_core"] = 0x40a1,
["uops_dispatched_port.port_5_core"] = 0x80a1,
["uops_dispatched_port.port_2"] = 0x0ca1,
["uops_dispatched_port.port_3"] = 0x30a1,
["uops_dispatched_port.port_2_core"] = 0x0ca1,
["uops_dispatched_port.port_3_core"] = 0x30a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["lsd.cycles_active"] = 0x01a8,
["dsb2mite_switches.count"] = 0x01ab,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["dsb_fill.exceed_dsb_lines"] = 0x08ac,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_store"] = 0x08c1,
["other_assists.avx_to_sse"] = 0x10c1,
["other_assists.sse_to_avx"] = 0x20c1,
["other_assists.any_wb_assist"] = 0x80c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.near_taken"] = 0x20c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.precise_store"] = 0x02cd,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.llc_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.llc_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_llc_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_llc_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_llc_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_llc_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_llc_miss_retired.local_dram"] = 0x01d3,
["mem_load_uops_llc_miss_retired.remote_dram"] = 0x0cd3,
["mem_load_uops_llc_miss_retired.remote_hitm"] = 0x10d3,
["mem_load_uops_llc_miss_retired.remote_fwd"] = 0x20d3,
["baclears.any"] = 0x1fe6,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x01f2,
["l2_lines_out.demand_dirty"] = 0x02f2,
["l2_lines_out.pf_clean"] = 0x04f2,
["l2_lines_out.pf_dirty"] = 0x08f2,
["l2_lines_out.dirty_all"] = 0x0af2,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["dtlb_load_misses.miss_causes_a_walk"] = 0x8108,
["dtlb_load_misses.walk_completed"] = 0x8208,
["dtlb_load_misses.walk_duration"] = 0x8408,
["rs_events.empty_end"] = 0x015e,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_4_uops"] = 0x01a8,
["idq.ms_switches"] = 0x3079,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.cycles_mem_any"] = 0x02a3,
["cycle_activity.stalls_total"] = 0x04a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.stalls_mem_any"] = 0x06a3,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-3E", "V17", "offcore",
{
-- source: IVT/IvyTown_matrix_V17.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-3E", "V17", "uncore",
{
-- source: IVT/IvyTown_uncore_V17.tsv
["unc_c_clockticks"] = 0x0000,
["unc_c_counter0_occupancy"] = 0x001f,
["unc_c_llc_lookup.any"] = 0x1134,
["unc_c_llc_lookup.data_read"] = 0x0334,
["unc_c_llc_lookup.nid"] = 0x4134,
["unc_c_llc_lookup.remote_snoop"] = 0x0934,
["unc_c_llc_lookup.write"] = 0x0534,
["unc_c_llc_victims.e_state"] = 0x0237,
["unc_c_llc_victims.miss"] = 0x0837,
["unc_c_llc_victims.m_state"] = 0x0137,
["unc_c_llc_victims.nid"] = 0x4037,
["unc_c_llc_victims.s_state"] = 0x0437,
["unc_c_misc.rfo_hit_s"] = 0x0839,
["unc_c_misc.rspi_was_fse"] = 0x0139,
["unc_c_misc.started"] = 0x0439,
["unc_c_misc.wc_aliasing"] = 0x0239,
["unc_c_qlru.age0"] = 0x013c,
["unc_c_qlru.age1"] = 0x023c,
["unc_c_qlru.age2"] = 0x043c,
["unc_c_qlru.age3"] = 0x083c,
["unc_c_qlru.lru_decrement"] = 0x103c,
["unc_c_qlru.victim_non_zero"] = 0x203c,
["unc_c_ring_ad_used.down_vr0_even"] = 0x041b,
["unc_c_ring_ad_used.down_vr0_odd"] = 0x081b,
["unc_c_ring_ad_used.down_vr1_even"] = 0x401b,
["unc_c_ring_ad_used.down_vr1_odd"] = 0x801b,
["unc_c_ring_ad_used.up_vr0_even"] = 0x011b,
["unc_c_ring_ad_used.up_vr0_odd"] = 0x021b,
["unc_c_ring_ad_used.up_vr1_even"] = 0x101b,
["unc_c_ring_ad_used.up_vr1_odd"] = 0x201b,
["unc_c_ring_ak_used.down_vr0_even"] = 0x041c,
["unc_c_ring_ak_used.down_vr0_odd"] = 0x081c,
["unc_c_ring_ak_used.down_vr1_even"] = 0x401c,
["unc_c_ring_ak_used.down_vr1_odd"] = 0x801c,
["unc_c_ring_ak_used.up_vr0_even"] = 0x011c,
["unc_c_ring_ak_used.up_vr0_odd"] = 0x021c,
["unc_c_ring_ak_used.up_vr1_even"] = 0x101c,
["unc_c_ring_ak_used.up_vr1_odd"] = 0x201c,
["unc_c_ring_bl_used.down_vr0_even"] = 0x041d,
["unc_c_ring_bl_used.down_vr0_odd"] = 0x081d,
["unc_c_ring_bl_used.down_vr1_even"] = 0x401d,
["unc_c_ring_bl_used.down_vr1_odd"] = 0x801d,
["unc_c_ring_bl_used.up_vr0_even"] = 0x011d,
["unc_c_ring_bl_used.up_vr0_odd"] = 0x021d,
["unc_c_ring_bl_used.up_vr1_even"] = 0x101d,
["unc_c_ring_bl_used.up_vr1_odd"] = 0x201d,
["unc_c_ring_bounces.ak_core"] = 0x0205,
["unc_c_ring_bounces.bl_core"] = 0x0405,
["unc_c_ring_bounces.iv_core"] = 0x0805,
["unc_c_ring_iv_used.any"] = 0x0f1e,
["unc_c_ring_iv_used.down"] = 0xcc1e,
["unc_c_ring_iv_used.up"] = 0x331e,
["unc_c_ring_src_thrtl"] = 0x0007,
["unc_c_rxr_ext_starved.ipq"] = 0x0212,
["unc_c_rxr_ext_starved.irq"] = 0x0112,
["unc_c_rxr_ext_starved.prq"] = 0x0412,
["unc_c_rxr_ext_starved.ismq_bids"] = 0x0812,
["unc_c_rxr_inserts.ipq"] = 0x0413,
["unc_c_rxr_inserts.irq"] = 0x0113,
["unc_c_rxr_inserts.irq_rejected"] = 0x0213,
["unc_c_rxr_inserts.vfifo"] = 0x1013,
["unc_c_rxr_int_starved.ipq"] = 0x0414,
["unc_c_rxr_int_starved.irq"] = 0x0114,
["unc_c_rxr_int_starved.ismq"] = 0x0814,
["unc_c_rxr_ipq_retry.addr_conflict"] = 0x0431,
["unc_c_rxr_ipq_retry.any"] = 0x0131,
["unc_c_rxr_ipq_retry.full"] = 0x0231,
["unc_c_rxr_ipq_retry.qpi_credits"] = 0x1031,
["unc_c_rxr_irq_retry.addr_conflict"] = 0x0432,
["unc_c_rxr_irq_retry.any"] = 0x0132,
["unc_c_rxr_irq_retry.full"] = 0x0232,
["unc_c_rxr_irq_retry.iio_credits"] = 0x2032,
["unc_c_rxr_irq_retry.qpi_credits"] = 0x1032,
["unc_c_rxr_irq_retry.rtid"] = 0x0832,
["unc_c_rxr_ismq_retry.any"] = 0x0133,
["unc_c_rxr_ismq_retry.full"] = 0x0233,
["unc_c_rxr_ismq_retry.iio_credits"] = 0x2033,
["unc_c_rxr_ismq_retry.qpi_credits"] = 0x1033,
["unc_c_rxr_ismq_retry.rtid"] = 0x0833,
["unc_c_rxr_ismq_retry.wb_credits"] = 0x8033,
["unc_c_rxr_occupancy.ipq"] = 0x0411,
["unc_c_rxr_occupancy.irq"] = 0x0111,
["unc_c_rxr_occupancy.irq_rejected"] = 0x0211,
["unc_c_rxr_occupancy.vfifo"] = 0x1011,
["unc_c_tor_inserts.all"] = 0x0835,
["unc_c_tor_inserts.eviction"] = 0x0435,
["unc_c_tor_inserts.local"] = 0x2835,
["unc_c_tor_inserts.local_opcode"] = 0x2135,
["unc_c_tor_inserts.miss_local"] = 0x2a35,
["unc_c_tor_inserts.miss_local_opcode"] = 0x2335,
["unc_c_tor_inserts.miss_opcode"] = 0x0335,
["unc_c_tor_inserts.miss_remote"] = 0x8a35,
["unc_c_tor_inserts.miss_remote_opcode"] = 0x8335,
["unc_c_tor_inserts.nid_all"] = 0x4835,
["unc_c_tor_inserts.nid_eviction"] = 0x4435,
["unc_c_tor_inserts.nid_miss_all"] = 0x4a35,
["unc_c_tor_inserts.nid_miss_opcode"] = 0x4335,
["unc_c_tor_inserts.nid_opcode"] = 0x4135,
["unc_c_tor_inserts.nid_wb"] = 0x5035,
["unc_c_tor_inserts.opcode"] = 0x0135,
["unc_c_tor_inserts.remote"] = 0x8835,
["unc_c_tor_inserts.remote_opcode"] = 0x8135,
["unc_c_tor_inserts.wb"] = 0x1035,
["unc_c_tor_occupancy.all"] = 0x0836,
["unc_c_tor_occupancy.eviction"] = 0x0436,
["unc_c_tor_occupancy.local"] = 0x2836,
["unc_c_tor_occupancy.local_opcode"] = 0x2136,
["unc_c_tor_occupancy.miss_all"] = 0x0a36,
["unc_c_tor_occupancy.miss_local"] = 0x2a36,
["unc_c_tor_occupancy.miss_local_opcode"] = 0x2336,
["unc_c_tor_occupancy.miss_opcode"] = 0x0336,
["unc_c_tor_occupancy.miss_remote"] = 0x8a36,
["unc_c_tor_occupancy.miss_remote_opcode"] = 0x8336,
["unc_c_tor_occupancy.nid_all"] = 0x4836,
["unc_c_tor_occupancy.nid_eviction"] = 0x4436,
["unc_c_tor_occupancy.nid_miss_all"] = 0x4a36,
["unc_c_tor_occupancy.nid_miss_opcode"] = 0x4336,
["unc_c_tor_occupancy.nid_opcode"] = 0x4136,
["unc_c_tor_occupancy.nid_wb"] = 0x5036,
["unc_c_tor_occupancy.opcode"] = 0x0136,
["unc_c_tor_occupancy.remote"] = 0x8836,
["unc_c_tor_occupancy.remote_opcode"] = 0x8136,
["unc_c_tor_occupancy.wb"] = 0x1036,
["unc_c_txr_ads_used.ad"] = 0x0104,
["unc_c_txr_ads_used.ak"] = 0x0204,
["unc_c_txr_ads_used.bl"] = 0x0404,
["unc_c_txr_inserts.ad_cache"] = 0x0102,
["unc_c_txr_inserts.ad_core"] = 0x1002,
["unc_c_txr_inserts.ak_cache"] = 0x0202,
["unc_c_txr_inserts.ak_core"] = 0x2002,
["unc_c_txr_inserts.bl_cache"] = 0x0402,
["unc_c_txr_inserts.bl_core"] = 0x4002,
["unc_c_txr_inserts.iv_cache"] = 0x0802,
["unc_c_txr_starved.ad_core"] = 0x1003,
["unc_c_txr_starved.ak_both"] = 0x0203,
["unc_c_txr_starved.iv"] = 0x0803,
["unc_p_clockticks"] = 0x0000,
["unc_p_core0_transition_cycles"] = 0x0070,
["unc_p_core10_transition_cycles"] = 0x007a,
["unc_p_core11_transition_cycles"] = 0x007b,
["unc_p_core12_transition_cycles"] = 0x007c,
["unc_p_core13_transition_cycles"] = 0x007d,
["unc_p_core14_transition_cycles"] = 0x007e,
["unc_p_core1_transition_cycles"] = 0x0071,
["unc_p_core2_transition_cycles"] = 0x0072,
["unc_p_core3_transition_cycles"] = 0x0073,
["unc_p_core4_transition_cycles"] = 0x0074,
["unc_p_core5_transition_cycles"] = 0x0075,
["unc_p_core6_transition_cycles"] = 0x0076,
["unc_p_core7_transition_cycles"] = 0x0077,
["unc_p_core8_transition_cycles"] = 0x0078,
["unc_p_core9_transition_cycles"] = 0x0079,
["unc_p_delayed_c_state_abort_core0"] = 0x0017,
["unc_p_delayed_c_state_abort_core1"] = 0x0018,
["unc_p_delayed_c_state_abort_core10"] = 0x0021,
["unc_p_delayed_c_state_abort_core11"] = 0x0022,
["unc_p_delayed_c_state_abort_core12"] = 0x0023,
["unc_p_delayed_c_state_abort_core13"] = 0x0024,
["unc_p_delayed_c_state_abort_core14"] = 0x0025,
["unc_p_delayed_c_state_abort_core2"] = 0x0019,
["unc_p_delayed_c_state_abort_core3"] = 0x001a,
["unc_p_delayed_c_state_abort_core4"] = 0x001b,
["unc_p_delayed_c_state_abort_core5"] = 0x001c,
["unc_p_delayed_c_state_abort_core6"] = 0x001d,
["unc_p_delayed_c_state_abort_core7"] = 0x001e,
["unc_p_delayed_c_state_abort_core8"] = 0x001f,
["unc_p_delayed_c_state_abort_core9"] = 0x0020,
["unc_p_demotions_core0"] = 0x001e,
["unc_p_demotions_core1"] = 0x001f,
["unc_p_demotions_core2"] = 0x0020,
["unc_p_demotions_core3"] = 0x0021,
["unc_p_demotions_core4"] = 0x0022,
["unc_p_demotions_core5"] = 0x0023,
["unc_p_demotions_core6"] = 0x0024,
["unc_p_demotions_core7"] = 0x0025,
["unc_p_freq_band0_cycles"] = 0x000b,
["unc_p_freq_band1_cycles"] = 0x000c,
["unc_p_freq_band2_cycles"] = 0x000d,
["unc_p_freq_band3_cycles"] = 0x000e,
["unc_p_freq_max_current_cycles"] = 0x0007,
["unc_p_freq_max_limit_thermal_cycles"] = 0x0004,
["unc_p_freq_max_os_cycles"] = 0x0006,
["unc_p_freq_max_power_cycles"] = 0x0005,
["unc_p_freq_min_io_p_cycles"] = 0x0061,
["unc_p_freq_min_perf_p_cycles"] = 0x0062,
["unc_p_freq_trans_cycles"] = 0x0060,
["unc_p_memory_phase_shedding_cycles"] = 0x002f,
["unc_p_pkg_c_exit_latency_sel"] = 0x0026,
["unc_p_pkg_c_state_residency_c0_cycles"] = 0x002a,
["unc_p_pkg_c_state_residency_c2_cycles"] = 0x002b,
["unc_p_pkg_c_state_residency_c3_cycles"] = 0x002c,
["unc_p_pkg_c_state_residency_c6_cycles"] = 0x002d,
["unc_p_power_state_occupancy.cores_c0"] = 0x4080,
["unc_p_power_state_occupancy.cores_c3"] = 0x8080,
["unc_p_power_state_occupancy.cores_c6"] = 0xc080,
["unc_p_prochot_external_cycles"] = 0x000a,
["unc_p_prochot_internal_cycles"] = 0x0009,
["unc_p_total_transition_cycles"] = 0x0063,
["unc_p_volt_trans_cycles_change"] = 0x0003,
["unc_p_volt_trans_cycles_decrease"] = 0x0002,
["unc_p_volt_trans_cycles_increase"] = 0x0001,
["unc_p_vr_hot_cycles"] = 0x0032,
["unc_u_event_msg.doorbell_rcvd"] = 0x0842,
["unc_u_event_msg.int_prio"] = 0x1042,
["unc_u_event_msg.ipi_rcvd"] = 0x0442,
["unc_u_event_msg.msi_rcvd"] = 0x0242,
["unc_u_event_msg.vlw_rcvd"] = 0x0142,
["unc_u_filter_match.disable"] = 0x0241,
["unc_u_filter_match.enable"] = 0x0141,
["unc_u_filter_match.u2c_disable"] = 0x0841,
["unc_u_filter_match.u2c_enable"] = 0x0441,
["unc_u_lock_cycles"] = 0x0044,
["unc_u_phold_cycles.assert_to_ack"] = 0x0145,
["unc_u_u2c_events.cmc"] = 0x1043,
["unc_u_u2c_events.livelock"] = 0x0443,
["unc_u_u2c_events.lterror"] = 0x0843,
["unc_u_u2c_events.monitor_t0"] = 0x0143,
["unc_u_u2c_events.monitor_t1"] = 0x0243,
["unc_u_u2c_events.other"] = 0x8043,
["unc_u_u2c_events.trap"] = 0x4043,
["unc_u_u2c_events.umc"] = 0x2043,
["unc_i_address_match.merge_count"] = 0x0217,
["unc_i_address_match.stall_count"] = 0x0117,
["unc_i_cache_ack_pending_occupancy.any"] = 0x0114,
["unc_i_cache_ack_pending_occupancy.source"] = 0x0214,
["unc_i_cache_own_occupancy.any"] = 0x0113,
["unc_i_cache_own_occupancy.source"] = 0x0213,
["unc_i_cache_read_occupancy.any"] = 0x0110,
["unc_i_cache_read_occupancy.source"] = 0x0210,
["unc_i_cache_total_occupancy.any"] = 0x0112,
["unc_i_cache_total_occupancy.source"] = 0x0212,
["unc_i_cache_write_occupancy.any"] = 0x0111,
["unc_i_cache_write_occupancy.source"] = 0x0211,
["unc_i_clockticks"] = 0x0000,
["unc_i_rxr_ak_cycles_full"] = 0x000b,
["unc_i_rxr_ak_inserts"] = 0x000a,
["unc_i_rxr_ak_occupancy"] = 0x000c,
["unc_i_rxr_bl_drs_cycles_full"] = 0x0004,
["unc_i_rxr_bl_drs_inserts"] = 0x0001,
["unc_i_rxr_bl_drs_occupancy"] = 0x0007,
["unc_i_rxr_bl_ncb_cycles_full"] = 0x0005,
["unc_i_rxr_bl_ncb_inserts"] = 0x0002,
["unc_i_rxr_bl_ncb_occupancy"] = 0x0008,
["unc_i_rxr_bl_ncs_cycles_full"] = 0x0006,
["unc_i_rxr_bl_ncs_inserts"] = 0x0003,
["unc_i_rxr_bl_ncs_occupancy"] = 0x0009,
["unc_i_tickles.lost_ownership"] = 0x0116,
["unc_i_tickles.top_of_queue"] = 0x0216,
["unc_i_transactions.orderingq"] = 0x0815,
["unc_i_transactions.pd_prefetches"] = 0x0415,
["unc_i_transactions.reads"] = 0x0115,
["unc_i_transactions.writes"] = 0x0215,
["unc_i_txr_ad_stall_credit_cycles"] = 0x0018,
["unc_i_txr_bl_stall_credit_cycles"] = 0x0019,
["unc_i_txr_data_inserts_ncb"] = 0x000e,
["unc_i_txr_data_inserts_ncs"] = 0x000f,
["unc_i_txr_request_occupancy"] = 0x000d,
["unc_i_write_ordering_stall_cycles"] = 0x001a,
["unc_q_clockticks"] = 0x0014,
["unc_q_cto_count"] = 0x0038,
["unc_q_direct2core.failure_credits"] = 0x0213,
["unc_q_direct2core.failure_credits_miss"] = 0x2013,
["unc_q_direct2core.failure_credits_rbt"] = 0x0813,
["unc_q_direct2core.failure_credits_rbt_miss"] = 0x8013,
["unc_q_direct2core.failure_miss"] = 0x1013,
["unc_q_direct2core.failure_rbt_hit"] = 0x0413,
["unc_q_direct2core.failure_rbt_miss"] = 0x4013,
["unc_q_direct2core.success_rbt_hit"] = 0x0113,
["unc_q_l1_power_cycles"] = 0x0012,
["unc_q_rxl0p_power_cycles"] = 0x0010,
["unc_q_rxl0_power_cycles"] = 0x000f,
["unc_q_rxl_bypassed"] = 0x0009,
["unc_q_rxl_crc_errors.link_init"] = 0x0103,
["unc_q_rxl_crc_errors.normal_op"] = 0x0203,
["unc_q_rxl_credits_consumed_vn0.drs"] = 0x011e,
["unc_q_rxl_credits_consumed_vn0.hom"] = 0x081e,
["unc_q_rxl_credits_consumed_vn0.ncb"] = 0x021e,
["unc_q_rxl_credits_consumed_vn0.ncs"] = 0x041e,
["unc_q_rxl_credits_consumed_vn0.ndr"] = 0x201e,
["unc_q_rxl_credits_consumed_vn0.snp"] = 0x101e,
["unc_q_rxl_credits_consumed_vn1.drs"] = 0x0139,
["unc_q_rxl_credits_consumed_vn1.hom"] = 0x0839,
["unc_q_rxl_credits_consumed_vn1.ncb"] = 0x0239,
["unc_q_rxl_credits_consumed_vn1.ncs"] = 0x0439,
["unc_q_rxl_credits_consumed_vn1.ndr"] = 0x2039,
["unc_q_rxl_credits_consumed_vn1.snp"] = 0x1039,
["unc_q_rxl_credits_consumed_vna"] = 0x001d,
["unc_q_rxl_cycles_ne"] = 0x000a,
["unc_q_rxl_flits_g0.data"] = 0x0201,
["unc_q_rxl_flits_g0.idle"] = 0x0101,
["unc_q_rxl_flits_g0.non_data"] = 0x0401,
["unc_q_rxl_flits_g1.drs"] = 0x1802,
["unc_q_rxl_flits_g1.drs_data"] = 0x0802,
["unc_q_rxl_flits_g1.drs_nondata"] = 0x1002,
["unc_q_rxl_flits_g1.hom"] = 0x0602,
["unc_q_rxl_flits_g1.hom_nonreq"] = 0x0402,
["unc_q_rxl_flits_g1.hom_req"] = 0x0202,
["unc_q_rxl_flits_g1.snp"] = 0x0102,
["unc_q_rxl_flits_g2.ncb"] = 0x0c03,
["unc_q_rxl_flits_g2.ncb_data"] = 0x0403,
["unc_q_rxl_flits_g2.ncb_nondata"] = 0x0803,
["unc_q_rxl_flits_g2.ncs"] = 0x1003,
["unc_q_rxl_flits_g2.ndr_ad"] = 0x0103,
["unc_q_rxl_flits_g2.ndr_ak"] = 0x0203,
["unc_q_rxl_inserts"] = 0x0008,
["unc_q_rxl_inserts_drs"] = 0x0009,
["unc_q_rxl_inserts_hom"] = 0x000c,
["unc_q_rxl_inserts_ncb"] = 0x000a,
["unc_q_rxl_inserts_ncs"] = 0x000b,
["unc_q_rxl_inserts_ndr"] = 0x000e,
["unc_q_rxl_inserts_snp"] = 0x000d,
["unc_q_rxl_occupancy"] = 0x000b,
["unc_q_rxl_occupancy_drs"] = 0x0015,
["unc_q_rxl_occupancy_hom"] = 0x0018,
["unc_q_rxl_occupancy_ncb"] = 0x0016,
["unc_q_rxl_occupancy_ncs"] = 0x0017,
["unc_q_rxl_occupancy_ndr"] = 0x001a,
["unc_q_rxl_occupancy_snp"] = 0x0019,
["unc_q_rxl_stalls_vn0.bgf_drs"] = 0x0135,
["unc_q_rxl_stalls_vn0.bgf_hom"] = 0x0835,
["unc_q_rxl_stalls_vn0.bgf_ncb"] = 0x0235,
["unc_q_rxl_stalls_vn0.bgf_ncs"] = 0x0435,
["unc_q_rxl_stalls_vn0.bgf_ndr"] = 0x2035,
["unc_q_rxl_stalls_vn0.bgf_snp"] = 0x1035,
["unc_q_rxl_stalls_vn0.egress_credits"] = 0x4035,
["unc_q_rxl_stalls_vn0.gv"] = 0x8035,
["unc_q_rxl_stalls_vn1.bgf_drs"] = 0x013a,
["unc_q_rxl_stalls_vn1.bgf_hom"] = 0x083a,
["unc_q_rxl_stalls_vn1.bgf_ncb"] = 0x023a,
["unc_q_rxl_stalls_vn1.bgf_ncs"] = 0x043a,
["unc_q_rxl_stalls_vn1.bgf_ndr"] = 0x203a,
["unc_q_rxl_stalls_vn1.bgf_snp"] = 0x103a,
["unc_q_txl0p_power_cycles"] = 0x000d,
["unc_q_txl0_power_cycles"] = 0x000c,
["unc_q_txl_bypassed"] = 0x0005,
["unc_q_txl_crc_no_credits.almost_full"] = 0x0202,
["unc_q_txl_crc_no_credits.full"] = 0x0102,
["unc_q_txl_cycles_ne"] = 0x0006,
["unc_q_txl_flits_g0.data"] = 0x0200,
["unc_q_txl_flits_g0.non_data"] = 0x0400,
["unc_q_txl_flits_g1.drs"] = 0x1800,
["unc_q_txl_flits_g1.drs_data"] = 0x0800,
["unc_q_txl_flits_g1.drs_nondata"] = 0x1000,
["unc_q_txl_flits_g1.hom"] = 0x0600,
["unc_q_txl_flits_g1.hom_nonreq"] = 0x0400,
["unc_q_txl_flits_g1.hom_req"] = 0x0200,
["unc_q_txl_flits_g1.snp"] = 0x0100,
["unc_q_txl_flits_g2.ncb"] = 0x0c01,
["unc_q_txl_flits_g2.ncb_data"] = 0x0401,
["unc_q_txl_flits_g2.ncb_nondata"] = 0x0801,
["unc_q_txl_flits_g2.ncs"] = 0x1001,
["unc_q_txl_flits_g2.ndr_ad"] = 0x0101,
["unc_q_txl_flits_g2.ndr_ak"] = 0x0201,
["unc_q_txl_inserts"] = 0x0004,
["unc_q_txl_occupancy"] = 0x0007,
["unc_q_txr_ad_hom_credit_acquired.vn0"] = 0x0126,
["unc_q_txr_ad_hom_credit_acquired.vn1"] = 0x0226,
["unc_q_txr_ad_hom_credit_occupancy.vn0"] = 0x0122,
["unc_q_txr_ad_hom_credit_occupancy.vn1"] = 0x0222,
["unc_q_txr_ad_ndr_credit_acquired.vn0"] = 0x0128,
["unc_q_txr_ad_ndr_credit_acquired.vn1"] = 0x0228,
["unc_q_txr_ad_ndr_credit_occupancy.vn0"] = 0x0124,
["unc_q_txr_ad_ndr_credit_occupancy.vn1"] = 0x0224,
["unc_q_txr_ad_snp_credit_acquired.vn0"] = 0x0127,
["unc_q_txr_ad_snp_credit_acquired.vn1"] = 0x0227,
["unc_q_txr_ad_snp_credit_occupancy.vn0"] = 0x0123,
["unc_q_txr_ad_snp_credit_occupancy.vn1"] = 0x0223,
["unc_q_txr_ak_ndr_credit_acquired.vn0"] = 0x0129,
["unc_q_txr_ak_ndr_credit_acquired.vn1"] = 0x0229,
["unc_q_txr_ak_ndr_credit_occupancy.vn0"] = 0x0125,
["unc_q_txr_ak_ndr_credit_occupancy.vn1"] = 0x0225,
["unc_q_txr_bl_drs_credit_acquired.vn0"] = 0x012a,
["unc_q_txr_bl_drs_credit_acquired.vn1"] = 0x022a,
["unc_q_txr_bl_drs_credit_acquired.vn_shr"] = 0x042a,
["unc_q_txr_bl_drs_credit_occupancy.vn0"] = 0x011f,
["unc_q_txr_bl_drs_credit_occupancy.vn1"] = 0x021f,
["unc_q_txr_bl_drs_credit_occupancy.vn_shr"] = 0x041f,
["unc_q_txr_bl_ncb_credit_acquired.vn0"] = 0x012b,
["unc_q_txr_bl_ncb_credit_acquired.vn1"] = 0x022b,
["unc_q_txr_bl_ncb_credit_occupancy.vn0"] = 0x0120,
["unc_q_txr_bl_ncb_credit_occupancy.vn1"] = 0x0220,
["unc_q_txr_bl_ncs_credit_acquired.vn0"] = 0x012c,
["unc_q_txr_bl_ncs_credit_acquired.vn1"] = 0x022c,
["unc_q_txr_bl_ncs_credit_occupancy.vn0"] = 0x0121,
["unc_q_txr_bl_ncs_credit_occupancy.vn1"] = 0x0221,
["unc_q_vna_credit_returns"] = 0x001c,
["unc_q_vna_credit_return_occupancy"] = 0x001b,
["unc_r3_clockticks"] = 0x0001,
["unc_r3_c_hi_ad_credits_empty.cbo10"] = 0x042c,
["unc_r3_c_hi_ad_credits_empty.cbo11"] = 0x082c,
["unc_r3_c_hi_ad_credits_empty.cbo12"] = 0x102c,
["unc_r3_c_hi_ad_credits_empty.cbo13"] = 0x202c,
["unc_r3_c_hi_ad_credits_empty.cbo14"] = 0x402c,
["unc_r3_c_hi_ad_credits_empty.cbo8"] = 0x012c,
["unc_r3_c_hi_ad_credits_empty.cbo9"] = 0x022c,
["unc_r3_c_lo_ad_credits_empty.cbo0"] = 0x012b,
["unc_r3_c_lo_ad_credits_empty.cbo1"] = 0x022b,
["unc_r3_c_lo_ad_credits_empty.cbo2"] = 0x042b,
["unc_r3_c_lo_ad_credits_empty.cbo3"] = 0x082b,
["unc_r3_c_lo_ad_credits_empty.cbo4"] = 0x102b,
["unc_r3_c_lo_ad_credits_empty.cbo5"] = 0x202b,
["unc_r3_c_lo_ad_credits_empty.cbo6"] = 0x402b,
["unc_r3_c_lo_ad_credits_empty.cbo7"] = 0x802b,
["unc_r3_ha_r2_bl_credits_empty.ha0"] = 0x012f,
["unc_r3_ha_r2_bl_credits_empty.ha1"] = 0x022f,
["unc_r3_ha_r2_bl_credits_empty.r2_ncb"] = 0x042f,
["unc_r3_ha_r2_bl_credits_empty.r2_ncs"] = 0x082f,
["unc_r3_qpi0_ad_credits_empty.vn0_hom"] = 0x0229,
["unc_r3_qpi0_ad_credits_empty.vn0_ndr"] = 0x0829,
["unc_r3_qpi0_ad_credits_empty.vn0_snp"] = 0x0429,
["unc_r3_qpi0_ad_credits_empty.vn1_hom"] = 0x1029,
["unc_r3_qpi0_ad_credits_empty.vn1_ndr"] = 0x4029,
["unc_r3_qpi0_ad_credits_empty.vn1_snp"] = 0x2029,
["unc_r3_qpi0_ad_credits_empty.vna"] = 0x0129,
["unc_r3_qpi0_bl_credits_empty.vn0_hom"] = 0x022d,
["unc_r3_qpi0_bl_credits_empty.vn0_ndr"] = 0x082d,
["unc_r3_qpi0_bl_credits_empty.vn0_snp"] = 0x042d,
["unc_r3_qpi0_bl_credits_empty.vn1_hom"] = 0x102d,
["unc_r3_qpi0_bl_credits_empty.vn1_ndr"] = 0x402d,
["unc_r3_qpi0_bl_credits_empty.vn1_snp"] = 0x202d,
["unc_r3_qpi0_bl_credits_empty.vna"] = 0x012d,
["unc_r3_qpi1_ad_credits_empty.vn0_hom"] = 0x022a,
["unc_r3_qpi1_ad_credits_empty.vn0_ndr"] = 0x082a,
["unc_r3_qpi1_ad_credits_empty.vn0_snp"] = 0x042a,
["unc_r3_qpi1_ad_credits_empty.vn1_hom"] = 0x102a,
["unc_r3_qpi1_ad_credits_empty.vn1_ndr"] = 0x402a,
["unc_r3_qpi1_ad_credits_empty.vn1_snp"] = 0x202a,
["unc_r3_qpi1_ad_credits_empty.vna"] = 0x012a,
["unc_r3_qpi1_bl_credits_empty.vn0_hom"] = 0x022e,
["unc_r3_qpi1_bl_credits_empty.vn0_ndr"] = 0x082e,
["unc_r3_qpi1_bl_credits_empty.vn0_snp"] = 0x042e,
["unc_r3_qpi1_bl_credits_empty.vn1_hom"] = 0x102e,
["unc_r3_qpi1_bl_credits_empty.vn1_ndr"] = 0x402e,
["unc_r3_qpi1_bl_credits_empty.vn1_snp"] = 0x202e,
["unc_r3_qpi1_bl_credits_empty.vna"] = 0x012e,
["unc_r3_ring_ad_used.ccw_vr0_even"] = 0x0407,
["unc_r3_ring_ad_used.ccw_vr0_odd"] = 0x0807,
["unc_r3_ring_ad_used.cw_vr0_even"] = 0x0107,
["unc_r3_ring_ad_used.cw_vr0_odd"] = 0x0207,
["unc_r3_ring_ak_used.ccw_vr0_even"] = 0x0408,
["unc_r3_ring_ak_used.ccw_vr0_odd"] = 0x0808,
["unc_r3_ring_ak_used.cw_vr0_even"] = 0x0108,
["unc_r3_ring_ak_used.cw_vr0_odd"] = 0x0208,
["unc_r3_ring_bl_used.ccw_vr0_even"] = 0x0409,
["unc_r3_ring_bl_used.ccw_vr0_odd"] = 0x0809,
["unc_r3_ring_bl_used.cw_vr0_even"] = 0x0109,
["unc_r3_ring_bl_used.cw_vr0_odd"] = 0x0209,
["unc_r3_ring_iv_used.ccw"] = 0xcc0a,
["unc_r3_ring_iv_used.cw"] = 0x330a,
["unc_r3_rxr_bypassed.ad"] = 0x0112,
["unc_r3_rxr_cycles_ne.hom"] = 0x0110,
["unc_r3_rxr_cycles_ne.ndr"] = 0x0410,
["unc_r3_rxr_cycles_ne.snp"] = 0x0210,
["unc_r3_rxr_inserts.drs"] = 0x0811,
["unc_r3_rxr_inserts.hom"] = 0x0111,
["unc_r3_rxr_inserts.ncb"] = 0x1011,
["unc_r3_rxr_inserts.ncs"] = 0x2011,
["unc_r3_rxr_inserts.ndr"] = 0x0411,
["unc_r3_rxr_inserts.snp"] = 0x0211,
["unc_r3_rxr_occupancy.drs"] = 0x0813,
["unc_r3_rxr_occupancy.hom"] = 0x0113,
["unc_r3_rxr_occupancy.ncb"] = 0x1013,
["unc_r3_rxr_occupancy.ncs"] = 0x2013,
["unc_r3_rxr_occupancy.ndr"] = 0x0413,
["unc_r3_rxr_occupancy.snp"] = 0x0213,
["unc_r3_txr_nack_ccw.ad"] = 0x0128,
["unc_r3_txr_nack_ccw.ak"] = 0x0228,
["unc_r3_txr_nack_ccw.bl"] = 0x0428,
["unc_r3_txr_nack_cw.ad"] = 0x0126,
["unc_r3_txr_nack_cw.ak"] = 0x0226,
["unc_r3_txr_nack_cw.bl"] = 0x0426,
["unc_r3_vn0_credits_reject.drs"] = 0x0837,
["unc_r3_vn0_credits_reject.hom"] = 0x0137,
["unc_r3_vn0_credits_reject.ncb"] = 0x1037,
["unc_r3_vn0_credits_reject.ncs"] = 0x2037,
["unc_r3_vn0_credits_reject.ndr"] = 0x0437,
["unc_r3_vn0_credits_reject.snp"] = 0x0237,
["unc_r3_vn0_credits_used.drs"] = 0x0836,
["unc_r3_vn0_credits_used.hom"] = 0x0136,
["unc_r3_vn0_credits_used.ncb"] = 0x1036,
["unc_r3_vn0_credits_used.ncs"] = 0x2036,
["unc_r3_vn0_credits_used.ndr"] = 0x0436,
["unc_r3_vn0_credits_used.snp"] = 0x0236,
["unc_r3_vn1_credits_reject.drs"] = 0x0839,
["unc_r3_vn1_credits_reject.hom"] = 0x0139,
["unc_r3_vn1_credits_reject.ncb"] = 0x1039,
["unc_r3_vn1_credits_reject.ncs"] = 0x2039,
["unc_r3_vn1_credits_reject.ndr"] = 0x0439,
["unc_r3_vn1_credits_reject.snp"] = 0x0239,
["unc_r3_vn1_credits_used.drs"] = 0x0838,
["unc_r3_vn1_credits_used.hom"] = 0x0138,
["unc_r3_vn1_credits_used.ncb"] = 0x1038,
["unc_r3_vn1_credits_used.ncs"] = 0x2038,
["unc_r3_vn1_credits_used.ndr"] = 0x0438,
["unc_r3_vn1_credits_used.snp"] = 0x0238,
["unc_r3_vna_credits_acquired"] = 0x0033,
["unc_r3_vna_credits_reject.drs"] = 0x0834,
["unc_r3_vna_credits_reject.hom"] = 0x0134,
["unc_r3_vna_credits_reject.ncb"] = 0x1034,
["unc_r3_vna_credits_reject.ncs"] = 0x2034,
["unc_r3_vna_credits_reject.ndr"] = 0x0434,
["unc_r3_vna_credits_reject.snp"] = 0x0234,
["unc_r3_vna_credit_cycles_out"] = 0x0031,
["unc_r3_vna_credit_cycles_used"] = 0x0032,
["unc_r2_clockticks"] = 0x0001,
["unc_r2_iio_credits_acquired.drs"] = 0x0833,
["unc_r2_iio_credits_acquired.ncb"] = 0x1033,
["unc_r2_iio_credits_acquired.ncs"] = 0x2033,
["unc_r2_iio_credits_reject.drs"] = 0x0834,
["unc_r2_iio_credits_used.drs"] = 0x0832,
["unc_r2_iio_credits_used.ncb"] = 0x1032,
["unc_r2_iio_credits_used.ncs"] = 0x2032,
["unc_r2_ring_ad_used.ccw_vr0_even"] = 0x0407,
["unc_r2_ring_ad_used.ccw_vr0_odd"] = 0x0807,
["unc_r2_ring_ad_used.ccw_vr1_even"] = 0x4007,
["unc_r2_ring_ad_used.ccw_vr1_odd"] = 0x8007,
["unc_r2_ring_ad_used.cw_vr0_even"] = 0x0107,
["unc_r2_ring_ad_used.cw_vr0_odd"] = 0x0207,
["unc_r2_ring_ad_used.cw_vr1_even"] = 0x1007,
["unc_r2_ring_ad_used.cw_vr1_odd"] = 0x2007,
["unc_r2_ring_ak_used.ccw_vr0_even"] = 0x0408,
["unc_r2_ring_ak_used.ccw_vr0_odd"] = 0x0808,
["unc_r2_ring_ak_used.ccw_vr1_even"] = 0x4008,
["unc_r2_ring_ak_used.ccw_vr1_odd"] = 0x8008,
["unc_r2_ring_ak_used.cw_vr0_even"] = 0x0108,
["unc_r2_ring_ak_used.cw_vr0_odd"] = 0x0208,
["unc_r2_ring_ak_used.cw_vr1_even"] = 0x1008,
["unc_r2_ring_ak_used.cw_vr1_odd"] = 0x2008,
["unc_r2_ring_bl_used.ccw_vr0_even"] = 0x0409,
["unc_r2_ring_bl_used.ccw_vr0_odd"] = 0x0809,
["unc_r2_ring_bl_used.ccw_vr1_even"] = 0x4009,
["unc_r2_ring_bl_used.ccw_vr1_odd"] = 0x8009,
["unc_r2_ring_bl_used.cw_vr0_even"] = 0x0109,
["unc_r2_ring_bl_used.cw_vr0_odd"] = 0x0209,
["unc_r2_ring_bl_used.cw_vr1_even"] = 0x1009,
["unc_r2_ring_bl_used.cw_vr1_odd"] = 0x2009,
["unc_r2_ring_iv_used.ccw"] = 0xcc0a,
["unc_r2_ring_iv_used.cw"] = 0x330a,
["unc_r2_rxr_ak_bounces"] = 0x0012,
["unc_r2_rxr_cycles_ne.ncb"] = 0x1010,
["unc_r2_rxr_cycles_ne.ncs"] = 0x2010,
["unc_r2_rxr_inserts.ncb"] = 0x1011,
["unc_r2_rxr_inserts.ncs"] = 0x2011,
["unc_r2_rxr_occupancy.drs"] = 0x0813,
["unc_r2_txr_cycles_full.ad"] = 0x0125,
["unc_r2_txr_cycles_full.ak"] = 0x0225,
["unc_r2_txr_cycles_full.bl"] = 0x0425,
["unc_r2_txr_cycles_ne.ad"] = 0x0123,
["unc_r2_txr_cycles_ne.ak"] = 0x0223,
["unc_r2_txr_cycles_ne.bl"] = 0x0423,
["unc_h_addr_opc_match.filt"] = 0x0320,
["unc_h_bt_bypass"] = 0x0052,
["unc_h_bt_cycles_ne.local"] = 0x0142,
["unc_h_bt_cycles_ne.remote"] = 0x0242,
["unc_h_bt_occupancy.local"] = 0x0143,
["unc_h_bt_occupancy.reads_local"] = 0x0443,
["unc_h_bt_occupancy.reads_remote"] = 0x0843,
["unc_h_bt_occupancy.remote"] = 0x0243,
["unc_h_bt_occupancy.writes_local"] = 0x1043,
["unc_h_bt_occupancy.writes_remote"] = 0x2043,
["unc_h_bt_to_ht_not_issued.incoming_bl_hazard"] = 0x0451,
["unc_h_bt_to_ht_not_issued.incoming_snp_hazard"] = 0x0251,
["unc_h_bypass_imc.not_taken"] = 0x0214,
["unc_h_bypass_imc.taken"] = 0x0114,
["unc_h_clockticks"] = 0x0000,
["unc_h_conflict_cycles.ackcnflts"] = 0x080b,
["unc_h_conflict_cycles.cmp_fwds"] = 0x100b,
["unc_h_conflict_cycles.conflict"] = 0x020b,
["unc_h_conflict_cycles.last"] = 0x040b,
["unc_h_direct2core_count"] = 0x0011,
["unc_h_direct2core_cycles_disabled"] = 0x0012,
["unc_h_direct2core_txn_override"] = 0x0013,
["unc_h_directory_lat_opt"] = 0x0041,
["unc_h_directory_lookup.any"] = 0x100c,
["unc_h_directory_lookup.no_snp"] = 0x020c,
["unc_h_directory_lookup.snoop_a"] = 0x080c,
["unc_h_directory_lookup.snoop_s"] = 0x020c,
["unc_h_directory_lookup.snp"] = 0x010c,
["unc_h_directory_lookup.state_a"] = 0x800c,
["unc_h_directory_lookup.state_i"] = 0x200c,
["unc_h_directory_lookup.state_s"] = 0x400c,
["unc_h_directory_update.a2i"] = 0x200d,
["unc_h_directory_update.a2s"] = 0x400d,
["unc_h_directory_update.any"] = 0x030d,
["unc_h_directory_update.i2a"] = 0x040d,
["unc_h_directory_update.i2s"] = 0x020d,
["unc_h_directory_update.s2a"] = 0x100d,
["unc_h_directory_update.s2i"] = 0x080d,
["unc_h_igr_ad_qpi2_accumulator"] = 0x0059,
["unc_h_igr_bl_qpi2_accumulator"] = 0x005a,
["unc_h_igr_no_credit_cycles.ad_qpi0"] = 0x0122,
["unc_h_igr_no_credit_cycles.ad_qpi1"] = 0x0222,
["unc_h_igr_no_credit_cycles.bl_qpi0"] = 0x0422,
["unc_h_igr_no_credit_cycles.bl_qpi1"] = 0x0822,
["unc_h_imc_reads.normal"] = 0x0117,
["unc_h_imc_retry"] = 0x001e,
["unc_h_imc_writes.all"] = 0x0f1a,
["unc_h_imc_writes.full"] = 0x011a,
["unc_h_imc_writes.full_isoch"] = 0x041a,
["unc_h_imc_writes.partial"] = 0x021a,
["unc_h_imc_writes.partial_isoch"] = 0x081a,
["unc_h_iodc_conflicts.remote_invi2e_same_rtid"] = 0x0157,
["unc_h_iodc_conflicts.remote_other_same_addr"] = 0x0457,
["unc_h_iodc_inserts"] = 0x0056,
["unc_h_iodc_olen_wbmtoi"] = 0x0058,
["unc_h_osb.invitoe_local"] = 0x0453,
["unc_h_osb.reads_local"] = 0x0253,
["unc_h_osb.remote"] = 0x0853,
["unc_h_osb_edr.all"] = 0x0154,
["unc_h_osb_edr.reads_local_i"] = 0x0254,
["unc_h_osb_edr.reads_local_s"] = 0x0854,
["unc_h_osb_edr.reads_remote_i"] = 0x0454,
["unc_h_osb_edr.reads_remote_s"] = 0x1054,
["unc_h_requests.invitoe_local"] = 0x1001,
["unc_h_requests.invitoe_remote"] = 0x2001,
["unc_h_requests.reads"] = 0x0301,
["unc_h_requests.reads_local"] = 0x0101,
["unc_h_requests.reads_remote"] = 0x0201,
["unc_h_requests.writes"] = 0x0c01,
["unc_h_requests.writes_local"] = 0x0401,
["unc_h_requests.writes_remote"] = 0x0801,
["unc_h_ring_ad_used.ccw_vr0_even"] = 0x043e,
["unc_h_ring_ad_used.ccw_vr0_odd"] = 0x083e,
["unc_h_ring_ad_used.ccw_vr1_even"] = 0x403e,
["unc_h_ring_ad_used.ccw_vr1_odd"] = 0x803e,
["unc_h_ring_ad_used.cw_vr0_even"] = 0x013e,
["unc_h_ring_ad_used.cw_vr0_odd"] = 0x023e,
["unc_h_ring_ad_used.cw_vr1_even"] = 0x103e,
["unc_h_ring_ad_used.cw_vr1_odd"] = 0x203e,
["unc_h_ring_ak_used.ccw_vr0_even"] = 0x043f,
["unc_h_ring_ak_used.ccw_vr0_odd"] = 0x083f,
["unc_h_ring_ak_used.ccw_vr1_even"] = 0x403f,
["unc_h_ring_ak_used.ccw_vr1_odd"] = 0x803f,
["unc_h_ring_ak_used.cw_vr0_even"] = 0x013f,
["unc_h_ring_ak_used.cw_vr0_odd"] = 0x023f,
["unc_h_ring_ak_used.cw_vr1_even"] = 0x103f,
["unc_h_ring_ak_used.cw_vr1_odd"] = 0x203f,
["unc_h_ring_bl_used.ccw_vr0_even"] = 0x0440,
["unc_h_ring_bl_used.ccw_vr0_odd"] = 0x0840,
["unc_h_ring_bl_used.ccw_vr1_even"] = 0x4040,
["unc_h_ring_bl_used.ccw_vr1_odd"] = 0x8040,
["unc_h_ring_bl_used.cw_vr0_even"] = 0x0140,
["unc_h_ring_bl_used.cw_vr0_odd"] = 0x0240,
["unc_h_ring_bl_used.cw_vr1_even"] = 0x1040,
["unc_h_ring_bl_used.cw_vr1_odd"] = 0x2040,
["unc_h_rpq_cycles_no_reg_credits.chn0"] = 0x0115,
["unc_h_rpq_cycles_no_reg_credits.chn1"] = 0x0215,
["unc_h_rpq_cycles_no_reg_credits.chn2"] = 0x0415,
["unc_h_rpq_cycles_no_reg_credits.chn3"] = 0x0815,
["unc_h_rpq_cycles_no_spec_credits.chn0"] = 0x0116,
["unc_h_rpq_cycles_no_spec_credits.chn1"] = 0x0216,
["unc_h_rpq_cycles_no_spec_credits.chn2"] = 0x0416,
["unc_h_rpq_cycles_no_spec_credits.chn3"] = 0x0816,
["unc_h_snoop_resp.rspcnflct"] = 0x4021,
["unc_h_snoop_resp.rspi"] = 0x0121,
["unc_h_snoop_resp.rspifwd"] = 0x0421,
["unc_h_snoop_resp.rsps"] = 0x0221,
["unc_h_snoop_resp.rspsfwd"] = 0x0821,
["unc_h_snoop_resp.rsp_fwd_wb"] = 0x2021,
["unc_h_snoop_resp.rsp_wb"] = 0x1021,
["unc_h_snp_resp_recv_local.other"] = 0x8060,
["unc_h_snp_resp_recv_local.rspcnflct"] = 0x4060,
["unc_h_snp_resp_recv_local.rspi"] = 0x0160,
["unc_h_snp_resp_recv_local.rspifwd"] = 0x0460,
["unc_h_snp_resp_recv_local.rsps"] = 0x0260,
["unc_h_snp_resp_recv_local.rspsfwd"] = 0x0860,
["unc_h_snp_resp_recv_local.rspxfwdxwb"] = 0x2060,
["unc_h_snp_resp_recv_local.rspxwb"] = 0x1060,
["unc_h_tad_requests_g0.region0"] = 0x011b,
["unc_h_tad_requests_g0.region1"] = 0x021b,
["unc_h_tad_requests_g0.region2"] = 0x041b,
["unc_h_tad_requests_g0.region3"] = 0x081b,
["unc_h_tad_requests_g0.region4"] = 0x101b,
["unc_h_tad_requests_g0.region5"] = 0x201b,
["unc_h_tad_requests_g0.region6"] = 0x401b,
["unc_h_tad_requests_g0.region7"] = 0x801b,
["unc_h_tad_requests_g1.region10"] = 0x041c,
["unc_h_tad_requests_g1.region11"] = 0x081c,
["unc_h_tad_requests_g1.region8"] = 0x011c,
["unc_h_tad_requests_g1.region9"] = 0x021c,
["unc_h_tracker_cycles_ne"] = 0x0003,
["unc_h_txr_ad_cycles_full.all"] = 0x032a,
["unc_h_txr_ad_cycles_full.sched0"] = 0x012a,
["unc_h_txr_ad_cycles_full.sched1"] = 0x022a,
["unc_h_txr_ad_cycles_ne.all"] = 0x0329,
["unc_h_txr_ad_cycles_ne.sched0"] = 0x0129,
["unc_h_txr_ad_cycles_ne.sched1"] = 0x0229,
["unc_h_txr_ad_inserts.all"] = 0x0327,
["unc_h_txr_ad_inserts.sched0"] = 0x0127,
["unc_h_txr_ad_inserts.sched1"] = 0x0227,
["unc_h_txr_ad_occupancy.sched0"] = 0x0128,
["unc_h_txr_ad_occupancy.sched1"] = 0x0228,
["unc_h_txr_ak.crd_cbo"] = 0x020e,
["unc_h_txr_ak_cycles_full.all"] = 0x0332,
["unc_h_txr_ak_cycles_full.sched0"] = 0x0132,
["unc_h_txr_ak_cycles_full.sched1"] = 0x0232,
["unc_h_txr_ak_cycles_ne.all"] = 0x0331,
["unc_h_txr_ak_cycles_ne.sched0"] = 0x0131,
["unc_h_txr_ak_cycles_ne.sched1"] = 0x0231,
["unc_h_txr_ak_inserts.all"] = 0x032f,
["unc_h_txr_ak_inserts.sched0"] = 0x012f,
["unc_h_txr_ak_inserts.sched1"] = 0x022f,
["unc_h_txr_ak_occupancy.sched0"] = 0x0130,
["unc_h_txr_ak_occupancy.sched1"] = 0x0230,
["unc_h_txr_bl.drs_cache"] = 0x0110,
["unc_h_txr_bl.drs_core"] = 0x0210,
["unc_h_txr_bl.drs_qpi"] = 0x0410,
["unc_h_txr_bl_cycles_full.all"] = 0x0336,
["unc_h_txr_bl_cycles_full.sched0"] = 0x0136,
["unc_h_txr_bl_cycles_full.sched1"] = 0x0236,
["unc_h_txr_bl_cycles_ne.all"] = 0x0335,
["unc_h_txr_bl_cycles_ne.sched0"] = 0x0135,
["unc_h_txr_bl_cycles_ne.sched1"] = 0x0235,
["unc_h_txr_bl_inserts.all"] = 0x0333,
["unc_h_txr_bl_inserts.sched0"] = 0x0133,
["unc_h_txr_bl_inserts.sched1"] = 0x0233,
["unc_h_txr_bl_occupancy.all"] = 0x0334,
["unc_h_txr_bl_occupancy.sched0"] = 0x0134,
["unc_h_txr_bl_occupancy.sched1"] = 0x0234,
["unc_h_wpq_cycles_no_reg_credits.chn0"] = 0x0118,
["unc_h_wpq_cycles_no_reg_credits.chn1"] = 0x0218,
["unc_h_wpq_cycles_no_reg_credits.chn2"] = 0x0418,
["unc_h_wpq_cycles_no_reg_credits.chn3"] = 0x0818,
["unc_h_wpq_cycles_no_spec_credits.chn0"] = 0x0119,
["unc_h_wpq_cycles_no_spec_credits.chn1"] = 0x0219,
["unc_h_wpq_cycles_no_spec_credits.chn2"] = 0x0419,
["unc_h_wpq_cycles_no_spec_credits.chn3"] = 0x0819,
["unc_m_act_count.rd"] = 0x0101,
["unc_m_act_count.wr"] = 0x0201,
["unc_m_byp_cmds.act"] = 0x01a1,
["unc_m_byp_cmds.cas"] = 0x02a1,
["unc_m_byp_cmds.pre"] = 0x04a1,
["unc_m_cas_count.all"] = 0x0f04,
["unc_m_cas_count.rd"] = 0x0304,
["unc_m_cas_count.rd_reg"] = 0x0104,
["unc_m_cas_count.rd_rmm"] = 0x2004,
["unc_m_cas_count.rd_underfill"] = 0x0204,
["unc_m_cas_count.rd_wmm"] = 0x1004,
["unc_m_cas_count.wr"] = 0x0c04,
["unc_m_cas_count.wr_rmm"] = 0x0804,
["unc_m_cas_count.wr_wmm"] = 0x0404,
["unc_m_dram_pre_all"] = 0x0006,
["unc_m_dram_refresh.high"] = 0x0405,
["unc_m_dram_refresh.panic"] = 0x0205,
["unc_m_ecc_correctable_errors"] = 0x0009,
["unc_m_major_modes.isoch"] = 0x0807,
["unc_m_major_modes.partial"] = 0x0407,
["unc_m_major_modes.read"] = 0x0107,
["unc_m_major_modes.write"] = 0x0207,
["unc_m_power_channel_dlloff"] = 0x0084,
["unc_m_power_channel_ppd"] = 0x0085,
["unc_m_power_cke_cycles.rank0"] = 0x0183,
["unc_m_power_cke_cycles.rank1"] = 0x0283,
["unc_m_power_cke_cycles.rank2"] = 0x0483,
["unc_m_power_cke_cycles.rank3"] = 0x0883,
["unc_m_power_cke_cycles.rank4"] = 0x1083,
["unc_m_power_cke_cycles.rank5"] = 0x2083,
["unc_m_power_cke_cycles.rank6"] = 0x4083,
["unc_m_power_cke_cycles.rank7"] = 0x8083,
["unc_m_power_critical_throttle_cycles"] = 0x0086,
["unc_m_power_self_refresh"] = 0x0043,
["unc_m_power_throttle_cycles.rank0"] = 0x0141,
["unc_m_power_throttle_cycles.rank1"] = 0x0241,
["unc_m_power_throttle_cycles.rank2"] = 0x0441,
["unc_m_power_throttle_cycles.rank3"] = 0x0841,
["unc_m_power_throttle_cycles.rank4"] = 0x1041,
["unc_m_power_throttle_cycles.rank5"] = 0x2041,
["unc_m_power_throttle_cycles.rank6"] = 0x4041,
["unc_m_power_throttle_cycles.rank7"] = 0x8041,
["unc_m_preemption.rd_preempt_rd"] = 0x0108,
["unc_m_preemption.rd_preempt_wr"] = 0x0208,
["unc_m_pre_count.page_close"] = 0x0202,
["unc_m_pre_count.page_miss"] = 0x0102,
["unc_m_pre_count.rd"] = 0x0402,
["unc_m_pre_count.wr"] = 0x0802,
["unc_m_rd_cas_prio.high"] = 0x04a0,
["unc_m_rd_cas_prio.low"] = 0x01a0,
["unc_m_rd_cas_prio.med"] = 0x02a0,
["unc_m_rd_cas_prio.panic"] = 0x08a0,
["unc_m_rd_cas_rank0.bank0"] = 0x01b0,
["unc_m_rd_cas_rank0.bank1"] = 0x02b0,
["unc_m_rd_cas_rank0.bank2"] = 0x04b0,
["unc_m_rd_cas_rank0.bank3"] = 0x08b0,
["unc_m_rd_cas_rank0.bank4"] = 0x10b0,
["unc_m_rd_cas_rank0.bank5"] = 0x20b0,
["unc_m_rd_cas_rank0.bank6"] = 0x40b0,
["unc_m_rd_cas_rank0.bank7"] = 0x80b0,
["unc_m_rpq_cycles_ne"] = 0x0011,
["unc_m_rpq_inserts"] = 0x0010,
["unc_m_vmse_mxb_wr_occupancy"] = 0x0091,
["unc_m_vmse_wr_push.rmm"] = 0x0290,
["unc_m_vmse_wr_push.wmm"] = 0x0190,
["unc_m_wmm_to_rmm.low_thresh"] = 0x01c0,
["unc_m_wmm_to_rmm.starve"] = 0x02c0,
["unc_m_wmm_to_rmm.vmse_retry"] = 0x04c0,
["unc_m_wpq_cycles_full"] = 0x0022,
["unc_m_wpq_cycles_ne"] = 0x0021,
["unc_m_wpq_inserts"] = 0x0020,
["unc_m_wpq_read_hit"] = 0x0023,
["unc_m_wpq_write_hit"] = 0x0024,
["unc_m_wrong_mm"] = 0x00c1,
["unc_m_wr_cas_rank0.bank0"] = 0x01b8,
["unc_m_wr_cas_rank0.bank1"] = 0x02b8,
["unc_m_wr_cas_rank0.bank2"] = 0x04b8,
["unc_m_wr_cas_rank0.bank3"] = 0x08b8,
["unc_m_wr_cas_rank0.bank4"] = 0x10b8,
["unc_m_wr_cas_rank0.bank5"] = 0x20b8,
["unc_m_wr_cas_rank0.bank6"] = 0x40b8,
["unc_m_wr_cas_rank0.bank7"] = 0x80b8,
["unc_q_message.drs.anyresp9flits"] = 0x0038,
["unc_q_message.drs.anyresp11flits"] = 0x0038,
["unc_q_message.drs.datac_m"] = 0x0038,
["unc_q_message.drs.wbidata"] = 0x0038,
["unc_q_message.drs.wbsdata"] = 0x0038,
["unc_q_message.drs.wbedata"] = 0x0038,
["unc_q_message.drs.anyresp"] = 0x0038,
["unc_q_message.drs.anydatac"] = 0x0038,
["unc_q_message.ncb.anymsg"] = 0x0038,
["unc_q_message.ncb.anyint"] = 0x0038,
["unc_q_message.drs.datac_f"] = 0x0038,
["unc_q_message.drs.datac_f_frcackcnflt"] = 0x0038,
["unc_q_message.drs.datac_f_cmp"] = 0x0038,
["unc_q_message.drs.datac_e"] = 0x0038,
["unc_q_message.drs.datac_e_frcackcnflt"] = 0x0038,
["unc_q_message.drs.datac_e_cmp"] = 0x0038,
["unc_q_message.hom.respfwd"] = 0x0038,
["unc_q_message.hom.respfwdi"] = 0x0038,
["unc_q_message.hom.respfwds"] = 0x0038,
["unc_q_message.hom.respfwdiwb"] = 0x0038,
["unc_q_message.hom.respfwdswb"] = 0x0038,
["unc_q_message.hom.respiwb"] = 0x0038,
["unc_q_message.hom.respswb"] = 0x0038,
["unc_q_message.hom.anyreq"] = 0x0038,
["unc_q_message.hom.anyresp"] = 0x0038,
["unc_q_message.snp.anysnp"] = 0x0038,
["unc_q_message.ndr.anycmp"] = 0x0038,
["unc_q_message.ncs.ncrd"] = 0x0038,
["unc_q_message.ncs.anymsg1or2flits"] = 0x0038,
["unc_q_message.ncs.anymsg3flits"] = 0x0038,
["unc_q_message.ncb.anymsg9flits"] = 0x0038,
["unc_q_message.ncb.anymsg11flits"] = 0x0038,
["unc_q_match_mask"] = 0x0038,
["unc_c_ring_ad_used.up"] = 0x331b,
["unc_c_ring_ad_used.down"] = 0xcc1b,
["unc_c_ring_ak_used.up"] = 0x331c,
["unc_c_ring_ak_used.down"] = 0xcc1c,
["unc_c_ring_bl_used.up"] = 0x331d,
["unc_c_ring_bl_used.down"] = 0xcc1d,
["unc_c_ring_bounces.ad_irq"] = 0x0205,
["unc_c_ring_bounces.ak"] = 0x0405,
["unc_c_ring_bounces.bl"] = 0x0805,
["unc_c_ring_bounces.iv"] = 0x1005,
["unc_c_ring_sink_starved.ad_irq"] = 0x0106,
["unc_c_ring_sink_starved.ad_ipq"] = 0x0206,
["unc_c_ring_sink_starved.iv"] = 0x1006,
["unc_c_rxr_ext_starved.prq"] = 0x0412,
["unc_c_rxr_inserts.irq_rej"] = 0x0213,
["unc_h_addr_opc_match.addr"] = 0x0120,
["unc_h_addr_opc_match.opc"] = 0x0220,
["unc_h_addr_opc_match.ad"] = 0x0420,
["unc_h_addr_opc_match.bl"] = 0x0820,
["unc_h_addr_opc_match.ak"] = 0x1020,
["unc_h_bt_cycles_ne"] = 0x0042,
["unc_h_bt_to_ht_not_issued.rspackcflt_hazard"] = 0x0851,
["unc_h_bt_to_ht_not_issued.wbmdata_hazard"] = 0x1051,
["unc_h_directory_update.set"] = 0x010d,
["unc_h_directory_update.clear"] = 0x020d,
["unc_h_igr_credits_ad_qpi2"] = 0x0059,
["unc_h_igr_credits_bl_qpi2"] = 0x005a,
["unc_h_iodc_conflicts.any"] = 0x0157,
["unc_h_iodc_conflicts.last"] = 0x0457,
["unc_h_ring_ad_used.cw"] = 0x333e,
["unc_h_ring_ad_used.ccw"] = 0xcc3e,
["unc_h_ring_ak_used.cw"] = 0x333f,
["unc_h_ring_ak_used.ccw"] = 0xcc3f,
["unc_h_ring_bl_used.cw"] = 0x3340,
["unc_h_ring_bl_used.ccw"] = 0xcc40,
["unc_h_txr_ad.hom"] = 0x040f,
["unc_i_transactions.rd_prefetches"] = 0x0415,
["unc_p_demotions_core10"] = 0x0042,
["unc_p_demotions_core11"] = 0x0043,
["unc_p_demotions_core12"] = 0x0044,
["unc_p_demotions_core13"] = 0x0045,
["unc_p_demotions_core14"] = 0x0046,
["unc_p_demotions_core8"] = 0x0040,
["unc_p_demotions_core9"] = 0x0041,
["unc_p_freq_min_perf_p_cycles"] = 0x0002,
["unc_p_pkg_c_exit_latency"] = 0x0026,
["unc_q_rxl_cycles_ne_drs.vn0"] = 0x010f,
["unc_q_rxl_cycles_ne_drs.vn1"] = 0x020f,
["unc_q_rxl_cycles_ne_hom.vn0"] = 0x0112,
["unc_q_rxl_cycles_ne_hom.vn1"] = 0x0212,
["unc_q_rxl_cycles_ne_ncb.vn0"] = 0x0110,
["unc_q_rxl_cycles_ne_ncb.vn1"] = 0x0210,
["unc_q_rxl_cycles_ne_ncs.vn0"] = 0x0111,
["unc_q_rxl_cycles_ne_ncs.vn1"] = 0x0211,
["unc_q_rxl_cycles_ne_ndr.vn0"] = 0x0114,
["unc_q_rxl_cycles_ne_ndr.vn1"] = 0x0214,
["unc_q_rxl_cycles_ne_snp.vn0"] = 0x0113,
["unc_q_rxl_cycles_ne_snp.vn1"] = 0x0213,
["unc_q_rxl_inserts_drs.vn0"] = 0x0109,
["unc_q_rxl_inserts_drs.vn1"] = 0x0209,
["unc_q_rxl_inserts_hom.vn0"] = 0x010c,
["unc_q_rxl_inserts_hom.vn1"] = 0x020c,
["unc_q_rxl_inserts_ncb.vn0"] = 0x010a,
["unc_q_rxl_inserts_ncb.vn1"] = 0x020a,
["unc_q_rxl_inserts_ncs.vn0"] = 0x010b,
["unc_q_rxl_inserts_ncs.vn1"] = 0x020b,
["unc_q_rxl_inserts_ndr.vn0"] = 0x010e,
["unc_q_rxl_inserts_ndr.vn1"] = 0x020e,
["unc_q_rxl_inserts_snp.vn0"] = 0x010d,
["unc_q_rxl_inserts_snp.vn1"] = 0x020d,
["unc_q_rxl_occupancy_drs.vn0"] = 0x0115,
["unc_q_rxl_occupancy_drs.vn1"] = 0x0215,
["unc_q_rxl_occupancy_hom.vn0"] = 0x0118,
["unc_q_rxl_occupancy_hom.vn1"] = 0x0218,
["unc_q_rxl_occupancy_ncb.vn0"] = 0x0116,
["unc_q_rxl_occupancy_ncb.vn1"] = 0x0216,
["unc_q_rxl_occupancy_ncs.vn0"] = 0x0117,
["unc_q_rxl_occupancy_ncs.vn1"] = 0x0217,
["unc_q_rxl_occupancy_ndr.vn0"] = 0x011a,
["unc_q_rxl_occupancy_ndr.vn1"] = 0x021a,
["unc_q_rxl_occupancy_snp.vn0"] = 0x0119,
["unc_q_rxl_occupancy_snp.vn1"] = 0x0219,
["unc_q_txr_ak_ndr_credit_acquired"] = 0x0029,
["unc_q_txr_ak_ndr_credit_occupancy"] = 0x0025,
["unc_r2_ring_ad_used.cw"] = 0x3307,
["unc_r2_ring_ad_used.ccw"] = 0xcc07,
["unc_r2_ring_ak_used.cw"] = 0x3308,
["unc_r2_ring_ak_used.ccw"] = 0xcc08,
["unc_r2_ring_bl_used.cw"] = 0x3309,
["unc_r2_ring_bl_used.ccw"] = 0xcc09,
["unc_r2_ring_iv_used.any"] = 0xff0a,
["unc_r2_rxr_ak_bounces.cw"] = 0x0112,
["unc_r2_rxr_ak_bounces.ccw"] = 0x0212,
["unc_r2_txr_nack_ccw.ad"] = 0x0128,
["unc_r2_txr_nack_ccw.ak"] = 0x0228,
["unc_r2_txr_nack_ccw.bl"] = 0x0428,
["unc_r2_txr_nack_cw.ad"] = 0x0126,
["unc_r2_txr_nack_cw.ak"] = 0x0226,
["unc_r2_txr_nack_cw.bl"] = 0x0426,
["unc_r3_ring_ad_used.cw"] = 0x3307,
["unc_r3_ring_ad_used.ccw"] = 0xcc07,
["unc_r3_ring_ak_used.cw"] = 0x3308,
["unc_r3_ring_ak_used.ccw"] = 0xcc08,
["unc_r3_ring_bl_used.cw"] = 0x3309,
["unc_r3_ring_bl_used.ccw"] = 0xcc09,
["unc_r3_ring_iv_used.any"] = 0xff0a,
["unc_r3_rxr_ad_bypassed"] = 0x0012,
["unc_r3_vna_credits_acquired.ad"] = 0x0133,
["unc_r3_vna_credits_acquired.bl"] = 0x0433,
["unc_u_racu_requests"] = 0x0046,
["unc_m_act_count.byp"] = 0x0801,
["unc_m_dclockticks"] = 0x0000,
["unc_m_power_pcu_throttling"] = 0x0042,
["unc_m_pre_count.byp"] = 0x1002,
["unc_m_rd_cas_rank1.bank0"] = 0x01b1,
["unc_m_rd_cas_rank1.bank1"] = 0x02b1,
["unc_m_rd_cas_rank1.bank2"] = 0x04b1,
["unc_m_rd_cas_rank1.bank3"] = 0x08b1,
["unc_m_rd_cas_rank1.bank4"] = 0x10b1,
["unc_m_rd_cas_rank1.bank5"] = 0x20b1,
["unc_m_rd_cas_rank1.bank6"] = 0x40b1,
["unc_m_rd_cas_rank1.bank7"] = 0x80b1,
["unc_m_rd_cas_rank2.bank0"] = 0x01b2,
["unc_m_rd_cas_rank2.bank1"] = 0x02b2,
["unc_m_rd_cas_rank2.bank2"] = 0x04b2,
["unc_m_rd_cas_rank2.bank3"] = 0x08b2,
["unc_m_rd_cas_rank2.bank4"] = 0x10b2,
["unc_m_rd_cas_rank2.bank5"] = 0x20b2,
["unc_m_rd_cas_rank2.bank6"] = 0x40b2,
["unc_m_rd_cas_rank2.bank7"] = 0x80b2,
["unc_m_rd_cas_rank3.bank0"] = 0x01b3,
["unc_m_rd_cas_rank3.bank1"] = 0x02b3,
["unc_m_rd_cas_rank3.bank2"] = 0x04b3,
["unc_m_rd_cas_rank3.bank3"] = 0x08b3,
["unc_m_rd_cas_rank3.bank4"] = 0x10b3,
["unc_m_rd_cas_rank3.bank5"] = 0x20b3,
["unc_m_rd_cas_rank3.bank6"] = 0x40b3,
["unc_m_rd_cas_rank3.bank7"] = 0x80b3,
["unc_m_rd_cas_rank4.bank0"] = 0x01b4,
["unc_m_rd_cas_rank4.bank1"] = 0x02b4,
["unc_m_rd_cas_rank4.bank2"] = 0x04b4,
["unc_m_rd_cas_rank4.bank3"] = 0x08b4,
["unc_m_rd_cas_rank4.bank4"] = 0x10b4,
["unc_m_rd_cas_rank4.bank5"] = 0x20b4,
["unc_m_rd_cas_rank4.bank6"] = 0x40b4,
["unc_m_rd_cas_rank4.bank7"] = 0x80b4,
["unc_m_rd_cas_rank5.bank0"] = 0x01b5,
["unc_m_rd_cas_rank5.bank1"] = 0x02b5,
["unc_m_rd_cas_rank5.bank2"] = 0x04b5,
["unc_m_rd_cas_rank5.bank3"] = 0x08b5,
["unc_m_rd_cas_rank5.bank4"] = 0x10b5,
["unc_m_rd_cas_rank5.bank5"] = 0x20b5,
["unc_m_rd_cas_rank5.bank6"] = 0x40b5,
["unc_m_rd_cas_rank5.bank7"] = 0x80b5,
["unc_m_rd_cas_rank6.bank0"] = 0x01b6,
["unc_m_rd_cas_rank6.bank1"] = 0x02b6,
["unc_m_rd_cas_rank6.bank2"] = 0x04b6,
["unc_m_rd_cas_rank6.bank3"] = 0x08b6,
["unc_m_rd_cas_rank6.bank4"] = 0x10b6,
["unc_m_rd_cas_rank6.bank5"] = 0x20b6,
["unc_m_rd_cas_rank6.bank6"] = 0x40b6,
["unc_m_rd_cas_rank6.bank7"] = 0x80b6,
["unc_m_rd_cas_rank7.bank0"] = 0x01b7,
["unc_m_rd_cas_rank7.bank1"] = 0x02b7,
["unc_m_rd_cas_rank7.bank2"] = 0x04b7,
["unc_m_rd_cas_rank7.bank3"] = 0x08b7,
["unc_m_rd_cas_rank7.bank4"] = 0x10b7,
["unc_m_rd_cas_rank7.bank5"] = 0x20b7,
["unc_m_rd_cas_rank7.bank6"] = 0x40b7,
["unc_m_rd_cas_rank7.bank7"] = 0x80b7,
["unc_m_wr_cas_rank1.bank0"] = 0x01b9,
["unc_m_wr_cas_rank1.bank1"] = 0x02b9,
["unc_m_wr_cas_rank1.bank2"] = 0x04b9,
["unc_m_wr_cas_rank1.bank3"] = 0x08b9,
["unc_m_wr_cas_rank1.bank4"] = 0x10b9,
["unc_m_wr_cas_rank1.bank5"] = 0x20b9,
["unc_m_wr_cas_rank1.bank6"] = 0x40b9,
["unc_m_wr_cas_rank1.bank7"] = 0x80b9,
["unc_m_wr_cas_rank2.bank0"] = 0x01ba,
["unc_m_wr_cas_rank2.bank1"] = 0x02ba,
["unc_m_wr_cas_rank2.bank2"] = 0x04ba,
["unc_m_wr_cas_rank2.bank3"] = 0x08ba,
["unc_m_wr_cas_rank2.bank4"] = 0x10ba,
["unc_m_wr_cas_rank2.bank5"] = 0x20ba,
["unc_m_wr_cas_rank2.bank6"] = 0x40ba,
["unc_m_wr_cas_rank2.bank7"] = 0x80ba,
["unc_m_wr_cas_rank3.bank0"] = 0x01bb,
["unc_m_wr_cas_rank3.bank1"] = 0x02bb,
["unc_m_wr_cas_rank3.bank2"] = 0x04bb,
["unc_m_wr_cas_rank3.bank3"] = 0x08bb,
["unc_m_wr_cas_rank3.bank4"] = 0x10bb,
["unc_m_wr_cas_rank3.bank5"] = 0x20bb,
["unc_m_wr_cas_rank3.bank6"] = 0x40bb,
["unc_m_wr_cas_rank3.bank7"] = 0x80bb,
["unc_m_wr_cas_rank4.bank0"] = 0x01bc,
["unc_m_wr_cas_rank4.bank1"] = 0x02bc,
["unc_m_wr_cas_rank4.bank2"] = 0x04bc,
["unc_m_wr_cas_rank4.bank3"] = 0x08bc,
["unc_m_wr_cas_rank4.bank4"] = 0x10bc,
["unc_m_wr_cas_rank4.bank5"] = 0x20bc,
["unc_m_wr_cas_rank4.bank6"] = 0x40bc,
["unc_m_wr_cas_rank4.bank7"] = 0x80bc,
["unc_m_wr_cas_rank5.bank0"] = 0x01bd,
["unc_m_wr_cas_rank5.bank1"] = 0x02bd,
["unc_m_wr_cas_rank5.bank2"] = 0x04bd,
["unc_m_wr_cas_rank5.bank3"] = 0x08bd,
["unc_m_wr_cas_rank5.bank4"] = 0x10bd,
["unc_m_wr_cas_rank5.bank5"] = 0x20bd,
["unc_m_wr_cas_rank5.bank6"] = 0x40bd,
["unc_m_wr_cas_rank5.bank7"] = 0x80bd,
["unc_m_wr_cas_rank6.bank0"] = 0x01be,
["unc_m_wr_cas_rank6.bank1"] = 0x02be,
["unc_m_wr_cas_rank6.bank2"] = 0x04be,
["unc_m_wr_cas_rank6.bank3"] = 0x08be,
["unc_m_wr_cas_rank6.bank4"] = 0x10be,
["unc_m_wr_cas_rank6.bank5"] = 0x20be,
["unc_m_wr_cas_rank6.bank6"] = 0x40be,
["unc_m_wr_cas_rank6.bank7"] = 0x80be,
["unc_m_wr_cas_rank7.bank0"] = 0x01bf,
["unc_m_wr_cas_rank7.bank1"] = 0x02bf,
["unc_m_wr_cas_rank7.bank2"] = 0x04bf,
["unc_m_wr_cas_rank7.bank3"] = 0x08bf,
["unc_m_wr_cas_rank7.bank4"] = 0x10bf,
["unc_m_wr_cas_rank7.bank5"] = 0x20bf,
["unc_m_wr_cas_rank7.bank6"] = 0x40bf,
["unc_m_wr_cas_rank7.bank7"] = 0x80bf,
["unc_u_clockticks"] = 0x0000,
["unc_c_ring_ad_used.cw"] = 0x031b,
["unc_c_ring_ad_used.ccw"] = 0x0c1b,
["unc_c_ring_ak_used.cw"] = 0x031c,
["unc_c_ring_ak_used.ccw"] = 0x0c1c,
["unc_c_ring_bl_used.cw"] = 0x031d,
["unc_c_ring_bl_used.ccw"] = 0x0c1d,
["unc_c_rxr_occupancy.irq_rej"] = 0x0211,
},
},
{"GenuineIntel-6-3C", "V20", "core",
{
-- source: HSW/Haswell_core_V20.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_completed_2m_4m"] = 0x0408,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["dtlb_load_misses.stlb_hit_2m"] = 0x4008,
["dtlb_load_misses.pde_cache_miss"] = 0x8008,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["arith.divider_uops"] = 0x0214,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.request_fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_completed_2m_4m"] = 0x0449,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["dtlb_store_misses.stlb_hit_2m"] = 0x4049,
["dtlb_store_misses.pde_cache_miss"] = 0x8049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_completed_2m_4m"] = 0x0485,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["itlb_misses.stlb_hit_2m"] = 0x4085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.ept_dtlb_l1"] = 0x41bc,
["page_walker_loads.ept_itlb_l1"] = 0x81bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.ept_dtlb_l2"] = 0x42bc,
["page_walker_loads.ept_itlb_l2"] = 0x82bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.ept_dtlb_l3"] = 0x44bc,
["page_walker_loads.ept_itlb_l3"] = 0x84bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["page_walker_loads.itlb_memory"] = 0x28bc,
["page_walker_loads.ept_dtlb_memory"] = 0x48bc,
["page_walker_loads.ept_itlb_memory"] = 0x88bc,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["l2_lines_out.demand_dirty"] = 0x06f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["avx_insts.all"] = 0x07c6,
["icache.ifdata_stall"] = 0x0480,
},
},
{"GenuineIntel-6-45", "V20", "core",
{
-- source: HSW/Haswell_core_V20.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_completed_2m_4m"] = 0x0408,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["dtlb_load_misses.stlb_hit_2m"] = 0x4008,
["dtlb_load_misses.pde_cache_miss"] = 0x8008,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["arith.divider_uops"] = 0x0214,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.request_fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_completed_2m_4m"] = 0x0449,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["dtlb_store_misses.stlb_hit_2m"] = 0x4049,
["dtlb_store_misses.pde_cache_miss"] = 0x8049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_completed_2m_4m"] = 0x0485,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["itlb_misses.stlb_hit_2m"] = 0x4085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.ept_dtlb_l1"] = 0x41bc,
["page_walker_loads.ept_itlb_l1"] = 0x81bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.ept_dtlb_l2"] = 0x42bc,
["page_walker_loads.ept_itlb_l2"] = 0x82bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.ept_dtlb_l3"] = 0x44bc,
["page_walker_loads.ept_itlb_l3"] = 0x84bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["page_walker_loads.itlb_memory"] = 0x28bc,
["page_walker_loads.ept_dtlb_memory"] = 0x48bc,
["page_walker_loads.ept_itlb_memory"] = 0x88bc,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["l2_lines_out.demand_dirty"] = 0x06f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["avx_insts.all"] = 0x07c6,
["icache.ifdata_stall"] = 0x0480,
},
},
{"GenuineIntel-6-46", "V20", "core",
{
-- source: HSW/Haswell_core_V20.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_completed_2m_4m"] = 0x0408,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["dtlb_load_misses.stlb_hit_2m"] = 0x4008,
["dtlb_load_misses.pde_cache_miss"] = 0x8008,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["arith.divider_uops"] = 0x0214,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.request_fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_completed_2m_4m"] = 0x0449,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["dtlb_store_misses.stlb_hit_2m"] = 0x4049,
["dtlb_store_misses.pde_cache_miss"] = 0x8049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_completed_2m_4m"] = 0x0485,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["itlb_misses.stlb_hit_2m"] = 0x4085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.ept_dtlb_l1"] = 0x41bc,
["page_walker_loads.ept_itlb_l1"] = 0x81bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.ept_dtlb_l2"] = 0x42bc,
["page_walker_loads.ept_itlb_l2"] = 0x82bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.ept_dtlb_l3"] = 0x44bc,
["page_walker_loads.ept_itlb_l3"] = 0x84bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["page_walker_loads.itlb_memory"] = 0x28bc,
["page_walker_loads.ept_dtlb_memory"] = 0x48bc,
["page_walker_loads.ept_itlb_memory"] = 0x88bc,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["l2_lines_out.demand_dirty"] = 0x06f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["avx_insts.all"] = 0x07c6,
["icache.ifdata_stall"] = 0x0480,
},
},
{"GenuineIntel-6-3C", "V20", "offcore",
{
-- source: HSW/Haswell_matrix_V20.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-45", "V20", "offcore",
{
-- source: HSW/Haswell_matrix_V20.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-46", "V20", "offcore",
{
-- source: HSW/Haswell_matrix_V20.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-3C", "V20", "uncore",
{
-- source: HSW/Haswell_uncore_V20.tsv
["unc_cbo_xsnp_response.miss_external"] = 0x2122,
["unc_cbo_xsnp_response.miss_xcore"] = 0x4122,
["unc_cbo_xsnp_response.miss_eviction"] = 0x8122,
["unc_cbo_xsnp_response.hit_external"] = 0x2422,
["unc_cbo_xsnp_response.hit_xcore"] = 0x4422,
["unc_cbo_xsnp_response.hit_eviction"] = 0x8422,
["unc_cbo_xsnp_response.hitm_external"] = 0x2822,
["unc_cbo_xsnp_response.hitm_xcore"] = 0x4822,
["unc_cbo_xsnp_response.hitm_eviction"] = 0x8822,
["unc_cbo_cache_lookup.read_m"] = 0x1134,
["unc_cbo_cache_lookup.write_m"] = 0x2134,
["unc_cbo_cache_lookup.extsnp_m"] = 0x4134,
["unc_cbo_cache_lookup.any_m"] = 0x8134,
["unc_cbo_cache_lookup.read_i"] = 0x1834,
["unc_cbo_cache_lookup.write_i"] = 0x2834,
["unc_cbo_cache_lookup.extsnp_i"] = 0x4834,
["unc_cbo_cache_lookup.any_i"] = 0x8834,
["unc_cbo_cache_lookup.read_mesi"] = 0x1f34,
["unc_cbo_cache_lookup.write_mesi"] = 0x2f34,
["unc_cbo_cache_lookup.extsnp_mesi"] = 0x4f34,
["unc_cbo_cache_lookup.any_mesi"] = 0x8f34,
["unc_cbo_cache_lookup.any_es"] = 0x8634,
["unc_cbo_cache_lookup.extsnp_es"] = 0x4634,
["unc_cbo_cache_lookup.read_es"] = 0x1634,
["unc_cbo_cache_lookup.write_es"] = 0x2634,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_arb_coh_trk_occupancy.all"] = 0x0183,
["unc_clock.socket"] = 0x0100,
},
},
{"GenuineIntel-6-45", "V20", "uncore",
{
-- source: HSW/Haswell_uncore_V20.tsv
["unc_cbo_xsnp_response.miss_external"] = 0x2122,
["unc_cbo_xsnp_response.miss_xcore"] = 0x4122,
["unc_cbo_xsnp_response.miss_eviction"] = 0x8122,
["unc_cbo_xsnp_response.hit_external"] = 0x2422,
["unc_cbo_xsnp_response.hit_xcore"] = 0x4422,
["unc_cbo_xsnp_response.hit_eviction"] = 0x8422,
["unc_cbo_xsnp_response.hitm_external"] = 0x2822,
["unc_cbo_xsnp_response.hitm_xcore"] = 0x4822,
["unc_cbo_xsnp_response.hitm_eviction"] = 0x8822,
["unc_cbo_cache_lookup.read_m"] = 0x1134,
["unc_cbo_cache_lookup.write_m"] = 0x2134,
["unc_cbo_cache_lookup.extsnp_m"] = 0x4134,
["unc_cbo_cache_lookup.any_m"] = 0x8134,
["unc_cbo_cache_lookup.read_i"] = 0x1834,
["unc_cbo_cache_lookup.write_i"] = 0x2834,
["unc_cbo_cache_lookup.extsnp_i"] = 0x4834,
["unc_cbo_cache_lookup.any_i"] = 0x8834,
["unc_cbo_cache_lookup.read_mesi"] = 0x1f34,
["unc_cbo_cache_lookup.write_mesi"] = 0x2f34,
["unc_cbo_cache_lookup.extsnp_mesi"] = 0x4f34,
["unc_cbo_cache_lookup.any_mesi"] = 0x8f34,
["unc_cbo_cache_lookup.any_es"] = 0x8634,
["unc_cbo_cache_lookup.extsnp_es"] = 0x4634,
["unc_cbo_cache_lookup.read_es"] = 0x1634,
["unc_cbo_cache_lookup.write_es"] = 0x2634,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_arb_coh_trk_occupancy.all"] = 0x0183,
["unc_clock.socket"] = 0x0100,
},
},
{"GenuineIntel-6-46", "V20", "uncore",
{
-- source: HSW/Haswell_uncore_V20.tsv
["unc_cbo_xsnp_response.miss_external"] = 0x2122,
["unc_cbo_xsnp_response.miss_xcore"] = 0x4122,
["unc_cbo_xsnp_response.miss_eviction"] = 0x8122,
["unc_cbo_xsnp_response.hit_external"] = 0x2422,
["unc_cbo_xsnp_response.hit_xcore"] = 0x4422,
["unc_cbo_xsnp_response.hit_eviction"] = 0x8422,
["unc_cbo_xsnp_response.hitm_external"] = 0x2822,
["unc_cbo_xsnp_response.hitm_xcore"] = 0x4822,
["unc_cbo_xsnp_response.hitm_eviction"] = 0x8822,
["unc_cbo_cache_lookup.read_m"] = 0x1134,
["unc_cbo_cache_lookup.write_m"] = 0x2134,
["unc_cbo_cache_lookup.extsnp_m"] = 0x4134,
["unc_cbo_cache_lookup.any_m"] = 0x8134,
["unc_cbo_cache_lookup.read_i"] = 0x1834,
["unc_cbo_cache_lookup.write_i"] = 0x2834,
["unc_cbo_cache_lookup.extsnp_i"] = 0x4834,
["unc_cbo_cache_lookup.any_i"] = 0x8834,
["unc_cbo_cache_lookup.read_mesi"] = 0x1f34,
["unc_cbo_cache_lookup.write_mesi"] = 0x2f34,
["unc_cbo_cache_lookup.extsnp_mesi"] = 0x4f34,
["unc_cbo_cache_lookup.any_mesi"] = 0x8f34,
["unc_cbo_cache_lookup.any_es"] = 0x8634,
["unc_cbo_cache_lookup.extsnp_es"] = 0x4634,
["unc_cbo_cache_lookup.read_es"] = 0x1634,
["unc_cbo_cache_lookup.write_es"] = 0x2634,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_arb_coh_trk_occupancy.all"] = 0x0183,
["unc_clock.socket"] = 0x0100,
},
},
{"GenuineIntel-6-3F", "V14", "core",
{
-- source: HSX/HaswellX_core_V14.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_completed_2m_4m"] = 0x0408,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["dtlb_load_misses.stlb_hit_2m"] = 0x4008,
["dtlb_load_misses.pde_cache_miss"] = 0x8008,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["uops_issued.core_stall_cycles"] = 0x010e,
["arith.divider_uops"] = 0x0214,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.request_fb_full"] = 0x0248,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_completed_2m_4m"] = 0x0449,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["dtlb_store_misses.stlb_hit_2m"] = 0x4049,
["dtlb_store_misses.pde_cache_miss"] = 0x8049,
["load_hit_pre.sw_pf"] = 0x014c,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifetch_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_completed_2m_4m"] = 0x0485,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["itlb_misses.stlb_hit_2m"] = 0x4085,
["ild_stall.lcp"] = 0x0187,
["ild_stall.iq_full"] = 0x0487,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.taken_return_near"] = 0x8889,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.ept_dtlb_l1"] = 0x41bc,
["page_walker_loads.ept_itlb_l1"] = 0x81bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.ept_dtlb_l2"] = 0x42bc,
["page_walker_loads.ept_itlb_l2"] = 0x82bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.ept_dtlb_l3"] = 0x44bc,
["page_walker_loads.ept_itlb_l3"] = 0x84bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["page_walker_loads.itlb_memory"] = 0x28bc,
["page_walker_loads.ept_dtlb_memory"] = 0x48bc,
["page_walker_loads.ept_itlb_memory"] = 0x88bc,
["tlb_flush.dtlb_thread"] = 0x01bd,
["tlb_flush.stlb_any"] = 0x20bd,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["uops_retired.core_stall_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["mem_load_uops_l3_miss_retired.remote_dram"] = 0x04d3,
["mem_load_uops_l3_miss_retired.remote_hitm"] = 0x10d3,
["mem_load_uops_l3_miss_retired.remote_fwd"] = 0x20d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["l2_lines_out.demand_dirty"] = 0x06f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_active"] = 0x01a8,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["idq.ms_switches"] = 0x3079,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
["avx_insts.all"] = 0x07c6,
["icache.ifdata_stall"] = 0x0480,
},
},
{"GenuineIntel-6-3F", "V14", "offcore",
{
-- source: HSX/HaswellX_matrix_V14.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-3F", "V14", "uncore",
{
-- source: HSX/HaswellX_uncore_V14.tsv
["unc_c_bounce_control"] = 0x000a,
["unc_c_clockticks"] = 0x0000,
["unc_c_counter0_occupancy"] = 0x001f,
["unc_c_fast_asserted"] = 0x0009,
["unc_c_llc_lookup.data_read"] = 0x0334,
["unc_c_llc_lookup.write"] = 0x0534,
["unc_c_llc_lookup.remote_snoop"] = 0x0934,
["unc_c_llc_lookup.any"] = 0x1134,
["unc_c_llc_lookup.nid"] = 0x4134,
["unc_c_llc_lookup.read"] = 0x2134,
["unc_c_llc_victims.m_state"] = 0x0137,
["unc_c_llc_victims.e_state"] = 0x0237,
["unc_c_llc_victims.s_state"] = 0x0437,
["unc_c_llc_victims.f_state"] = 0x0837,
["unc_c_llc_victims.nid"] = 0x4037,
["unc_c_llc_victims.miss"] = 0x1037,
["unc_c_misc.rspi_was_fse"] = 0x0139,
["unc_c_misc.wc_aliasing"] = 0x0239,
["unc_c_misc.started"] = 0x0439,
["unc_c_misc.rfo_hit_s"] = 0x0839,
["unc_c_misc.cvzero_prefetch_victim"] = 0x1039,
["unc_c_misc.cvzero_prefetch_miss"] = 0x2039,
["unc_c_qlru.age0"] = 0x013c,
["unc_c_qlru.age1"] = 0x023c,
["unc_c_qlru.age2"] = 0x043c,
["unc_c_qlru.age3"] = 0x083c,
["unc_c_qlru.lru_decrement"] = 0x103c,
["unc_c_qlru.victim_non_zero"] = 0x203c,
["unc_c_ring_ad_used.up_even"] = 0x011b,
["unc_c_ring_ad_used.up_odd"] = 0x021b,
["unc_c_ring_ad_used.down_even"] = 0x041b,
["unc_c_ring_ad_used.down_odd"] = 0x081b,
["unc_c_ring_ad_used.up"] = 0x031b,
["unc_c_ring_ad_used.down"] = 0x0c1b,
["unc_c_ring_ad_used.all"] = 0x0f1b,
["unc_c_ring_ak_used.up_even"] = 0x011c,
["unc_c_ring_ak_used.up_odd"] = 0x021c,
["unc_c_ring_ak_used.down_even"] = 0x041c,
["unc_c_ring_ak_used.down_odd"] = 0x081c,
["unc_c_ring_ak_used.up"] = 0x031c,
["unc_c_ring_ak_used.down"] = 0x0c1c,
["unc_c_ring_ak_used.all"] = 0x0f1c,
["unc_c_ring_bl_used.up_even"] = 0x011d,
["unc_c_ring_bl_used.up_odd"] = 0x021d,
["unc_c_ring_bl_used.down_even"] = 0x041d,
["unc_c_ring_bl_used.down_odd"] = 0x081d,
["unc_c_ring_bl_used.up"] = 0x031d,
["unc_c_ring_bl_used.down"] = 0x0c1d,
["unc_c_ring_bl_used.all"] = 0x0f1d,
["unc_c_ring_bounces.ad"] = 0x0105,
["unc_c_ring_bounces.ak"] = 0x0205,
["unc_c_ring_bounces.bl"] = 0x0405,
["unc_c_ring_bounces.iv"] = 0x1005,
["unc_c_ring_iv_used.any"] = 0x0f1e,
["unc_c_ring_iv_used.up"] = 0x031e,
["unc_c_ring_iv_used.down"] = 0xcc1e,
["unc_c_ring_iv_used.dn"] = 0x0c1e,
["unc_c_ring_sink_starved.ad"] = 0x0106,
["unc_c_ring_sink_starved.ak"] = 0x0206,
["unc_c_ring_sink_starved.iv"] = 0x0806,
["unc_c_ring_sink_starved.bl"] = 0x0406,
["unc_c_ring_src_thrtl"] = 0x0007,
["unc_c_rxr_ext_starved.irq"] = 0x0112,
["unc_c_rxr_ext_starved.ipq"] = 0x0212,
["unc_c_rxr_ext_starved.prq"] = 0x0412,
["unc_c_rxr_ext_starved.ismq_bids"] = 0x0812,
["unc_c_rxr_inserts.irq"] = 0x0113,
["unc_c_rxr_inserts.irq_rej"] = 0x0213,
["unc_c_rxr_inserts.ipq"] = 0x0413,
["unc_c_rxr_inserts.prq"] = 0x1013,
["unc_c_rxr_inserts.prq_rej"] = 0x2013,
["unc_c_rxr_int_starved.irq"] = 0x0114,
["unc_c_rxr_int_starved.ipq"] = 0x0414,
["unc_c_rxr_int_starved.ismq"] = 0x0814,
["unc_c_rxr_int_starved.prq"] = 0x1014,
["unc_c_rxr_ipq_retry.any"] = 0x0131,
["unc_c_rxr_ipq_retry.full"] = 0x0231,
["unc_c_rxr_ipq_retry.addr_conflict"] = 0x0431,
["unc_c_rxr_ipq_retry.qpi_credits"] = 0x1031,
["unc_c_rxr_ipq_retry2.ad_sbo"] = 0x0128,
["unc_c_rxr_ipq_retry2.target"] = 0x4028,
["unc_c_rxr_irq_retry.any"] = 0x0132,
["unc_c_rxr_irq_retry.full"] = 0x0232,
["unc_c_rxr_irq_retry.addr_conflict"] = 0x0432,
["unc_c_rxr_irq_retry.rtid"] = 0x0832,
["unc_c_rxr_irq_retry.qpi_credits"] = 0x1032,
["unc_c_rxr_irq_retry.iio_credits"] = 0x2032,
["unc_c_rxr_irq_retry.nid"] = 0x4032,
["unc_c_rxr_irq_retry2.ad_sbo"] = 0x0129,
["unc_c_rxr_irq_retry2.bl_sbo"] = 0x0229,
["unc_c_rxr_irq_retry2.target"] = 0x4029,
["unc_c_rxr_ismq_retry.any"] = 0x0133,
["unc_c_rxr_ismq_retry.full"] = 0x0233,
["unc_c_rxr_ismq_retry.rtid"] = 0x0833,
["unc_c_rxr_ismq_retry.qpi_credits"] = 0x1033,
["unc_c_rxr_ismq_retry.iio_credits"] = 0x2033,
["unc_c_rxr_ismq_retry.wb_credits"] = 0x8033,
["unc_c_rxr_ismq_retry.nid"] = 0x4033,
["unc_c_rxr_ismq_retry2.ad_sbo"] = 0x012a,
["unc_c_rxr_ismq_retry2.bl_sbo"] = 0x022a,
["unc_c_rxr_ismq_retry2.target"] = 0x402a,
["unc_c_rxr_occupancy.irq"] = 0x0111,
["unc_c_rxr_occupancy.irq_rejected"] = 0x0211,
["unc_c_rxr_occupancy.ipq"] = 0x0411,
["unc_c_rxr_occupancy.prq_rej"] = 0x2011,
["unc_c_sbo_credits_acquired.ad"] = 0x013d,
["unc_c_sbo_credits_acquired.bl"] = 0x023d,
["unc_c_sbo_credit_occupancy.ad"] = 0x013e,
["unc_c_sbo_credit_occupancy.bl"] = 0x023e,
["unc_c_tor_inserts.opcode"] = 0x0135,
["unc_c_tor_inserts.eviction"] = 0x0435,
["unc_c_tor_inserts.all"] = 0x0835,
["unc_c_tor_inserts.wb"] = 0x1035,
["unc_c_tor_inserts.miss_opcode"] = 0x0335,
["unc_c_tor_inserts.nid_opcode"] = 0x4135,
["unc_c_tor_inserts.nid_eviction"] = 0x4435,
["unc_c_tor_inserts.nid_all"] = 0x4835,
["unc_c_tor_inserts.nid_wb"] = 0x5035,
["unc_c_tor_inserts.nid_miss_opcode"] = 0x4335,
["unc_c_tor_inserts.nid_miss_all"] = 0x4a35,
["unc_c_tor_inserts.miss_local"] = 0x2a35,
["unc_c_tor_inserts.miss_remote"] = 0x8a35,
["unc_c_tor_inserts.local"] = 0x2835,
["unc_c_tor_inserts.remote"] = 0x8835,
["unc_c_tor_inserts.miss_local_opcode"] = 0x2335,
["unc_c_tor_inserts.miss_remote_opcode"] = 0x8335,
["unc_c_tor_inserts.local_opcode"] = 0x2135,
["unc_c_tor_inserts.remote_opcode"] = 0x8135,
["unc_c_tor_occupancy.opcode"] = 0x0136,
["unc_c_tor_occupancy.eviction"] = 0x0436,
["unc_c_tor_occupancy.all"] = 0x0836,
["unc_c_tor_occupancy.miss_opcode"] = 0x0336,
["unc_c_tor_occupancy.miss_all"] = 0x0a36,
["unc_c_tor_occupancy.nid_opcode"] = 0x4136,
["unc_c_tor_occupancy.nid_eviction"] = 0x4436,
["unc_c_tor_occupancy.nid_all"] = 0x4836,
["unc_c_tor_occupancy.nid_miss_opcode"] = 0x4336,
["unc_c_tor_occupancy.nid_miss_all"] = 0x4a36,
["unc_c_tor_occupancy.miss_local"] = 0x2a36,
["unc_c_tor_occupancy.miss_remote"] = 0x8a36,
["unc_c_tor_occupancy.local"] = 0x2836,
["unc_c_tor_occupancy.remote"] = 0x8836,
["unc_c_tor_occupancy.miss_local_opcode"] = 0x2336,
["unc_c_tor_occupancy.miss_remote_opcode"] = 0x8336,
["unc_c_tor_occupancy.local_opcode"] = 0x2136,
["unc_c_tor_occupancy.remote_opcode"] = 0x8136,
["unc_c_tor_occupancy.wb"] = 0x1036,
["unc_c_tor_occupancy.nid_wb"] = 0x5036,
["unc_c_txr_ads_used.ad"] = 0x0104,
["unc_c_txr_ads_used.ak"] = 0x0204,
["unc_c_txr_ads_used.bl"] = 0x0404,
["unc_c_txr_inserts.ad_cache"] = 0x0102,
["unc_c_txr_inserts.ak_cache"] = 0x0202,
["unc_c_txr_inserts.bl_cache"] = 0x0402,
["unc_c_txr_inserts.iv_cache"] = 0x0802,
["unc_c_txr_inserts.ad_core"] = 0x1002,
["unc_c_txr_inserts.ak_core"] = 0x2002,
["unc_c_txr_inserts.bl_core"] = 0x4002,
["unc_c_txr_starved.ak_both"] = 0x0203,
["unc_c_txr_starved.bl_both"] = 0x0403,
["unc_c_txr_starved.iv"] = 0x0803,
["unc_c_txr_starved.ad_core"] = 0x1003,
["unc_h_addr_opc_match.filt"] = 0x0320,
["unc_h_addr_opc_match.addr"] = 0x0120,
["unc_h_addr_opc_match.opc"] = 0x0220,
["unc_h_addr_opc_match.ad"] = 0x0420,
["unc_h_addr_opc_match.bl"] = 0x0820,
["unc_h_addr_opc_match.ak"] = 0x1020,
["unc_h_bt_cycles_ne"] = 0x0042,
["unc_h_bt_to_ht_not_issued.incoming_snp_hazard"] = 0x0251,
["unc_h_bt_to_ht_not_issued.incoming_bl_hazard"] = 0x0451,
["unc_h_bt_to_ht_not_issued.rspackcflt_hazard"] = 0x0851,
["unc_h_bt_to_ht_not_issued.wbmdata_hazard"] = 0x1051,
["unc_h_bypass_imc.taken"] = 0x0114,
["unc_h_bypass_imc.not_taken"] = 0x0214,
["unc_h_clockticks"] = 0x0000,
["unc_h_direct2core_count"] = 0x0011,
["unc_h_direct2core_cycles_disabled"] = 0x0012,
["unc_h_direct2core_txn_override"] = 0x0013,
["unc_h_directory_lat_opt"] = 0x0041,
["unc_h_directory_lookup.snp"] = 0x010c,
["unc_h_directory_lookup.no_snp"] = 0x020c,
["unc_h_directory_update.set"] = 0x010d,
["unc_h_directory_update.clear"] = 0x020d,
["unc_h_directory_update.any"] = 0x030d,
["unc_h_hitme_hit.read_or_invitoe"] = 0x0171,
["unc_h_hitme_hit.wbmtoi"] = 0x0271,
["unc_h_hitme_hit.ackcnfltwbi"] = 0x0471,
["unc_h_hitme_hit.wbmtoe_or_s"] = 0x0871,
["unc_h_hitme_hit.rspfwdi_remote"] = 0x1071,
["unc_h_hitme_hit.rspfwdi_local"] = 0x2071,
["unc_h_hitme_hit.rspfwds"] = 0x4071,
["unc_h_hitme_hit.rsp"] = 0x8071,
["unc_h_hitme_hit.allocs"] = 0x7071,
["unc_h_hitme_hit.evicts"] = 0x4271,
["unc_h_hitme_hit.invals"] = 0x2671,
["unc_h_hitme_hit.all"] = 0xff71,
["unc_h_hitme_hit.hom"] = 0x0f71,
["unc_h_hitme_hit_pv_bits_set.read_or_invitoe"] = 0x0172,
["unc_h_hitme_hit_pv_bits_set.wbmtoi"] = 0x0272,
["unc_h_hitme_hit_pv_bits_set.ackcnfltwbi"] = 0x0472,
["unc_h_hitme_hit_pv_bits_set.wbmtoe_or_s"] = 0x0872,
["unc_h_hitme_hit_pv_bits_set.rspfwdi_remote"] = 0x1072,
["unc_h_hitme_hit_pv_bits_set.rspfwdi_local"] = 0x2072,
["unc_h_hitme_hit_pv_bits_set.rspfwds"] = 0x4072,
["unc_h_hitme_hit_pv_bits_set.rsp"] = 0x8072,
["unc_h_hitme_hit_pv_bits_set.all"] = 0xff72,
["unc_h_hitme_hit_pv_bits_set.hom"] = 0x0f72,
["unc_h_hitme_lookup.read_or_invitoe"] = 0x0170,
["unc_h_hitme_lookup.wbmtoi"] = 0x0270,
["unc_h_hitme_lookup.ackcnfltwbi"] = 0x0470,
["unc_h_hitme_lookup.wbmtoe_or_s"] = 0x0870,
["unc_h_hitme_lookup.rspfwdi_remote"] = 0x1070,
["unc_h_hitme_lookup.rspfwdi_local"] = 0x2070,
["unc_h_hitme_lookup.rspfwds"] = 0x4070,
["unc_h_hitme_lookup.rsp"] = 0x8070,
["unc_h_hitme_lookup.allocs"] = 0x7070,
["unc_h_hitme_lookup.invals"] = 0x2670,
["unc_h_hitme_lookup.all"] = 0xff70,
["unc_h_hitme_lookup.hom"] = 0x0f70,
["unc_h_igr_no_credit_cycles.ad_qpi0"] = 0x0122,
["unc_h_igr_no_credit_cycles.ad_qpi1"] = 0x0222,
["unc_h_igr_no_credit_cycles.bl_qpi0"] = 0x0422,
["unc_h_igr_no_credit_cycles.bl_qpi1"] = 0x0822,
["unc_h_igr_no_credit_cycles.ad_qpi2"] = 0x1022,
["unc_h_igr_no_credit_cycles.bl_qpi2"] = 0x2022,
["unc_h_imc_reads.normal"] = 0x0117,
["unc_h_imc_retry"] = 0x001e,
["unc_h_imc_writes.full"] = 0x011a,
["unc_h_imc_writes.partial"] = 0x021a,
["unc_h_imc_writes.full_isoch"] = 0x041a,
["unc_h_imc_writes.partial_isoch"] = 0x081a,
["unc_h_imc_writes.all"] = 0x0f1a,
["unc_h_iot_backpressure.sat"] = 0x0161,
["unc_h_iot_backpressure.hub"] = 0x0261,
["unc_h_iot_cts_east_lo.cts0"] = 0x0164,
["unc_h_iot_cts_east_lo.cts1"] = 0x0264,
["unc_h_iot_cts_hi.cts2"] = 0x0165,
["unc_h_iot_cts_hi.cts3"] = 0x0265,
["unc_h_iot_cts_west_lo.cts0"] = 0x0162,
["unc_h_iot_cts_west_lo.cts1"] = 0x0262,
["unc_h_osb.reads_local"] = 0x0253,
["unc_h_osb.invitoe_local"] = 0x0453,
["unc_h_osb.remote"] = 0x0853,
["unc_h_osb.cancelled"] = 0x1053,
["unc_h_osb.reads_local_useful"] = 0x2053,
["unc_h_osb.remote_useful"] = 0x4053,
["unc_h_osb_edr.all"] = 0x0154,
["unc_h_osb_edr.reads_local_i"] = 0x0254,
["unc_h_osb_edr.reads_remote_i"] = 0x0454,
["unc_h_osb_edr.reads_local_s"] = 0x0854,
["unc_h_osb_edr.reads_remote_s"] = 0x1054,
["unc_h_requests.reads"] = 0x0301,
["unc_h_requests.writes"] = 0x0c01,
["unc_h_requests.reads_local"] = 0x0101,
["unc_h_requests.reads_remote"] = 0x0201,
["unc_h_requests.writes_local"] = 0x0401,
["unc_h_requests.writes_remote"] = 0x0801,
["unc_h_requests.invitoe_local"] = 0x1001,
["unc_h_requests.invitoe_remote"] = 0x2001,
["unc_h_ring_ad_used.cw_even"] = 0x013e,
["unc_h_ring_ad_used.cw_odd"] = 0x023e,
["unc_h_ring_ad_used.ccw_even"] = 0x043e,
["unc_h_ring_ad_used.ccw_odd"] = 0x083e,
["unc_h_ring_ad_used.cw"] = 0x033e,
["unc_h_ring_ad_used.ccw"] = 0x0c3e,
["unc_h_ring_ak_used.cw_even"] = 0x013f,
["unc_h_ring_ak_used.cw_odd"] = 0x023f,
["unc_h_ring_ak_used.ccw_even"] = 0x043f,
["unc_h_ring_ak_used.ccw_odd"] = 0x083f,
["unc_h_ring_ak_used.cw"] = 0x033f,
["unc_h_ring_ak_used.ccw"] = 0x0c3f,
["unc_h_ring_bl_used.cw_even"] = 0x0140,
["unc_h_ring_bl_used.cw_odd"] = 0x0240,
["unc_h_ring_bl_used.ccw_even"] = 0x0440,
["unc_h_ring_bl_used.ccw_odd"] = 0x0840,
["unc_h_ring_bl_used.cw"] = 0x0340,
["unc_h_ring_bl_used.ccw"] = 0x0c40,
["unc_h_rpq_cycles_no_reg_credits.chn0"] = 0x0115,
["unc_h_rpq_cycles_no_reg_credits.chn1"] = 0x0215,
["unc_h_rpq_cycles_no_reg_credits.chn2"] = 0x0415,
["unc_h_rpq_cycles_no_reg_credits.chn3"] = 0x0815,
["unc_h_rpq_cycles_no_spec_credits.chn0"] = 0x0116,
["unc_h_rpq_cycles_no_spec_credits.chn1"] = 0x0216,
["unc_h_rpq_cycles_no_spec_credits.chn2"] = 0x0416,
["unc_h_rpq_cycles_no_spec_credits.chn3"] = 0x0816,
["unc_h_sbo0_credits_acquired.ad"] = 0x0168,
["unc_h_sbo0_credits_acquired.bl"] = 0x0268,
["unc_h_sbo0_credit_occupancy.ad"] = 0x016a,
["unc_h_sbo0_credit_occupancy.bl"] = 0x026a,
["unc_h_sbo1_credits_acquired.ad"] = 0x0169,
["unc_h_sbo1_credits_acquired.bl"] = 0x0269,
["unc_h_sbo1_credit_occupancy.ad"] = 0x016b,
["unc_h_sbo1_credit_occupancy.bl"] = 0x026b,
["unc_h_snoops_rsp_after_data.local"] = 0x010a,
["unc_h_snoops_rsp_after_data.remote"] = 0x020a,
["unc_h_snoop_cycles_ne.local"] = 0x0108,
["unc_h_snoop_cycles_ne.remote"] = 0x0208,
["unc_h_snoop_cycles_ne.all"] = 0x0308,
["unc_h_snoop_occupancy.local"] = 0x0109,
["unc_h_snoop_occupancy.remote"] = 0x0209,
["unc_h_snoop_resp.rspi"] = 0x0121,
["unc_h_snoop_resp.rsps"] = 0x0221,
["unc_h_snoop_resp.rspifwd"] = 0x0421,
["unc_h_snoop_resp.rspsfwd"] = 0x0821,
["unc_h_snoop_resp.rsp_wb"] = 0x1021,
["unc_h_snoop_resp.rsp_fwd_wb"] = 0x2021,
["unc_h_snoop_resp.rspcnflct"] = 0x4021,
["unc_h_snp_resp_recv_local.rspi"] = 0x0160,
["unc_h_snp_resp_recv_local.rsps"] = 0x0260,
["unc_h_snp_resp_recv_local.rspifwd"] = 0x0460,
["unc_h_snp_resp_recv_local.rspsfwd"] = 0x0860,
["unc_h_snp_resp_recv_local.rspxwb"] = 0x1060,
["unc_h_snp_resp_recv_local.rspxfwdxwb"] = 0x2060,
["unc_h_snp_resp_recv_local.rspcnflct"] = 0x4060,
["unc_h_snp_resp_recv_local.other"] = 0x8060,
["unc_h_stall_no_sbo_credit.sbo0_ad"] = 0x016c,
["unc_h_stall_no_sbo_credit.sbo1_ad"] = 0x026c,
["unc_h_stall_no_sbo_credit.sbo0_bl"] = 0x046c,
["unc_h_stall_no_sbo_credit.sbo1_bl"] = 0x086c,
["unc_h_tad_requests_g0.region0"] = 0x011b,
["unc_h_tad_requests_g0.region1"] = 0x021b,
["unc_h_tad_requests_g0.region2"] = 0x041b,
["unc_h_tad_requests_g0.region3"] = 0x081b,
["unc_h_tad_requests_g0.region4"] = 0x101b,
["unc_h_tad_requests_g0.region5"] = 0x201b,
["unc_h_tad_requests_g0.region6"] = 0x401b,
["unc_h_tad_requests_g0.region7"] = 0x801b,
["unc_h_tad_requests_g1.region8"] = 0x011c,
["unc_h_tad_requests_g1.region9"] = 0x021c,
["unc_h_tad_requests_g1.region10"] = 0x041c,
["unc_h_tad_requests_g1.region11"] = 0x081c,
["unc_h_tracker_cycles_full.gp"] = 0x0102,
["unc_h_tracker_cycles_full.all"] = 0x0202,
["unc_h_tracker_occupancy.reads_local"] = 0x0404,
["unc_h_tracker_occupancy.reads_remote"] = 0x0804,
["unc_h_tracker_occupancy.writes_local"] = 0x1004,
["unc_h_tracker_occupancy.writes_remote"] = 0x2004,
["unc_h_tracker_occupancy.invitoe_local"] = 0x4004,
["unc_h_tracker_occupancy.invitoe_remote"] = 0x8004,
["unc_h_tracker_pending_occupancy.local"] = 0x0105,
["unc_h_tracker_pending_occupancy.remote"] = 0x0205,
["unc_h_txr_ad.hom"] = 0x040f,
["unc_h_txr_ad_cycles_full.sched0"] = 0x012a,
["unc_h_txr_ad_cycles_full.sched1"] = 0x022a,
["unc_h_txr_ad_cycles_full.all"] = 0x032a,
["unc_h_txr_ad_cycles_ne.sched0"] = 0x0129,
["unc_h_txr_ad_cycles_ne.sched1"] = 0x0229,
["unc_h_txr_ad_cycles_ne.all"] = 0x0329,
["unc_h_txr_ad_inserts.sched0"] = 0x0127,
["unc_h_txr_ad_inserts.sched1"] = 0x0227,
["unc_h_txr_ad_inserts.all"] = 0x0327,
["unc_h_txr_ak_cycles_full.sched0"] = 0x0132,
["unc_h_txr_ak_cycles_full.sched1"] = 0x0232,
["unc_h_txr_ak_cycles_full.all"] = 0x0332,
["unc_h_txr_ak_cycles_ne.sched0"] = 0x0131,
["unc_h_txr_ak_cycles_ne.sched1"] = 0x0231,
["unc_h_txr_ak_cycles_ne.all"] = 0x0331,
["unc_h_txr_ak_inserts.sched0"] = 0x012f,
["unc_h_txr_ak_inserts.sched1"] = 0x022f,
["unc_h_txr_ak_inserts.all"] = 0x032f,
["unc_h_txr_bl.drs_cache"] = 0x0110,
["unc_h_txr_bl.drs_core"] = 0x0210,
["unc_h_txr_bl.drs_qpi"] = 0x0410,
["unc_h_txr_bl_cycles_full.sched0"] = 0x0136,
["unc_h_txr_bl_cycles_full.sched1"] = 0x0236,
["unc_h_txr_bl_cycles_full.all"] = 0x0336,
["unc_h_txr_bl_cycles_ne.sched0"] = 0x0135,
["unc_h_txr_bl_cycles_ne.sched1"] = 0x0235,
["unc_h_txr_bl_cycles_ne.all"] = 0x0335,
["unc_h_txr_bl_inserts.sched0"] = 0x0133,
["unc_h_txr_bl_inserts.sched1"] = 0x0233,
["unc_h_txr_bl_inserts.all"] = 0x0333,
["unc_h_txr_starved.ak"] = 0x016d,
["unc_h_txr_starved.bl"] = 0x026d,
["unc_h_wpq_cycles_no_reg_credits.chn0"] = 0x0118,
["unc_h_wpq_cycles_no_reg_credits.chn1"] = 0x0218,
["unc_h_wpq_cycles_no_reg_credits.chn2"] = 0x0418,
["unc_h_wpq_cycles_no_reg_credits.chn3"] = 0x0818,
["unc_h_wpq_cycles_no_spec_credits.chn0"] = 0x0119,
["unc_h_wpq_cycles_no_spec_credits.chn1"] = 0x0219,
["unc_h_wpq_cycles_no_spec_credits.chn2"] = 0x0419,
["unc_h_wpq_cycles_no_spec_credits.chn3"] = 0x0819,
["unc_i_cache_total_occupancy.any"] = 0x0112,
["unc_i_cache_total_occupancy.source"] = 0x0212,
["unc_i_clockticks"] = 0x0000,
["unc_i_coherent_ops.pcirdcur"] = 0x0113,
["unc_i_coherent_ops.crd"] = 0x0213,
["unc_i_coherent_ops.drd"] = 0x0413,
["unc_i_coherent_ops.rfo"] = 0x0813,
["unc_i_coherent_ops.pcitom"] = 0x1013,
["unc_i_coherent_ops.pcidcahint"] = 0x2013,
["unc_i_coherent_ops.wbmtoi"] = 0x4013,
["unc_i_coherent_ops.clflush"] = 0x8013,
["unc_i_misc0.fast_req"] = 0x0114,
["unc_i_misc0.fast_rej"] = 0x0214,
["unc_i_misc0.2nd_rd_insert"] = 0x0414,
["unc_i_misc0.2nd_wr_insert"] = 0x0814,
["unc_i_misc0.2nd_atomic_insert"] = 0x1014,
["unc_i_misc0.fast_xfer"] = 0x2014,
["unc_i_misc0.pf_ack_hint"] = 0x4014,
["unc_i_misc0.unknown"] = 0x8014,
["unc_i_misc1.slow_i"] = 0x0115,
["unc_i_misc1.slow_s"] = 0x0215,
["unc_i_misc1.slow_e"] = 0x0415,
["unc_i_misc1.slow_m"] = 0x0815,
["unc_i_misc1.lost_fwd"] = 0x1015,
["unc_i_misc1.sec_rcvd_invld"] = 0x2015,
["unc_i_misc1.sec_rcvd_vld"] = 0x4015,
["unc_i_misc1.data_throttle"] = 0x8015,
["unc_i_rxr_ak_inserts"] = 0x000a,
["unc_i_rxr_bl_drs_cycles_full"] = 0x0004,
["unc_i_rxr_bl_drs_inserts"] = 0x0001,
["unc_i_rxr_bl_drs_occupancy"] = 0x0007,
["unc_i_rxr_bl_ncb_cycles_full"] = 0x0005,
["unc_i_rxr_bl_ncb_inserts"] = 0x0002,
["unc_i_rxr_bl_ncb_occupancy"] = 0x0008,
["unc_i_rxr_bl_ncs_cycles_full"] = 0x0006,
["unc_i_rxr_bl_ncs_inserts"] = 0x0003,
["unc_i_rxr_bl_ncs_occupancy"] = 0x0009,
["unc_i_snoop_resp.miss"] = 0x0117,
["unc_i_snoop_resp.hit_i"] = 0x0217,
["unc_i_snoop_resp.hit_es"] = 0x0417,
["unc_i_snoop_resp.hit_m"] = 0x0817,
["unc_i_snoop_resp.snpcode"] = 0x1017,
["unc_i_snoop_resp.snpdata"] = 0x2017,
["unc_i_snoop_resp.snpinv"] = 0x4017,
["unc_i_transactions.reads"] = 0x0116,
["unc_i_transactions.writes"] = 0x0216,
["unc_i_transactions.rd_pref"] = 0x0416,
["unc_i_transactions.wr_pref"] = 0x0816,
["unc_i_transactions.atomic"] = 0x1016,
["unc_i_transactions.other"] = 0x2016,
["unc_i_transactions.orderingq"] = 0x4016,
["unc_i_txr_ad_stall_credit_cycles"] = 0x0018,
["unc_i_txr_bl_stall_credit_cycles"] = 0x0019,
["unc_i_txr_data_inserts_ncb"] = 0x000e,
["unc_i_txr_data_inserts_ncs"] = 0x000f,
["unc_i_txr_request_occupancy"] = 0x000d,
["unc_p_clockticks"] = 0x0000,
["unc_p_core0_transition_cycles"] = 0x0060,
["unc_p_core10_transition_cycles"] = 0x006a,
["unc_p_core11_transition_cycles"] = 0x006b,
["unc_p_core12_transition_cycles"] = 0x006c,
["unc_p_core13_transition_cycles"] = 0x006d,
["unc_p_core14_transition_cycles"] = 0x006e,
["unc_p_core15_transition_cycles"] = 0x006f,
["unc_p_core16_transition_cycles"] = 0x0070,
["unc_p_core17_transition_cycles"] = 0x0071,
["unc_p_core1_transition_cycles"] = 0x0061,
["unc_p_core2_transition_cycles"] = 0x0062,
["unc_p_core3_transition_cycles"] = 0x0063,
["unc_p_core4_transition_cycles"] = 0x0064,
["unc_p_core5_transition_cycles"] = 0x0065,
["unc_p_core6_transition_cycles"] = 0x0066,
["unc_p_core7_transition_cycles"] = 0x0067,
["unc_p_core8_transition_cycles"] = 0x0068,
["unc_p_core9_transition_cycles"] = 0x0069,
["unc_p_demotions_core0"] = 0x0030,
["unc_p_demotions_core1"] = 0x0031,
["unc_p_demotions_core10"] = 0x003a,
["unc_p_demotions_core11"] = 0x003b,
["unc_p_demotions_core12"] = 0x003c,
["unc_p_demotions_core13"] = 0x003d,
["unc_p_demotions_core14"] = 0x003e,
["unc_p_demotions_core15"] = 0x003f,
["unc_p_demotions_core16"] = 0x0040,
["unc_p_demotions_core17"] = 0x0041,
["unc_p_demotions_core2"] = 0x0032,
["unc_p_demotions_core3"] = 0x0033,
["unc_p_demotions_core4"] = 0x0034,
["unc_p_demotions_core5"] = 0x0035,
["unc_p_demotions_core6"] = 0x0036,
["unc_p_demotions_core7"] = 0x0037,
["unc_p_demotions_core8"] = 0x0038,
["unc_p_demotions_core9"] = 0x0039,
["unc_p_freq_band0_cycles"] = 0x000b,
["unc_p_freq_band1_cycles"] = 0x000c,
["unc_p_freq_band2_cycles"] = 0x000d,
["unc_p_freq_band3_cycles"] = 0x000e,
["unc_p_freq_max_limit_thermal_cycles"] = 0x0004,
["unc_p_freq_max_os_cycles"] = 0x0006,
["unc_p_freq_max_power_cycles"] = 0x0005,
["unc_p_freq_min_io_p_cycles"] = 0x0073,
["unc_p_freq_trans_cycles"] = 0x0074,
["unc_p_memory_phase_shedding_cycles"] = 0x002f,
["unc_p_pkg_residency_c0_cycles"] = 0x002a,
["unc_p_pkg_residency_c2e_cycles"] = 0x002b,
["unc_p_pkg_residency_c3_cycles"] = 0x002c,
["unc_p_pkg_residency_c6_cycles"] = 0x002d,
["unc_p_pkg_residency_c7_cycles"] = 0x002e,
["unc_p_power_state_occupancy.cores_c0"] = 0x4080,
["unc_p_power_state_occupancy.cores_c3"] = 0x8080,
["unc_p_power_state_occupancy.cores_c6"] = 0xc080,
["unc_p_prochot_external_cycles"] = 0x000a,
["unc_p_prochot_internal_cycles"] = 0x0009,
["unc_p_total_transition_cycles"] = 0x0072,
["unc_p_ufs_transitions_no_change"] = 0x0079,
["unc_p_vr_hot_cycles"] = 0x0042,
["unc_q_clockticks"] = 0x0014,
["unc_q_cto_count"] = 0x0038,
["unc_q_direct2core.success_rbt_hit"] = 0x0113,
["unc_q_direct2core.failure_credits"] = 0x0213,
["unc_q_direct2core.failure_rbt_hit"] = 0x0413,
["unc_q_direct2core.failure_credits_rbt"] = 0x0813,
["unc_q_direct2core.failure_miss"] = 0x1013,
["unc_q_direct2core.failure_credits_miss"] = 0x2013,
["unc_q_direct2core.failure_rbt_miss"] = 0x4013,
["unc_q_direct2core.failure_credits_rbt_miss"] = 0x8013,
["unc_q_l1_power_cycles"] = 0x0012,
["unc_q_rxl0p_power_cycles"] = 0x0010,
["unc_q_rxl0_power_cycles"] = 0x000f,
["unc_q_rxl_bypassed"] = 0x0009,
["unc_q_rxl_crc_errors.link_init"] = 0x0103,
["unc_q_rxl_crc_errors.normal_op"] = 0x0203,
["unc_q_rxl_credits_consumed_vn0.drs"] = 0x011e,
["unc_q_rxl_credits_consumed_vn0.ncb"] = 0x021e,
["unc_q_rxl_credits_consumed_vn0.ncs"] = 0x041e,
["unc_q_rxl_credits_consumed_vn0.hom"] = 0x081e,
["unc_q_rxl_credits_consumed_vn0.snp"] = 0x101e,
["unc_q_rxl_credits_consumed_vn0.ndr"] = 0x201e,
["unc_q_rxl_credits_consumed_vn1.drs"] = 0x0139,
["unc_q_rxl_credits_consumed_vn1.ncb"] = 0x0239,
["unc_q_rxl_credits_consumed_vn1.ncs"] = 0x0439,
["unc_q_rxl_credits_consumed_vn1.hom"] = 0x0839,
["unc_q_rxl_credits_consumed_vn1.snp"] = 0x1039,
["unc_q_rxl_credits_consumed_vn1.ndr"] = 0x2039,
["unc_q_rxl_credits_consumed_vna"] = 0x001d,
["unc_q_rxl_cycles_ne"] = 0x000a,
["unc_q_rxl_cycles_ne_drs.vn0"] = 0x010f,
["unc_q_rxl_cycles_ne_drs.vn1"] = 0x020f,
["unc_q_rxl_cycles_ne_hom.vn0"] = 0x0112,
["unc_q_rxl_cycles_ne_hom.vn1"] = 0x0212,
["unc_q_rxl_cycles_ne_ncb.vn0"] = 0x0110,
["unc_q_rxl_cycles_ne_ncb.vn1"] = 0x0210,
["unc_q_rxl_cycles_ne_ncs.vn0"] = 0x0111,
["unc_q_rxl_cycles_ne_ncs.vn1"] = 0x0211,
["unc_q_rxl_cycles_ne_ndr.vn0"] = 0x0114,
["unc_q_rxl_cycles_ne_ndr.vn1"] = 0x0214,
["unc_q_rxl_cycles_ne_snp.vn0"] = 0x0113,
["unc_q_rxl_cycles_ne_snp.vn1"] = 0x0213,
["unc_q_rxl_flits_g0.idle"] = 0x0101,
["unc_q_rxl_flits_g1.snp"] = 0x0102,
["unc_q_rxl_flits_g1.hom_req"] = 0x0202,
["unc_q_rxl_flits_g1.hom_nonreq"] = 0x0402,
["unc_q_rxl_flits_g1.hom"] = 0x0602,
["unc_q_rxl_flits_g1.drs_data"] = 0x0802,
["unc_q_rxl_flits_g1.drs_nondata"] = 0x1002,
["unc_q_rxl_flits_g1.drs"] = 0x1802,
["unc_q_rxl_flits_g2.ndr_ad"] = 0x0103,
["unc_q_rxl_flits_g2.ndr_ak"] = 0x0203,
["unc_q_rxl_flits_g2.ncb_data"] = 0x0403,
["unc_q_rxl_flits_g2.ncb_nondata"] = 0x0803,
["unc_q_rxl_flits_g2.ncb"] = 0x0c03,
["unc_q_rxl_flits_g2.ncs"] = 0x1003,
["unc_q_rxl_inserts"] = 0x0008,
["unc_q_rxl_inserts_drs.vn0"] = 0x0109,
["unc_q_rxl_inserts_drs.vn1"] = 0x0209,
["unc_q_rxl_inserts_hom.vn0"] = 0x010c,
["unc_q_rxl_inserts_hom.vn1"] = 0x020c,
["unc_q_rxl_inserts_ncb.vn0"] = 0x010a,
["unc_q_rxl_inserts_ncb.vn1"] = 0x020a,
["unc_q_rxl_inserts_ncs.vn0"] = 0x010b,
["unc_q_rxl_inserts_ncs.vn1"] = 0x020b,
["unc_q_rxl_inserts_ndr.vn0"] = 0x010e,
["unc_q_rxl_inserts_ndr.vn1"] = 0x020e,
["unc_q_rxl_inserts_snp.vn0"] = 0x010d,
["unc_q_rxl_inserts_snp.vn1"] = 0x020d,
["unc_q_rxl_occupancy"] = 0x000b,
["unc_q_rxl_occupancy_drs.vn0"] = 0x0115,
["unc_q_rxl_occupancy_drs.vn1"] = 0x0215,
["unc_q_rxl_occupancy_hom.vn0"] = 0x0118,
["unc_q_rxl_occupancy_hom.vn1"] = 0x0218,
["unc_q_rxl_occupancy_ncb.vn0"] = 0x0116,
["unc_q_rxl_occupancy_ncb.vn1"] = 0x0216,
["unc_q_rxl_occupancy_ncs.vn0"] = 0x0117,
["unc_q_rxl_occupancy_ncs.vn1"] = 0x0217,
["unc_q_rxl_occupancy_ndr.vn0"] = 0x011a,
["unc_q_rxl_occupancy_ndr.vn1"] = 0x021a,
["unc_q_rxl_occupancy_snp.vn0"] = 0x0119,
["unc_q_rxl_occupancy_snp.vn1"] = 0x0219,
["unc_q_rxl_stalls_vn0.bgf_drs"] = 0x0135,
["unc_q_rxl_stalls_vn0.bgf_ncb"] = 0x0235,
["unc_q_rxl_stalls_vn0.bgf_ncs"] = 0x0435,
["unc_q_rxl_stalls_vn0.bgf_hom"] = 0x0835,
["unc_q_rxl_stalls_vn0.bgf_snp"] = 0x1035,
["unc_q_rxl_stalls_vn0.bgf_ndr"] = 0x2035,
["unc_q_rxl_stalls_vn0.egress_credits"] = 0x4035,
["unc_q_rxl_stalls_vn0.gv"] = 0x8035,
["unc_q_rxl_stalls_vn1.bgf_drs"] = 0x013a,
["unc_q_rxl_stalls_vn1.bgf_ncb"] = 0x023a,
["unc_q_rxl_stalls_vn1.bgf_ncs"] = 0x043a,
["unc_q_rxl_stalls_vn1.bgf_hom"] = 0x083a,
["unc_q_rxl_stalls_vn1.bgf_snp"] = 0x103a,
["unc_q_rxl_stalls_vn1.bgf_ndr"] = 0x203a,
["unc_q_txl0p_power_cycles"] = 0x000d,
["unc_q_txl0_power_cycles"] = 0x000c,
["unc_q_txl_bypassed"] = 0x0005,
["unc_q_txl_crc_no_credits.full"] = 0x0102,
["unc_q_txl_crc_no_credits.almost_full"] = 0x0202,
["unc_q_txl_cycles_ne"] = 0x0006,
["unc_q_txl_flits_g0.data"] = 0x0200,
["unc_q_txl_flits_g0.non_data"] = 0x0400,
["unc_q_txl_flits_g1.snp"] = 0x0100,
["unc_q_txl_flits_g1.hom_req"] = 0x0200,
["unc_q_txl_flits_g1.hom_nonreq"] = 0x0400,
["unc_q_txl_flits_g1.hom"] = 0x0600,
["unc_q_txl_flits_g1.drs_data"] = 0x0800,
["unc_q_txl_flits_g1.drs_nondata"] = 0x1000,
["unc_q_txl_flits_g1.drs"] = 0x1800,
["unc_q_txl_flits_g2.ndr_ad"] = 0x0101,
["unc_q_txl_flits_g2.ndr_ak"] = 0x0201,
["unc_q_txl_flits_g2.ncb_data"] = 0x0401,
["unc_q_txl_flits_g2.ncb_nondata"] = 0x0801,
["unc_q_txl_flits_g2.ncb"] = 0x0c01,
["unc_q_txl_flits_g2.ncs"] = 0x1001,
["unc_q_txl_inserts"] = 0x0004,
["unc_q_txl_occupancy"] = 0x0007,
["unc_q_txr_ad_hom_credit_acquired.vn0"] = 0x0126,
["unc_q_txr_ad_hom_credit_acquired.vn1"] = 0x0226,
["unc_q_txr_ad_hom_credit_occupancy.vn0"] = 0x0122,
["unc_q_txr_ad_hom_credit_occupancy.vn1"] = 0x0222,
["unc_q_txr_ad_ndr_credit_acquired.vn0"] = 0x0128,
["unc_q_txr_ad_ndr_credit_acquired.vn1"] = 0x0228,
["unc_q_txr_ad_ndr_credit_occupancy.vn0"] = 0x0124,
["unc_q_txr_ad_ndr_credit_occupancy.vn1"] = 0x0224,
["unc_q_txr_ad_snp_credit_acquired.vn0"] = 0x0127,
["unc_q_txr_ad_snp_credit_acquired.vn1"] = 0x0227,
["unc_q_txr_ad_snp_credit_occupancy.vn0"] = 0x0123,
["unc_q_txr_ad_snp_credit_occupancy.vn1"] = 0x0223,
["unc_q_txr_ak_ndr_credit_acquired"] = 0x0029,
["unc_q_txr_ak_ndr_credit_occupancy"] = 0x0025,
["unc_q_txr_bl_drs_credit_acquired.vn0"] = 0x012a,
["unc_q_txr_bl_drs_credit_acquired.vn1"] = 0x022a,
["unc_q_txr_bl_drs_credit_acquired.vn_shr"] = 0x042a,
["unc_q_txr_bl_drs_credit_occupancy.vn0"] = 0x011f,
["unc_q_txr_bl_drs_credit_occupancy.vn1"] = 0x021f,
["unc_q_txr_bl_drs_credit_occupancy.vn_shr"] = 0x041f,
["unc_q_txr_bl_ncb_credit_acquired.vn0"] = 0x012b,
["unc_q_txr_bl_ncb_credit_acquired.vn1"] = 0x022b,
["unc_q_txr_bl_ncb_credit_occupancy.vn0"] = 0x0120,
["unc_q_txr_bl_ncb_credit_occupancy.vn1"] = 0x0220,
["unc_q_txr_bl_ncs_credit_acquired.vn0"] = 0x012c,
["unc_q_txr_bl_ncs_credit_acquired.vn1"] = 0x022c,
["unc_q_txr_bl_ncs_credit_occupancy.vn0"] = 0x0121,
["unc_q_txr_bl_ncs_credit_occupancy.vn1"] = 0x0221,
["unc_q_vna_credit_returns"] = 0x001c,
["unc_q_vna_credit_return_occupancy"] = 0x001b,
["unc_r2_clockticks"] = 0x0001,
["unc_r2_iio_credit.prq_qpi0"] = 0x012d,
["unc_r2_iio_credit.prq_qpi1"] = 0x022d,
["unc_r2_iio_credit.isoch_qpi0"] = 0x042d,
["unc_r2_iio_credit.isoch_qpi1"] = 0x082d,
["unc_r2_iio_credits_acquired.drs"] = 0x0833,
["unc_r2_iio_credits_acquired.ncb"] = 0x1033,
["unc_r2_iio_credits_acquired.ncs"] = 0x2033,
["unc_r2_iio_credits_used.drs"] = 0x0832,
["unc_r2_iio_credits_used.ncb"] = 0x1032,
["unc_r2_iio_credits_used.ncs"] = 0x2032,
["unc_r2_ring_ad_used.cw_even"] = 0x0107,
["unc_r2_ring_ad_used.cw_odd"] = 0x0207,
["unc_r2_ring_ad_used.ccw_even"] = 0x0407,
["unc_r2_ring_ad_used.ccw_odd"] = 0x0807,
["unc_r2_ring_ad_used.cw"] = 0x0307,
["unc_r2_ring_ad_used.ccw"] = 0x0c07,
["unc_r2_ring_ak_bounces.up"] = 0x0112,
["unc_r2_ring_ak_bounces.dn"] = 0x0212,
["unc_r2_ring_ak_used.cw_even"] = 0x0108,
["unc_r2_ring_ak_used.cw_odd"] = 0x0208,
["unc_r2_ring_ak_used.ccw_even"] = 0x0408,
["unc_r2_ring_ak_used.ccw_odd"] = 0x0808,
["unc_r2_ring_ak_used.cw"] = 0x0308,
["unc_r2_ring_ak_used.ccw"] = 0x0c08,
["unc_r2_ring_bl_used.cw_even"] = 0x0109,
["unc_r2_ring_bl_used.cw_odd"] = 0x0209,
["unc_r2_ring_bl_used.ccw_even"] = 0x0409,
["unc_r2_ring_bl_used.ccw_odd"] = 0x0809,
["unc_r2_ring_bl_used.cw"] = 0x0309,
["unc_r2_ring_bl_used.ccw"] = 0x0c09,
["unc_r2_ring_iv_used.cw"] = 0x030a,
["unc_r2_ring_iv_used.ccw"] = 0x0c0a,
["unc_r2_ring_iv_used.any"] = 0x0f0a,
["unc_r2_rxr_cycles_ne.ncb"] = 0x1010,
["unc_r2_rxr_cycles_ne.ncs"] = 0x2010,
["unc_r2_rxr_inserts.ncb"] = 0x1011,
["unc_r2_rxr_inserts.ncs"] = 0x2011,
["unc_r2_rxr_occupancy.drs"] = 0x0813,
["unc_r2_sbo0_credits_acquired.ad"] = 0x0128,
["unc_r2_sbo0_credits_acquired.bl"] = 0x0228,
["unc_r2_sbo0_credit_occupancy.ad"] = 0x012a,
["unc_r2_sbo0_credit_occupancy.bl"] = 0x022a,
["unc_r2_stall_no_sbo_credit.sbo0_ad"] = 0x012c,
["unc_r2_stall_no_sbo_credit.sbo1_ad"] = 0x022c,
["unc_r2_stall_no_sbo_credit.sbo0_bl"] = 0x042c,
["unc_r2_stall_no_sbo_credit.sbo1_bl"] = 0x082c,
["unc_r2_txr_cycles_full.ad"] = 0x0125,
["unc_r2_txr_cycles_full.ak"] = 0x0225,
["unc_r2_txr_cycles_full.bl"] = 0x0425,
["unc_r2_txr_cycles_ne.ad"] = 0x0123,
["unc_r2_txr_cycles_ne.ak"] = 0x0223,
["unc_r2_txr_cycles_ne.bl"] = 0x0423,
["unc_r2_txr_nack_cw.dn_ad"] = 0x0126,
["unc_r2_txr_nack_cw.dn_bl"] = 0x0226,
["unc_r2_txr_nack_cw.dn_ak"] = 0x0426,
["unc_r2_txr_nack_cw.up_ad"] = 0x0826,
["unc_r2_txr_nack_cw.up_bl"] = 0x1026,
["unc_r2_txr_nack_cw.up_ak"] = 0x2026,
["unc_r3_clockticks"] = 0x0001,
["unc_r3_c_hi_ad_credits_empty.cbo8"] = 0x011f,
["unc_r3_c_hi_ad_credits_empty.cbo9"] = 0x021f,
["unc_r3_c_hi_ad_credits_empty.cbo10"] = 0x041f,
["unc_r3_c_hi_ad_credits_empty.cbo11"] = 0x081f,
["unc_r3_c_hi_ad_credits_empty.cbo12"] = 0x101f,
["unc_r3_c_hi_ad_credits_empty.cbo13"] = 0x201f,
["unc_r3_c_hi_ad_credits_empty.cbo14_16"] = 0x401f,
["unc_r3_c_hi_ad_credits_empty.cbo_15_17"] = 0x801f,
["unc_r3_c_lo_ad_credits_empty.cbo0"] = 0x0122,
["unc_r3_c_lo_ad_credits_empty.cbo1"] = 0x0222,
["unc_r3_c_lo_ad_credits_empty.cbo2"] = 0x0422,
["unc_r3_c_lo_ad_credits_empty.cbo3"] = 0x0822,
["unc_r3_c_lo_ad_credits_empty.cbo4"] = 0x1022,
["unc_r3_c_lo_ad_credits_empty.cbo5"] = 0x2022,
["unc_r3_c_lo_ad_credits_empty.cbo6"] = 0x4022,
["unc_r3_c_lo_ad_credits_empty.cbo7"] = 0x8022,
["unc_r3_ha_r2_bl_credits_empty.ha0"] = 0x012d,
["unc_r3_ha_r2_bl_credits_empty.ha1"] = 0x022d,
["unc_r3_ha_r2_bl_credits_empty.r2_ncb"] = 0x042d,
["unc_r3_ha_r2_bl_credits_empty.r2_ncs"] = 0x082d,
["unc_r3_iot_backpressure.sat"] = 0x010b,
["unc_r3_iot_backpressure.hub"] = 0x020b,
["unc_r3_iot_cts_hi.cts2"] = 0x010d,
["unc_r3_iot_cts_hi.cts3"] = 0x020d,
["unc_r3_iot_cts_lo.cts0"] = 0x010c,
["unc_r3_iot_cts_lo.cts1"] = 0x020c,
["unc_r3_qpi0_ad_credits_empty.vna"] = 0x0120,
["unc_r3_qpi0_ad_credits_empty.vn0_hom"] = 0x0220,
["unc_r3_qpi0_ad_credits_empty.vn0_snp"] = 0x0420,
["unc_r3_qpi0_ad_credits_empty.vn0_ndr"] = 0x0820,
["unc_r3_qpi0_ad_credits_empty.vn1_hom"] = 0x1020,
["unc_r3_qpi0_ad_credits_empty.vn1_snp"] = 0x2020,
["unc_r3_qpi0_ad_credits_empty.vn1_ndr"] = 0x4020,
["unc_r3_qpi0_bl_credits_empty.vna"] = 0x0121,
["unc_r3_qpi0_bl_credits_empty.vn1_hom"] = 0x1021,
["unc_r3_qpi0_bl_credits_empty.vn1_snp"] = 0x2021,
["unc_r3_qpi0_bl_credits_empty.vn1_ndr"] = 0x4021,
["unc_r3_qpi1_ad_credits_empty.vna"] = 0x012e,
["unc_r3_qpi1_ad_credits_empty.vn1_hom"] = 0x102e,
["unc_r3_qpi1_ad_credits_empty.vn1_snp"] = 0x202e,
["unc_r3_qpi1_ad_credits_empty.vn1_ndr"] = 0x402e,
["unc_r3_qpi1_bl_credits_empty.vna"] = 0x012f,
["unc_r3_qpi1_bl_credits_empty.vn0_hom"] = 0x022f,
["unc_r3_qpi1_bl_credits_empty.vn0_snp"] = 0x042f,
["unc_r3_qpi1_bl_credits_empty.vn0_ndr"] = 0x082f,
["unc_r3_qpi1_bl_credits_empty.vn1_hom"] = 0x102f,
["unc_r3_qpi1_bl_credits_empty.vn1_snp"] = 0x202f,
["unc_r3_qpi1_bl_credits_empty.vn1_ndr"] = 0x402f,
["unc_r3_ring_ad_used.cw_even"] = 0x0107,
["unc_r3_ring_ad_used.cw_odd"] = 0x0207,
["unc_r3_ring_ad_used.ccw_even"] = 0x0407,
["unc_r3_ring_ad_used.ccw_odd"] = 0x0807,
["unc_r3_ring_ad_used.cw"] = 0x0307,
["unc_r3_ring_ad_used.ccw"] = 0x0c07,
["unc_r3_ring_ak_used.cw_even"] = 0x0108,
["unc_r3_ring_ak_used.cw_odd"] = 0x0208,
["unc_r3_ring_ak_used.ccw_even"] = 0x0408,
["unc_r3_ring_ak_used.ccw_odd"] = 0x0808,
["unc_r3_ring_ak_used.cw"] = 0x0308,
["unc_r3_ring_ak_used.ccw"] = 0x0c08,
["unc_r3_ring_bl_used.cw_even"] = 0x0109,
["unc_r3_ring_bl_used.cw_odd"] = 0x0209,
["unc_r3_ring_bl_used.ccw_even"] = 0x0409,
["unc_r3_ring_bl_used.ccw_odd"] = 0x0809,
["unc_r3_ring_bl_used.cw"] = 0x0309,
["unc_r3_ring_bl_used.ccw"] = 0x0c09,
["unc_r3_ring_iv_used.cw"] = 0x030a,
["unc_r3_ring_iv_used.any"] = 0x0f0a,
["unc_r3_ring_sink_starved.ak"] = 0x020e,
["unc_r3_rxr_cycles_ne.hom"] = 0x0110,
["unc_r3_rxr_cycles_ne.snp"] = 0x0210,
["unc_r3_rxr_cycles_ne.ndr"] = 0x0410,
["unc_r3_rxr_cycles_ne_vn1.hom"] = 0x0114,
["unc_r3_rxr_cycles_ne_vn1.snp"] = 0x0214,
["unc_r3_rxr_cycles_ne_vn1.ndr"] = 0x0414,
["unc_r3_rxr_cycles_ne_vn1.drs"] = 0x0814,
["unc_r3_rxr_cycles_ne_vn1.ncb"] = 0x1014,
["unc_r3_rxr_cycles_ne_vn1.ncs"] = 0x2014,
["unc_r3_rxr_inserts.hom"] = 0x0111,
["unc_r3_rxr_inserts.snp"] = 0x0211,
["unc_r3_rxr_inserts.ndr"] = 0x0411,
["unc_r3_rxr_inserts.drs"] = 0x0811,
["unc_r3_rxr_inserts.ncb"] = 0x1011,
["unc_r3_rxr_inserts.ncs"] = 0x2011,
["unc_r3_rxr_inserts_vn1.hom"] = 0x0115,
["unc_r3_rxr_inserts_vn1.snp"] = 0x0215,
["unc_r3_rxr_inserts_vn1.ndr"] = 0x0415,
["unc_r3_rxr_inserts_vn1.drs"] = 0x0815,
["unc_r3_rxr_inserts_vn1.ncb"] = 0x1015,
["unc_r3_rxr_inserts_vn1.ncs"] = 0x2015,
["unc_r3_rxr_occupancy_vn1.hom"] = 0x0113,
["unc_r3_rxr_occupancy_vn1.snp"] = 0x0213,
["unc_r3_rxr_occupancy_vn1.ndr"] = 0x0413,
["unc_r3_rxr_occupancy_vn1.drs"] = 0x0813,
["unc_r3_rxr_occupancy_vn1.ncb"] = 0x1013,
["unc_r3_rxr_occupancy_vn1.ncs"] = 0x2013,
["unc_r3_sbo0_credits_acquired.ad"] = 0x0128,
["unc_r3_sbo0_credits_acquired.bl"] = 0x0228,
["unc_r3_sbo0_credit_occupancy.ad"] = 0x012a,
["unc_r3_sbo0_credit_occupancy.bl"] = 0x022a,
["unc_r3_sbo1_credits_acquired.ad"] = 0x0129,
["unc_r3_sbo1_credits_acquired.bl"] = 0x0229,
["unc_r3_sbo1_credit_occupancy.ad"] = 0x012b,
["unc_r3_sbo1_credit_occupancy.bl"] = 0x022b,
["unc_r3_stall_no_sbo_credit.sbo0_ad"] = 0x012c,
["unc_r3_stall_no_sbo_credit.sbo1_ad"] = 0x022c,
["unc_r3_stall_no_sbo_credit.sbo0_bl"] = 0x042c,
["unc_r3_stall_no_sbo_credit.sbo1_bl"] = 0x082c,
["unc_r3_txr_nack.dn_ad"] = 0x0126,
["unc_r3_txr_nack.dn_bl"] = 0x0226,
["unc_r3_txr_nack.dn_ak"] = 0x0426,
["unc_r3_txr_nack.up_ad"] = 0x0826,
["unc_r3_txr_nack.up_bl"] = 0x1026,
["unc_r3_txr_nack.up_ak"] = 0x2026,
["unc_r3_vn0_credits_reject.hom"] = 0x0137,
["unc_r3_vn0_credits_reject.snp"] = 0x0237,
["unc_r3_vn0_credits_reject.ndr"] = 0x0437,
["unc_r3_vn0_credits_reject.drs"] = 0x0837,
["unc_r3_vn0_credits_reject.ncb"] = 0x1037,
["unc_r3_vn0_credits_reject.ncs"] = 0x2037,
["unc_r3_vn0_credits_used.hom"] = 0x0136,
["unc_r3_vn0_credits_used.snp"] = 0x0236,
["unc_r3_vn0_credits_used.ndr"] = 0x0436,
["unc_r3_vn0_credits_used.drs"] = 0x0836,
["unc_r3_vn0_credits_used.ncb"] = 0x1036,
["unc_r3_vn0_credits_used.ncs"] = 0x2036,
["unc_r3_vn1_credits_reject.hom"] = 0x0139,
["unc_r3_vn1_credits_reject.snp"] = 0x0239,
["unc_r3_vn1_credits_reject.ndr"] = 0x0439,
["unc_r3_vn1_credits_reject.drs"] = 0x0839,
["unc_r3_vn1_credits_reject.ncb"] = 0x1039,
["unc_r3_vn1_credits_reject.ncs"] = 0x2039,
["unc_r3_vn1_credits_used.hom"] = 0x0138,
["unc_r3_vn1_credits_used.snp"] = 0x0238,
["unc_r3_vn1_credits_used.ndr"] = 0x0438,
["unc_r3_vn1_credits_used.drs"] = 0x0838,
["unc_r3_vn1_credits_used.ncb"] = 0x1038,
["unc_r3_vn1_credits_used.ncs"] = 0x2038,
["unc_r3_vna_credits_acquired.ad"] = 0x0133,
["unc_r3_vna_credits_acquired.bl"] = 0x0433,
["unc_r3_vna_credits_reject.hom"] = 0x0134,
["unc_r3_vna_credits_reject.snp"] = 0x0234,
["unc_r3_vna_credits_reject.ndr"] = 0x0434,
["unc_r3_vna_credits_reject.drs"] = 0x0834,
["unc_r3_vna_credits_reject.ncb"] = 0x1034,
["unc_r3_vna_credits_reject.ncs"] = 0x2034,
["unc_s_bounce_control"] = 0x000a,
["unc_s_clockticks"] = 0x0000,
["unc_s_fast_asserted"] = 0x0009,
["unc_s_ring_ad_used.up_even"] = 0x011b,
["unc_s_ring_ad_used.up_odd"] = 0x021b,
["unc_s_ring_ad_used.down_even"] = 0x041b,
["unc_s_ring_ad_used.down_odd"] = 0x081b,
["unc_s_ring_ad_used.up"] = 0x031b,
["unc_s_ring_ad_used.down"] = 0x0c1b,
["unc_s_ring_ak_used.up_even"] = 0x011c,
["unc_s_ring_ak_used.up_odd"] = 0x021c,
["unc_s_ring_ak_used.down_even"] = 0x041c,
["unc_s_ring_ak_used.down_odd"] = 0x081c,
["unc_s_ring_ak_used.up"] = 0x031c,
["unc_s_ring_ak_used.down"] = 0x0c1c,
["unc_s_ring_bl_used.up_even"] = 0x011d,
["unc_s_ring_bl_used.up_odd"] = 0x021d,
["unc_s_ring_bl_used.down_even"] = 0x041d,
["unc_s_ring_bl_used.down_odd"] = 0x081d,
["unc_s_ring_bl_used.up"] = 0x031d,
["unc_s_ring_bl_used.down"] = 0x0c1d,
["unc_s_ring_bounces.ad_cache"] = 0x0105,
["unc_s_ring_bounces.ak_core"] = 0x0205,
["unc_s_ring_bounces.bl_core"] = 0x0405,
["unc_s_ring_bounces.iv_core"] = 0x0805,
["unc_s_ring_iv_used.up"] = 0x031e,
["unc_s_ring_iv_used.dn"] = 0x0c1e,
["unc_s_ring_sink_starved.ad_cache"] = 0x0106,
["unc_s_ring_sink_starved.ak_core"] = 0x0206,
["unc_s_ring_sink_starved.bl_core"] = 0x0406,
["unc_s_ring_sink_starved.iv_core"] = 0x0806,
["unc_s_rxr_busy_starved.ad_crd"] = 0x0115,
["unc_s_rxr_busy_starved.ad_bnc"] = 0x0215,
["unc_s_rxr_busy_starved.bl_crd"] = 0x0415,
["unc_s_rxr_busy_starved.bl_bnc"] = 0x0815,
["unc_s_rxr_bypass.ad_crd"] = 0x0112,
["unc_s_rxr_bypass.ad_bnc"] = 0x0212,
["unc_s_rxr_bypass.bl_crd"] = 0x0412,
["unc_s_rxr_bypass.bl_bnc"] = 0x0812,
["unc_s_rxr_bypass.ak"] = 0x1012,
["unc_s_rxr_bypass.iv"] = 0x2012,
["unc_s_rxr_crd_starved.ad_crd"] = 0x0114,
["unc_s_rxr_crd_starved.ad_bnc"] = 0x0214,
["unc_s_rxr_crd_starved.bl_crd"] = 0x0414,
["unc_s_rxr_crd_starved.bl_bnc"] = 0x0814,
["unc_s_rxr_crd_starved.ak"] = 0x1014,
["unc_s_rxr_crd_starved.iv"] = 0x2014,
["unc_s_rxr_crd_starved.ifv"] = 0x4014,
["unc_s_rxr_inserts.ad_crd"] = 0x0113,
["unc_s_rxr_inserts.ad_bnc"] = 0x0213,
["unc_s_rxr_inserts.bl_crd"] = 0x0413,
["unc_s_rxr_inserts.bl_bnc"] = 0x0813,
["unc_s_rxr_inserts.ak"] = 0x1013,
["unc_s_rxr_inserts.iv"] = 0x2013,
["unc_s_rxr_occupancy.ad_crd"] = 0x0111,
["unc_s_rxr_occupancy.ad_bnc"] = 0x0211,
["unc_s_rxr_occupancy.bl_crd"] = 0x0411,
["unc_s_rxr_occupancy.bl_bnc"] = 0x0811,
["unc_s_rxr_occupancy.ak"] = 0x1011,
["unc_s_rxr_occupancy.iv"] = 0x2011,
["unc_s_txr_ads_used.ad"] = 0x0104,
["unc_s_txr_ads_used.ak"] = 0x0204,
["unc_s_txr_ads_used.bl"] = 0x0404,
["unc_s_txr_inserts.ad_crd"] = 0x0102,
["unc_s_txr_inserts.ad_bnc"] = 0x0202,
["unc_s_txr_inserts.bl_crd"] = 0x0402,
["unc_s_txr_inserts.bl_bnc"] = 0x0802,
["unc_s_txr_inserts.ak"] = 0x1002,
["unc_s_txr_inserts.iv"] = 0x2002,
["unc_s_txr_occupancy.ad_crd"] = 0x0101,
["unc_s_txr_occupancy.ad_bnc"] = 0x0201,
["unc_s_txr_occupancy.bl_crd"] = 0x0401,
["unc_s_txr_occupancy.bl_bnc"] = 0x0801,
["unc_s_txr_occupancy.ak"] = 0x1001,
["unc_s_txr_occupancy.iv"] = 0x2001,
["unc_s_txr_starved.ad"] = 0x0103,
["unc_s_txr_starved.ak"] = 0x0203,
["unc_s_txr_starved.bl"] = 0x0403,
["unc_s_txr_starved.iv"] = 0x0803,
["unc_u_event_msg.doorbell_rcvd"] = 0x0842,
["unc_u_filter_match.enable"] = 0x0141,
["unc_u_filter_match.disable"] = 0x0241,
["unc_u_filter_match.u2c_enable"] = 0x0441,
["unc_u_filter_match.u2c_disable"] = 0x0841,
["unc_u_phold_cycles.assert_to_ack"] = 0x0145,
["unc_u_racu_requests"] = 0x0046,
["unc_u_u2c_events.monitor_t0"] = 0x0143,
["unc_u_u2c_events.monitor_t1"] = 0x0243,
["unc_u_u2c_events.livelock"] = 0x0443,
["unc_u_u2c_events.lterror"] = 0x0843,
["unc_u_u2c_events.cmc"] = 0x1043,
["unc_u_u2c_events.umc"] = 0x2043,
["unc_u_u2c_events.trap"] = 0x4043,
["unc_u_u2c_events.other"] = 0x8043,
["unc_m_act_count.rd"] = 0x0101,
["unc_m_act_count.wr"] = 0x0201,
["unc_m_act_count.byp"] = 0x0801,
["unc_m_byp_cmds.act"] = 0x01a1,
["unc_m_byp_cmds.cas"] = 0x02a1,
["unc_m_byp_cmds.pre"] = 0x04a1,
["unc_m_cas_count.rd_reg"] = 0x0104,
["unc_m_cas_count.rd_underfill"] = 0x0204,
["unc_m_cas_count.rd"] = 0x0304,
["unc_m_cas_count.wr_wmm"] = 0x0404,
["unc_m_cas_count.wr_rmm"] = 0x0804,
["unc_m_cas_count.wr"] = 0x0c04,
["unc_m_cas_count.all"] = 0x0f04,
["unc_m_cas_count.rd_wmm"] = 0x1004,
["unc_m_cas_count.rd_rmm"] = 0x2004,
["unc_m_clockticks"] = 0x0000,
["unc_m_dram_pre_all"] = 0x0006,
["unc_m_dram_refresh.panic"] = 0x0205,
["unc_m_dram_refresh.high"] = 0x0405,
["unc_m_ecc_correctable_errors"] = 0x0009,
["unc_m_major_modes.read"] = 0x0107,
["unc_m_major_modes.write"] = 0x0207,
["unc_m_major_modes.partial"] = 0x0407,
["unc_m_major_modes.isoch"] = 0x0807,
["unc_m_power_channel_dlloff"] = 0x0084,
["unc_m_power_channel_ppd"] = 0x0085,
["unc_m_power_cke_cycles.rank0"] = 0x0183,
["unc_m_power_cke_cycles.rank1"] = 0x0283,
["unc_m_power_cke_cycles.rank2"] = 0x0483,
["unc_m_power_cke_cycles.rank3"] = 0x0883,
["unc_m_power_cke_cycles.rank4"] = 0x1083,
["unc_m_power_cke_cycles.rank5"] = 0x2083,
["unc_m_power_cke_cycles.rank6"] = 0x4083,
["unc_m_power_cke_cycles.rank7"] = 0x8083,
["unc_m_power_critical_throttle_cycles"] = 0x0086,
["unc_m_power_pcu_throttling"] = 0x0042,
["unc_m_power_self_refresh"] = 0x0043,
["unc_m_power_throttle_cycles.rank0"] = 0x0141,
["unc_m_power_throttle_cycles.rank1"] = 0x0241,
["unc_m_power_throttle_cycles.rank2"] = 0x0441,
["unc_m_power_throttle_cycles.rank3"] = 0x0841,
["unc_m_power_throttle_cycles.rank4"] = 0x1041,
["unc_m_power_throttle_cycles.rank5"] = 0x2041,
["unc_m_power_throttle_cycles.rank6"] = 0x4041,
["unc_m_power_throttle_cycles.rank7"] = 0x8041,
["unc_m_preemption.rd_preempt_rd"] = 0x0108,
["unc_m_preemption.rd_preempt_wr"] = 0x0208,
["unc_m_pre_count.page_miss"] = 0x0102,
["unc_m_pre_count.page_close"] = 0x0202,
["unc_m_pre_count.rd"] = 0x0402,
["unc_m_pre_count.wr"] = 0x0802,
["unc_m_pre_count.byp"] = 0x1002,
["unc_m_rd_cas_prio.low"] = 0x01a0,
["unc_m_rd_cas_prio.med"] = 0x02a0,
["unc_m_rd_cas_prio.high"] = 0x04a0,
["unc_m_rd_cas_prio.panic"] = 0x08a0,
["unc_m_rd_cas_rank0.bank1"] = 0x01b0,
["unc_m_rd_cas_rank0.bank2"] = 0x02b0,
["unc_m_rd_cas_rank0.bank4"] = 0x04b0,
["unc_m_rd_cas_rank0.bank8"] = 0x08b0,
["unc_m_rd_cas_rank0.allbanks"] = 0x10b0,
["unc_m_rd_cas_rank0.bank0"] = 0x00b0,
["unc_m_rd_cas_rank0.bank3"] = 0x03b0,
["unc_m_rd_cas_rank0.bank5"] = 0x05b0,
["unc_m_rd_cas_rank0.bank6"] = 0x06b0,
["unc_m_rd_cas_rank0.bank7"] = 0x07b0,
["unc_m_rd_cas_rank0.bank9"] = 0x09b0,
["unc_m_rd_cas_rank0.bank10"] = 0x0ab0,
["unc_m_rd_cas_rank0.bank11"] = 0x0bb0,
["unc_m_rd_cas_rank0.bank12"] = 0x0cb0,
["unc_m_rd_cas_rank0.bank13"] = 0x0db0,
["unc_m_rd_cas_rank0.bank14"] = 0x0eb0,
["unc_m_rd_cas_rank0.bank15"] = 0x0fb0,
["unc_m_rd_cas_rank0.bankg0"] = 0x11b0,
["unc_m_rd_cas_rank0.bankg1"] = 0x12b0,
["unc_m_rd_cas_rank0.bankg2"] = 0x13b0,
["unc_m_rd_cas_rank0.bankg3"] = 0x14b0,
["unc_m_rd_cas_rank1.bank1"] = 0x01b1,
["unc_m_rd_cas_rank1.bank2"] = 0x02b1,
["unc_m_rd_cas_rank1.bank4"] = 0x04b1,
["unc_m_rd_cas_rank1.bank8"] = 0x08b1,
["unc_m_rd_cas_rank1.allbanks"] = 0x10b1,
["unc_m_rd_cas_rank1.bank0"] = 0x00b1,
["unc_m_rd_cas_rank1.bank3"] = 0x03b1,
["unc_m_rd_cas_rank1.bank5"] = 0x05b1,
["unc_m_rd_cas_rank1.bank6"] = 0x06b1,
["unc_m_rd_cas_rank1.bank7"] = 0x07b1,
["unc_m_rd_cas_rank1.bank9"] = 0x09b1,
["unc_m_rd_cas_rank1.bank10"] = 0x0ab1,
["unc_m_rd_cas_rank1.bank11"] = 0x0bb1,
["unc_m_rd_cas_rank1.bank12"] = 0x0cb1,
["unc_m_rd_cas_rank1.bank13"] = 0x0db1,
["unc_m_rd_cas_rank1.bank14"] = 0x0eb1,
["unc_m_rd_cas_rank1.bank15"] = 0x0fb1,
["unc_m_rd_cas_rank1.bankg0"] = 0x11b1,
["unc_m_rd_cas_rank1.bankg1"] = 0x12b1,
["unc_m_rd_cas_rank1.bankg2"] = 0x13b1,
["unc_m_rd_cas_rank1.bankg3"] = 0x14b1,
["unc_m_rd_cas_rank2.bank0"] = 0x00b2,
["unc_m_rd_cas_rank4.bank1"] = 0x01b4,
["unc_m_rd_cas_rank4.bank2"] = 0x02b4,
["unc_m_rd_cas_rank4.bank4"] = 0x04b4,
["unc_m_rd_cas_rank4.bank8"] = 0x08b4,
["unc_m_rd_cas_rank4.allbanks"] = 0x10b4,
["unc_m_rd_cas_rank4.bank0"] = 0x00b4,
["unc_m_rd_cas_rank4.bank3"] = 0x03b4,
["unc_m_rd_cas_rank4.bank5"] = 0x05b4,
["unc_m_rd_cas_rank4.bank6"] = 0x06b4,
["unc_m_rd_cas_rank4.bank7"] = 0x07b4,
["unc_m_rd_cas_rank4.bank9"] = 0x09b4,
["unc_m_rd_cas_rank4.bank10"] = 0x0ab4,
["unc_m_rd_cas_rank4.bank11"] = 0x0bb4,
["unc_m_rd_cas_rank4.bank12"] = 0x0cb4,
["unc_m_rd_cas_rank4.bank13"] = 0x0db4,
["unc_m_rd_cas_rank4.bank14"] = 0x0eb4,
["unc_m_rd_cas_rank4.bank15"] = 0x0fb4,
["unc_m_rd_cas_rank4.bankg0"] = 0x11b4,
["unc_m_rd_cas_rank4.bankg1"] = 0x12b4,
["unc_m_rd_cas_rank4.bankg2"] = 0x13b4,
["unc_m_rd_cas_rank4.bankg3"] = 0x14b4,
["unc_m_rd_cas_rank5.bank1"] = 0x01b5,
["unc_m_rd_cas_rank5.bank2"] = 0x02b5,
["unc_m_rd_cas_rank5.bank4"] = 0x04b5,
["unc_m_rd_cas_rank5.bank8"] = 0x08b5,
["unc_m_rd_cas_rank5.allbanks"] = 0x10b5,
["unc_m_rd_cas_rank5.bank0"] = 0x00b5,
["unc_m_rd_cas_rank5.bank3"] = 0x03b5,
["unc_m_rd_cas_rank5.bank5"] = 0x05b5,
["unc_m_rd_cas_rank5.bank6"] = 0x06b5,
["unc_m_rd_cas_rank5.bank7"] = 0x07b5,
["unc_m_rd_cas_rank5.bank9"] = 0x09b5,
["unc_m_rd_cas_rank5.bank10"] = 0x0ab5,
["unc_m_rd_cas_rank5.bank11"] = 0x0bb5,
["unc_m_rd_cas_rank5.bank12"] = 0x0cb5,
["unc_m_rd_cas_rank5.bank13"] = 0x0db5,
["unc_m_rd_cas_rank5.bank14"] = 0x0eb5,
["unc_m_rd_cas_rank5.bank15"] = 0x0fb5,
["unc_m_rd_cas_rank5.bankg0"] = 0x11b5,
["unc_m_rd_cas_rank5.bankg1"] = 0x12b5,
["unc_m_rd_cas_rank5.bankg2"] = 0x13b5,
["unc_m_rd_cas_rank5.bankg3"] = 0x14b5,
["unc_m_rd_cas_rank6.bank1"] = 0x01b6,
["unc_m_rd_cas_rank6.bank2"] = 0x02b6,
["unc_m_rd_cas_rank6.bank4"] = 0x04b6,
["unc_m_rd_cas_rank6.bank8"] = 0x08b6,
["unc_m_rd_cas_rank6.allbanks"] = 0x10b6,
["unc_m_rd_cas_rank6.bank0"] = 0x00b6,
["unc_m_rd_cas_rank6.bank3"] = 0x03b6,
["unc_m_rd_cas_rank6.bank5"] = 0x05b6,
["unc_m_rd_cas_rank6.bank6"] = 0x06b6,
["unc_m_rd_cas_rank6.bank7"] = 0x07b6,
["unc_m_rd_cas_rank6.bank9"] = 0x09b6,
["unc_m_rd_cas_rank6.bank10"] = 0x0ab6,
["unc_m_rd_cas_rank6.bank11"] = 0x0bb6,
["unc_m_rd_cas_rank6.bank12"] = 0x0cb6,
["unc_m_rd_cas_rank6.bank13"] = 0x0db6,
["unc_m_rd_cas_rank6.bank14"] = 0x0eb6,
["unc_m_rd_cas_rank6.bank15"] = 0x0fb6,
["unc_m_rd_cas_rank6.bankg0"] = 0x11b6,
["unc_m_rd_cas_rank6.bankg1"] = 0x12b6,
["unc_m_rd_cas_rank6.bankg2"] = 0x13b6,
["unc_m_rd_cas_rank6.bankg3"] = 0x14b6,
["unc_m_rd_cas_rank7.bank1"] = 0x01b7,
["unc_m_rd_cas_rank7.bank2"] = 0x02b7,
["unc_m_rd_cas_rank7.bank4"] = 0x04b7,
["unc_m_rd_cas_rank7.bank8"] = 0x08b7,
["unc_m_rd_cas_rank7.allbanks"] = 0x10b7,
["unc_m_rd_cas_rank7.bank0"] = 0x00b7,
["unc_m_rd_cas_rank7.bank3"] = 0x03b7,
["unc_m_rd_cas_rank7.bank5"] = 0x05b7,
["unc_m_rd_cas_rank7.bank6"] = 0x06b7,
["unc_m_rd_cas_rank7.bank7"] = 0x07b7,
["unc_m_rd_cas_rank7.bank9"] = 0x09b7,
["unc_m_rd_cas_rank7.bank10"] = 0x0ab7,
["unc_m_rd_cas_rank7.bank11"] = 0x0bb7,
["unc_m_rd_cas_rank7.bank12"] = 0x0cb7,
["unc_m_rd_cas_rank7.bank13"] = 0x0db7,
["unc_m_rd_cas_rank7.bank14"] = 0x0eb7,
["unc_m_rd_cas_rank7.bank15"] = 0x0fb7,
["unc_m_rd_cas_rank7.bankg0"] = 0x11b7,
["unc_m_rd_cas_rank7.bankg1"] = 0x12b7,
["unc_m_rd_cas_rank7.bankg2"] = 0x13b7,
["unc_m_rd_cas_rank7.bankg3"] = 0x14b7,
["unc_m_rpq_cycles_ne"] = 0x0011,
["unc_m_rpq_inserts"] = 0x0010,
["unc_m_vmse_mxb_wr_occupancy"] = 0x0091,
["unc_m_vmse_wr_push.wmm"] = 0x0190,
["unc_m_vmse_wr_push.rmm"] = 0x0290,
["unc_m_wmm_to_rmm.low_thresh"] = 0x01c0,
["unc_m_wmm_to_rmm.starve"] = 0x02c0,
["unc_m_wmm_to_rmm.vmse_retry"] = 0x04c0,
["unc_m_wpq_cycles_full"] = 0x0022,
["unc_m_wpq_cycles_ne"] = 0x0021,
["unc_m_wpq_read_hit"] = 0x0023,
["unc_m_wpq_write_hit"] = 0x0024,
["unc_m_wrong_mm"] = 0x00c1,
["unc_m_wr_cas_rank0.bank1"] = 0x01b8,
["unc_m_wr_cas_rank0.bank2"] = 0x02b8,
["unc_m_wr_cas_rank0.bank4"] = 0x04b8,
["unc_m_wr_cas_rank0.bank8"] = 0x08b8,
["unc_m_wr_cas_rank0.allbanks"] = 0x10b8,
["unc_m_wr_cas_rank0.bank0"] = 0x00b8,
["unc_m_wr_cas_rank0.bank3"] = 0x03b8,
["unc_m_wr_cas_rank0.bank5"] = 0x05b8,
["unc_m_wr_cas_rank0.bank6"] = 0x06b8,
["unc_m_wr_cas_rank0.bank7"] = 0x07b8,
["unc_m_wr_cas_rank0.bank9"] = 0x09b8,
["unc_m_wr_cas_rank0.bank10"] = 0x0ab8,
["unc_m_wr_cas_rank0.bank11"] = 0x0bb8,
["unc_m_wr_cas_rank0.bank12"] = 0x0cb8,
["unc_m_wr_cas_rank0.bank13"] = 0x0db8,
["unc_m_wr_cas_rank0.bank14"] = 0x0eb8,
["unc_m_wr_cas_rank0.bank15"] = 0x0fb8,
["unc_m_wr_cas_rank0.bankg0"] = 0x11b8,
["unc_m_wr_cas_rank0.bankg1"] = 0x12b8,
["unc_m_wr_cas_rank0.bankg2"] = 0x13b8,
["unc_m_wr_cas_rank0.bankg3"] = 0x14b8,
["unc_m_wr_cas_rank1.bank1"] = 0x01b9,
["unc_m_wr_cas_rank1.bank2"] = 0x02b9,
["unc_m_wr_cas_rank1.bank4"] = 0x04b9,
["unc_m_wr_cas_rank1.bank8"] = 0x08b9,
["unc_m_wr_cas_rank1.allbanks"] = 0x10b9,
["unc_m_wr_cas_rank1.bank0"] = 0x00b9,
["unc_m_wr_cas_rank1.bank3"] = 0x03b9,
["unc_m_wr_cas_rank1.bank5"] = 0x05b9,
["unc_m_wr_cas_rank1.bank6"] = 0x06b9,
["unc_m_wr_cas_rank1.bank7"] = 0x07b9,
["unc_m_wr_cas_rank1.bank9"] = 0x09b9,
["unc_m_wr_cas_rank1.bank10"] = 0x0ab9,
["unc_m_wr_cas_rank1.bank11"] = 0x0bb9,
["unc_m_wr_cas_rank1.bank12"] = 0x0cb9,
["unc_m_wr_cas_rank1.bank13"] = 0x0db9,
["unc_m_wr_cas_rank1.bank14"] = 0x0eb9,
["unc_m_wr_cas_rank1.bank15"] = 0x0fb9,
["unc_m_wr_cas_rank1.bankg0"] = 0x11b9,
["unc_m_wr_cas_rank1.bankg1"] = 0x12b9,
["unc_m_wr_cas_rank1.bankg2"] = 0x13b9,
["unc_m_wr_cas_rank1.bankg3"] = 0x14b9,
["unc_m_wr_cas_rank4.bank1"] = 0x01bc,
["unc_m_wr_cas_rank4.bank2"] = 0x02bc,
["unc_m_wr_cas_rank4.bank4"] = 0x04bc,
["unc_m_wr_cas_rank4.bank8"] = 0x08bc,
["unc_m_wr_cas_rank4.allbanks"] = 0x10bc,
["unc_m_wr_cas_rank4.bank0"] = 0x00bc,
["unc_m_wr_cas_rank4.bank3"] = 0x03bc,
["unc_m_wr_cas_rank4.bank5"] = 0x05bc,
["unc_m_wr_cas_rank4.bank6"] = 0x06bc,
["unc_m_wr_cas_rank4.bank7"] = 0x07bc,
["unc_m_wr_cas_rank4.bank9"] = 0x09bc,
["unc_m_wr_cas_rank4.bank10"] = 0x0abc,
["unc_m_wr_cas_rank4.bank11"] = 0x0bbc,
["unc_m_wr_cas_rank4.bank12"] = 0x0cbc,
["unc_m_wr_cas_rank4.bank13"] = 0x0dbc,
["unc_m_wr_cas_rank4.bank14"] = 0x0ebc,
["unc_m_wr_cas_rank4.bank15"] = 0x0fbc,
["unc_m_wr_cas_rank4.bankg0"] = 0x11bc,
["unc_m_wr_cas_rank4.bankg1"] = 0x12bc,
["unc_m_wr_cas_rank4.bankg2"] = 0x13bc,
["unc_m_wr_cas_rank4.bankg3"] = 0x14bc,
["unc_m_wr_cas_rank5.bank1"] = 0x01bd,
["unc_m_wr_cas_rank5.bank2"] = 0x02bd,
["unc_m_wr_cas_rank5.bank4"] = 0x04bd,
["unc_m_wr_cas_rank5.bank8"] = 0x08bd,
["unc_m_wr_cas_rank5.allbanks"] = 0x10bd,
["unc_m_wr_cas_rank5.bank0"] = 0x00bd,
["unc_m_wr_cas_rank5.bank3"] = 0x03bd,
["unc_m_wr_cas_rank5.bank5"] = 0x05bd,
["unc_m_wr_cas_rank5.bank6"] = 0x06bd,
["unc_m_wr_cas_rank5.bank7"] = 0x07bd,
["unc_m_wr_cas_rank5.bank9"] = 0x09bd,
["unc_m_wr_cas_rank5.bank10"] = 0x0abd,
["unc_m_wr_cas_rank5.bank11"] = 0x0bbd,
["unc_m_wr_cas_rank5.bank12"] = 0x0cbd,
["unc_m_wr_cas_rank5.bank13"] = 0x0dbd,
["unc_m_wr_cas_rank5.bank14"] = 0x0ebd,
["unc_m_wr_cas_rank5.bank15"] = 0x0fbd,
["unc_m_wr_cas_rank5.bankg0"] = 0x11bd,
["unc_m_wr_cas_rank5.bankg1"] = 0x12bd,
["unc_m_wr_cas_rank5.bankg2"] = 0x13bd,
["unc_m_wr_cas_rank5.bankg3"] = 0x14bd,
["unc_m_wr_cas_rank6.bank1"] = 0x01be,
["unc_m_wr_cas_rank6.bank2"] = 0x02be,
["unc_m_wr_cas_rank6.bank4"] = 0x04be,
["unc_m_wr_cas_rank6.bank8"] = 0x08be,
["unc_m_wr_cas_rank6.allbanks"] = 0x10be,
["unc_m_wr_cas_rank6.bank0"] = 0x00be,
["unc_m_wr_cas_rank6.bank3"] = 0x03be,
["unc_m_wr_cas_rank6.bank5"] = 0x05be,
["unc_m_wr_cas_rank6.bank6"] = 0x06be,
["unc_m_wr_cas_rank6.bank7"] = 0x07be,
["unc_m_wr_cas_rank6.bank9"] = 0x09be,
["unc_m_wr_cas_rank6.bank10"] = 0x0abe,
["unc_m_wr_cas_rank6.bank11"] = 0x0bbe,
["unc_m_wr_cas_rank6.bank12"] = 0x0cbe,
["unc_m_wr_cas_rank6.bank13"] = 0x0dbe,
["unc_m_wr_cas_rank6.bank14"] = 0x0ebe,
["unc_m_wr_cas_rank6.bank15"] = 0x0fbe,
["unc_m_wr_cas_rank6.bankg0"] = 0x11be,
["unc_m_wr_cas_rank6.bankg1"] = 0x12be,
["unc_m_wr_cas_rank6.bankg2"] = 0x13be,
["unc_m_wr_cas_rank6.bankg3"] = 0x14be,
["unc_m_wr_cas_rank7.bank1"] = 0x01bf,
["unc_m_wr_cas_rank7.bank2"] = 0x02bf,
["unc_m_wr_cas_rank7.bank4"] = 0x04bf,
["unc_m_wr_cas_rank7.bank8"] = 0x08bf,
["unc_m_wr_cas_rank7.allbanks"] = 0x10bf,
["unc_m_wr_cas_rank7.bank0"] = 0x00bf,
["unc_m_wr_cas_rank7.bank3"] = 0x03bf,
["unc_m_wr_cas_rank7.bank5"] = 0x05bf,
["unc_m_wr_cas_rank7.bank6"] = 0x06bf,
["unc_m_wr_cas_rank7.bank7"] = 0x07bf,
["unc_m_wr_cas_rank7.bank9"] = 0x09bf,
["unc_m_wr_cas_rank7.bank10"] = 0x0abf,
["unc_m_wr_cas_rank7.bank11"] = 0x0bbf,
["unc_m_wr_cas_rank7.bank12"] = 0x0cbf,
["unc_m_wr_cas_rank7.bank13"] = 0x0dbf,
["unc_m_wr_cas_rank7.bank14"] = 0x0ebf,
["unc_m_wr_cas_rank7.bank15"] = 0x0fbf,
["unc_m_wr_cas_rank7.bankg0"] = 0x11bf,
["unc_m_wr_cas_rank7.bankg1"] = 0x12bf,
["unc_m_wr_cas_rank7.bankg2"] = 0x13bf,
["unc_m_wr_cas_rank7.bankg3"] = 0x14bf,
["unc_u_clockticks"] = 0x0000,
["unc_c_rxr_occupancy.irq_rej"] = 0x0211,
["unc_h_tracker_cycles_ne.local"] = 0x0103,
["unc_h_tracker_cycles_ne.remote"] = 0x0203,
["unc_h_tracker_cycles_ne.all"] = 0x0303,
["unc_i_misc0.pf_timeout"] = 0x8014,
["unc_m_dclockticks"] = 0x0000,
["unc_c_llc_victims.i_state"] = 0x0437,
["unc_p_pkg_residency_c1e_cycles"] = 0x004e,
["unc_p_ufs_transitions_ring_gv"] = 0x0079,
},
},
{"GenuineIntel-6-3D", "V11", "core",
{
-- source: BDW/Broadwell_core_V11.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["int_misc.rat_stall_cycles"] = 0x080d,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["arith.fpu_div_active"] = 0x0114,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifdata_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["ild_stall.lcp"] = 0x0187,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.x87"] = 0x02c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.ret"] = 0x08c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_arith_inst_retired.scalar_double"] = 0x01c7,
["fp_arith_inst_retired.scalar_single"] = 0x02c7,
["fp_arith_inst_retired.128b_packed_double"] = 0x04c7,
["fp_arith_inst_retired.128b_packed_single"] = 0x08c7,
["fp_arith_inst_retired.256b_packed_double"] = 0x10c7,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["fp_arith_inst_retired.256b_packed_single"] = 0x20c7,
["idq.ms_switches"] = 0x3079,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.cycles_mem_any"] = 0x02a3,
["cycle_activity.stalls_total"] = 0x04a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.stalls_mem_any"] = 0x06a3,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["lsd.cycles_active"] = 0x01a8,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["uop_dispatches_cancelled.simd_prf"] = 0x03a0,
["fp_arith_inst_retired.scalar"] = 0x03c7,
["fp_arith_inst_retired.packed"] = 0x3cc7,
["fp_arith_inst_retired.single"] = 0x15c7,
["fp_arith_inst_retired.double"] = 0x2ac7,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-3D", "V11", "offcore",
{
-- source: BDW/Broadwell_matrix_V11.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-3D", "V11", "uncore",
{
-- source: BDW/Broadwell_uncore_V11.tsv
["unc_cbo_xsnp_response.miss_xcore"] = 0x4122,
["unc_cbo_xsnp_response.miss_eviction"] = 0x8122,
["unc_cbo_xsnp_response.hit_xcore"] = 0x4422,
["unc_cbo_xsnp_response.hitm_xcore"] = 0x4822,
["unc_cbo_cache_lookup.read_m"] = 0x1134,
["unc_cbo_cache_lookup.write_m"] = 0x2134,
["unc_cbo_cache_lookup.any_m"] = 0x8134,
["unc_cbo_cache_lookup.read_i"] = 0x1834,
["unc_cbo_cache_lookup.any_i"] = 0x8834,
["unc_cbo_cache_lookup.read_mesi"] = 0x1f34,
["unc_cbo_cache_lookup.write_mesi"] = 0x2f34,
["unc_cbo_cache_lookup.any_mesi"] = 0x8f34,
["unc_cbo_cache_lookup.any_es"] = 0x8634,
["unc_cbo_cache_lookup.read_es"] = 0x1634,
["unc_cbo_cache_lookup.write_es"] = 0x2634,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_clock.socket"] = 0x0100,
},
},
{"GenuineIntel-6-3D", "V11", "fp_arith_inst",
{
-- source: BDW/Broadwell_FP_ARITH_INST_V11.tsv
},
},
{"GenuineIntel-6-47", "V11", "core",
{
-- source: BDW/Broadwell_core_V11.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["int_misc.rat_stall_cycles"] = 0x080d,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["arith.fpu_div_active"] = 0x0114,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifdata_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["ild_stall.lcp"] = 0x0187,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.x87"] = 0x02c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.ret"] = 0x08c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_arith_inst_retired.scalar_double"] = 0x01c7,
["fp_arith_inst_retired.scalar_single"] = 0x02c7,
["fp_arith_inst_retired.128b_packed_double"] = 0x04c7,
["fp_arith_inst_retired.128b_packed_single"] = 0x08c7,
["fp_arith_inst_retired.256b_packed_double"] = 0x10c7,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["fp_arith_inst_retired.256b_packed_single"] = 0x20c7,
["idq.ms_switches"] = 0x3079,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.cycles_mem_any"] = 0x02a3,
["cycle_activity.stalls_total"] = 0x04a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.stalls_mem_any"] = 0x06a3,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["lsd.cycles_active"] = 0x01a8,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["uop_dispatches_cancelled.simd_prf"] = 0x03a0,
["fp_arith_inst_retired.scalar"] = 0x03c7,
["fp_arith_inst_retired.packed"] = 0x3cc7,
["fp_arith_inst_retired.single"] = 0x15c7,
["fp_arith_inst_retired.double"] = 0x2ac7,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
{"GenuineIntel-6-47", "V11", "offcore",
{
-- source: BDW/Broadwell_matrix_V11.tsv
-- [skipping offcore events. How are they encoded?]
},
},
{"GenuineIntel-6-47", "V11", "uncore",
{
-- source: BDW/Broadwell_uncore_V11.tsv
["unc_cbo_xsnp_response.miss_xcore"] = 0x4122,
["unc_cbo_xsnp_response.miss_eviction"] = 0x8122,
["unc_cbo_xsnp_response.hit_xcore"] = 0x4422,
["unc_cbo_xsnp_response.hitm_xcore"] = 0x4822,
["unc_cbo_cache_lookup.read_m"] = 0x1134,
["unc_cbo_cache_lookup.write_m"] = 0x2134,
["unc_cbo_cache_lookup.any_m"] = 0x8134,
["unc_cbo_cache_lookup.read_i"] = 0x1834,
["unc_cbo_cache_lookup.any_i"] = 0x8834,
["unc_cbo_cache_lookup.read_mesi"] = 0x1f34,
["unc_cbo_cache_lookup.write_mesi"] = 0x2f34,
["unc_cbo_cache_lookup.any_mesi"] = 0x8f34,
["unc_cbo_cache_lookup.any_es"] = 0x8634,
["unc_cbo_cache_lookup.read_es"] = 0x1634,
["unc_cbo_cache_lookup.write_es"] = 0x2634,
["unc_arb_trk_occupancy.all"] = 0x0180,
["unc_arb_trk_requests.all"] = 0x0181,
["unc_arb_trk_requests.writes"] = 0x2081,
["unc_clock.socket"] = 0x0100,
},
},
{"GenuineIntel-6-47", "V11", "fp_arith_inst",
{
-- source: BDW/Broadwell_FP_ARITH_INST_V11.tsv
},
},
{"GenuineIntel-6-56", "V1", "core",
{
-- source: BDW-DE/BroadwellDE_core_V1.tsv
["inst_retired.any"] = 0x0100,
["cpu_clk_unhalted.thread"] = 0x0200,
["cpu_clk_unhalted.ref_tsc"] = 0x0300,
["ld_blocks.store_forward"] = 0x0203,
["ld_blocks.no_sr"] = 0x0803,
["misalign_mem_ref.loads"] = 0x0105,
["misalign_mem_ref.stores"] = 0x0205,
["ld_blocks_partial.address_alias"] = 0x0107,
["dtlb_load_misses.miss_causes_a_walk"] = 0x0108,
["dtlb_load_misses.walk_completed_4k"] = 0x0208,
["dtlb_load_misses.walk_duration"] = 0x1008,
["dtlb_load_misses.stlb_hit_4k"] = 0x2008,
["int_misc.rat_stall_cycles"] = 0x080d,
["int_misc.recovery_cycles"] = 0x030d,
["uops_issued.any"] = 0x010e,
["uops_issued.flags_merge"] = 0x100e,
["uops_issued.slow_lea"] = 0x200e,
["uops_issued.single_mul"] = 0x400e,
["uops_issued.stall_cycles"] = 0x010e,
["arith.fpu_div_active"] = 0x0114,
["l2_rqsts.demand_data_rd_miss"] = 0x2124,
["l2_rqsts.demand_data_rd_hit"] = 0x4124,
["l2_rqsts.l2_pf_miss"] = 0x3024,
["l2_rqsts.l2_pf_hit"] = 0x5024,
["l2_rqsts.all_demand_data_rd"] = 0xe124,
["l2_rqsts.all_rfo"] = 0xe224,
["l2_rqsts.all_code_rd"] = 0xe424,
["l2_rqsts.all_pf"] = 0xf824,
["l2_demand_rqsts.wb_hit"] = 0x5027,
["longest_lat_cache.miss"] = 0x412e,
["longest_lat_cache.reference"] = 0x4f2e,
["cpu_clk_thread_unhalted.ref_xclk"] = 0x013c,
["cpu_clk_thread_unhalted.one_thread_active"] = 0x023c,
["l1d_pend_miss.pending"] = 0x0148,
["l1d_pend_miss.pending_cycles"] = 0x0148,
["dtlb_store_misses.miss_causes_a_walk"] = 0x0149,
["dtlb_store_misses.walk_completed_4k"] = 0x0249,
["dtlb_store_misses.walk_duration"] = 0x1049,
["dtlb_store_misses.stlb_hit_4k"] = 0x2049,
["load_hit_pre.hw_pf"] = 0x024c,
["ept.walk_cycles"] = 0x104f,
["l1d.replacement"] = 0x0151,
["tx_mem.abort_conflict"] = 0x0154,
["tx_mem.abort_capacity_write"] = 0x0254,
["tx_mem.abort_hle_store_to_elided_lock"] = 0x0454,
["tx_mem.abort_hle_elision_buffer_not_empty"] = 0x0854,
["tx_mem.abort_hle_elision_buffer_mismatch"] = 0x1054,
["tx_mem.abort_hle_elision_buffer_unsupported_alignment"] = 0x2054,
["tx_mem.hle_elision_buffer_full"] = 0x4054,
["move_elimination.int_eliminated"] = 0x0158,
["move_elimination.simd_eliminated"] = 0x0258,
["move_elimination.int_not_eliminated"] = 0x0458,
["move_elimination.simd_not_eliminated"] = 0x0858,
["cpl_cycles.ring0"] = 0x015c,
["cpl_cycles.ring123"] = 0x025c,
["cpl_cycles.ring0_trans"] = 0x015c,
["tx_exec.misc1"] = 0x015d,
["tx_exec.misc2"] = 0x025d,
["tx_exec.misc3"] = 0x045d,
["tx_exec.misc4"] = 0x085d,
["tx_exec.misc5"] = 0x105d,
["rs_events.empty_cycles"] = 0x015e,
["offcore_requests_outstanding.demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.demand_code_rd"] = 0x0260,
["offcore_requests_outstanding.demand_rfo"] = 0x0460,
["offcore_requests_outstanding.all_data_rd"] = 0x0860,
["offcore_requests_outstanding.cycles_with_demand_data_rd"] = 0x0160,
["offcore_requests_outstanding.cycles_with_data_rd"] = 0x0860,
["lock_cycles.split_lock_uc_lock_duration"] = 0x0163,
["lock_cycles.cache_lock_duration"] = 0x0263,
["idq.empty"] = 0x0279,
["idq.mite_uops"] = 0x0479,
["idq.dsb_uops"] = 0x0879,
["idq.ms_dsb_uops"] = 0x1079,
["idq.ms_mite_uops"] = 0x2079,
["idq.ms_uops"] = 0x3079,
["idq.ms_cycles"] = 0x3079,
["idq.mite_cycles"] = 0x0479,
["idq.dsb_cycles"] = 0x0879,
["idq.ms_dsb_cycles"] = 0x1079,
["idq.ms_dsb_occur"] = 0x1079,
["idq.all_dsb_cycles_4_uops"] = 0x1879,
["idq.all_dsb_cycles_any_uops"] = 0x1879,
["idq.all_mite_cycles_4_uops"] = 0x2479,
["idq.all_mite_cycles_any_uops"] = 0x2479,
["idq.mite_all_uops"] = 0x3c79,
["icache.hit"] = 0x0180,
["icache.misses"] = 0x0280,
["icache.ifdata_stall"] = 0x0480,
["itlb_misses.miss_causes_a_walk"] = 0x0185,
["itlb_misses.walk_completed_4k"] = 0x0285,
["itlb_misses.walk_duration"] = 0x1085,
["itlb_misses.stlb_hit_4k"] = 0x2085,
["ild_stall.lcp"] = 0x0187,
["br_inst_exec.nontaken_conditional"] = 0x4188,
["br_inst_exec.taken_conditional"] = 0x8188,
["br_inst_exec.taken_direct_jump"] = 0x8288,
["br_inst_exec.taken_indirect_jump_non_call_ret"] = 0x8488,
["br_inst_exec.taken_indirect_near_return"] = 0x8888,
["br_inst_exec.taken_direct_near_call"] = 0x9088,
["br_inst_exec.taken_indirect_near_call"] = 0xa088,
["br_inst_exec.all_conditional"] = 0xc188,
["br_inst_exec.all_direct_jmp"] = 0xc288,
["br_inst_exec.all_indirect_jump_non_call_ret"] = 0xc488,
["br_inst_exec.all_indirect_near_return"] = 0xc888,
["br_inst_exec.all_direct_near_call"] = 0xd088,
["br_inst_exec.all_branches"] = 0xff88,
["br_misp_exec.nontaken_conditional"] = 0x4189,
["br_misp_exec.taken_conditional"] = 0x8189,
["br_misp_exec.taken_indirect_jump_non_call_ret"] = 0x8489,
["br_misp_exec.all_conditional"] = 0xc189,
["br_misp_exec.all_indirect_jump_non_call_ret"] = 0xc489,
["br_misp_exec.all_branches"] = 0xff89,
["idq_uops_not_delivered.core"] = 0x019c,
["idq_uops_not_delivered.cycles_0_uops_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_1_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_2_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_le_3_uop_deliv.core"] = 0x019c,
["idq_uops_not_delivered.cycles_fe_was_ok"] = 0x019c,
["uops_dispatched_port.port_0"] = 0x01a1,
["uops_dispatched_port.port_1"] = 0x02a1,
["uops_dispatched_port.port_2"] = 0x04a1,
["uops_dispatched_port.port_3"] = 0x08a1,
["uops_dispatched_port.port_4"] = 0x10a1,
["uops_dispatched_port.port_5"] = 0x20a1,
["uops_dispatched_port.port_6"] = 0x40a1,
["uops_dispatched_port.port_7"] = 0x80a1,
["resource_stalls.any"] = 0x01a2,
["resource_stalls.rs"] = 0x04a2,
["resource_stalls.sb"] = 0x08a2,
["resource_stalls.rob"] = 0x10a2,
["cycle_activity.cycles_l2_pending"] = 0x01a3,
["cycle_activity.cycles_l1d_pending"] = 0x08a3,
["cycle_activity.cycles_ldm_pending"] = 0x02a3,
["cycle_activity.cycles_no_execute"] = 0x04a3,
["cycle_activity.stalls_l2_pending"] = 0x05a3,
["cycle_activity.stalls_ldm_pending"] = 0x06a3,
["cycle_activity.stalls_l1d_pending"] = 0x0ca3,
["lsd.uops"] = 0x01a8,
["dsb2mite_switches.penalty_cycles"] = 0x02ab,
["itlb.itlb_flush"] = 0x01ae,
["offcore_requests.demand_data_rd"] = 0x01b0,
["offcore_requests.demand_code_rd"] = 0x02b0,
["offcore_requests.demand_rfo"] = 0x04b0,
["offcore_requests.all_data_rd"] = 0x08b0,
["uops_executed.thread"] = 0x01b1,
["uops_executed.core"] = 0x02b1,
["uops_executed.stall_cycles"] = 0x01b1,
["offcore_requests_buffer.sq_full"] = 0x01b2,
["page_walker_loads.dtlb_l1"] = 0x11bc,
["page_walker_loads.itlb_l1"] = 0x21bc,
["page_walker_loads.dtlb_l2"] = 0x12bc,
["page_walker_loads.itlb_l2"] = 0x22bc,
["page_walker_loads.dtlb_l3"] = 0x14bc,
["page_walker_loads.itlb_l3"] = 0x24bc,
["page_walker_loads.dtlb_memory"] = 0x18bc,
["inst_retired.any_p"] = 0x00c0,
["inst_retired.x87"] = 0x02c0,
["inst_retired.prec_dist"] = 0x01c0,
["other_assists.avx_to_sse"] = 0x08c1,
["other_assists.sse_to_avx"] = 0x10c1,
["other_assists.any_wb_assist"] = 0x40c1,
["uops_retired.all"] = 0x01c2,
["uops_retired.retire_slots"] = 0x02c2,
["uops_retired.stall_cycles"] = 0x01c2,
["uops_retired.total_cycles"] = 0x01c2,
["machine_clears.cycles"] = 0x01c3,
["machine_clears.memory_ordering"] = 0x02c3,
["machine_clears.smc"] = 0x04c3,
["machine_clears.maskmov"] = 0x20c3,
["br_inst_retired.conditional"] = 0x01c4,
["br_inst_retired.near_call"] = 0x02c4,
["br_inst_retired.all_branches"] = 0x00c4,
["br_inst_retired.near_return"] = 0x08c4,
["br_inst_retired.not_taken"] = 0x10c4,
["br_inst_retired.near_taken"] = 0x20c4,
["br_inst_retired.far_branch"] = 0x40c4,
["br_inst_retired.all_branches_pebs"] = 0x04c4,
["br_inst_retired.near_call_r3"] = 0x02c4,
["br_misp_retired.conditional"] = 0x01c5,
["br_misp_retired.all_branches"] = 0x00c5,
["br_misp_retired.ret"] = 0x08c5,
["br_misp_retired.all_branches_pebs"] = 0x04c5,
["fp_arith_inst_retired.scalar_double"] = 0x01c7,
["fp_arith_inst_retired.scalar_single"] = 0x02c7,
["fp_arith_inst_retired.128b_packed_double"] = 0x04c7,
["fp_arith_inst_retired.128b_packed_single"] = 0x08c7,
["fp_arith_inst_retired.256b_packed_double"] = 0x10c7,
["hle_retired.start"] = 0x01c8,
["hle_retired.commit"] = 0x02c8,
["hle_retired.aborted"] = 0x04c8,
["hle_retired.aborted_misc1"] = 0x08c8,
["hle_retired.aborted_misc2"] = 0x10c8,
["hle_retired.aborted_misc3"] = 0x20c8,
["hle_retired.aborted_misc4"] = 0x40c8,
["hle_retired.aborted_misc5"] = 0x80c8,
["rtm_retired.start"] = 0x01c9,
["rtm_retired.commit"] = 0x02c9,
["rtm_retired.aborted"] = 0x04c9,
["rtm_retired.aborted_misc1"] = 0x08c9,
["rtm_retired.aborted_misc2"] = 0x10c9,
["rtm_retired.aborted_misc3"] = 0x20c9,
["rtm_retired.aborted_misc4"] = 0x40c9,
["rtm_retired.aborted_misc5"] = 0x80c9,
["fp_assist.x87_output"] = 0x02ca,
["fp_assist.x87_input"] = 0x04ca,
["fp_assist.simd_output"] = 0x08ca,
["fp_assist.simd_input"] = 0x10ca,
["fp_assist.any"] = 0x1eca,
["rob_misc_events.lbr_inserts"] = 0x20cc,
["mem_trans_retired.load_latency_gt_4"] = 0x01cd,
["mem_trans_retired.load_latency_gt_8"] = 0x01cd,
["mem_trans_retired.load_latency_gt_16"] = 0x01cd,
["mem_trans_retired.load_latency_gt_32"] = 0x01cd,
["mem_trans_retired.load_latency_gt_64"] = 0x01cd,
["mem_trans_retired.load_latency_gt_128"] = 0x01cd,
["mem_trans_retired.load_latency_gt_256"] = 0x01cd,
["mem_trans_retired.load_latency_gt_512"] = 0x01cd,
["mem_uops_retired.stlb_miss_loads"] = 0x11d0,
["mem_uops_retired.stlb_miss_stores"] = 0x12d0,
["mem_uops_retired.lock_loads"] = 0x21d0,
["mem_uops_retired.split_loads"] = 0x41d0,
["mem_uops_retired.split_stores"] = 0x42d0,
["mem_uops_retired.all_loads"] = 0x81d0,
["mem_uops_retired.all_stores"] = 0x82d0,
["mem_load_uops_retired.l1_hit"] = 0x01d1,
["mem_load_uops_retired.l2_hit"] = 0x02d1,
["mem_load_uops_retired.l3_hit"] = 0x04d1,
["mem_load_uops_retired.l1_miss"] = 0x08d1,
["mem_load_uops_retired.l2_miss"] = 0x10d1,
["mem_load_uops_retired.l3_miss"] = 0x20d1,
["mem_load_uops_retired.hit_lfb"] = 0x40d1,
["mem_load_uops_l3_hit_retired.xsnp_miss"] = 0x01d2,
["mem_load_uops_l3_hit_retired.xsnp_hit"] = 0x02d2,
["mem_load_uops_l3_hit_retired.xsnp_hitm"] = 0x04d2,
["mem_load_uops_l3_hit_retired.xsnp_none"] = 0x08d2,
["mem_load_uops_l3_miss_retired.local_dram"] = 0x01d3,
["cpu_clk_unhalted.thread_p"] = 0x003c,
["l2_trans.demand_data_rd"] = 0x01f0,
["l2_trans.rfo"] = 0x02f0,
["l2_trans.code_rd"] = 0x04f0,
["l2_trans.all_pf"] = 0x08f0,
["l2_trans.l1d_wb"] = 0x10f0,
["l2_trans.l2_fill"] = 0x20f0,
["l2_trans.l2_wb"] = 0x40f0,
["l2_trans.all_requests"] = 0x80f0,
["l2_lines_in.i"] = 0x01f1,
["l2_lines_in.s"] = 0x02f1,
["l2_lines_in.e"] = 0x04f1,
["l2_lines_in.all"] = 0x07f1,
["l2_lines_out.demand_clean"] = 0x05f2,
["br_misp_exec.taken_indirect_near_call"] = 0xa089,
["uops_executed_port.port_0_core"] = 0x01a1,
["uops_executed_port.port_1_core"] = 0x02a1,
["uops_executed_port.port_2_core"] = 0x04a1,
["uops_executed_port.port_3_core"] = 0x08a1,
["uops_executed_port.port_4_core"] = 0x10a1,
["uops_executed_port.port_5_core"] = 0x20a1,
["uops_executed_port.port_6_core"] = 0x40a1,
["uops_executed_port.port_7_core"] = 0x80a1,
["br_misp_retired.near_taken"] = 0x20c5,
["dtlb_load_misses.walk_completed"] = 0x0e08,
["dtlb_load_misses.stlb_hit"] = 0x6008,
["l2_rqsts.rfo_hit"] = 0x4224,
["l2_rqsts.rfo_miss"] = 0x2224,
["l2_rqsts.code_rd_hit"] = 0x4424,
["l2_rqsts.code_rd_miss"] = 0x2424,
["l2_rqsts.all_demand_miss"] = 0x2724,
["l2_rqsts.all_demand_references"] = 0xe724,
["l2_rqsts.miss"] = 0x3f24,
["l2_rqsts.references"] = 0xff24,
["dtlb_store_misses.walk_completed"] = 0x0e49,
["dtlb_store_misses.stlb_hit"] = 0x6049,
["itlb_misses.walk_completed"] = 0x0e85,
["itlb_misses.stlb_hit"] = 0x6085,
["uops_executed.cycles_ge_1_uop_exec"] = 0x01b1,
["uops_executed.cycles_ge_2_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_3_uops_exec"] = 0x01b1,
["uops_executed.cycles_ge_4_uops_exec"] = 0x01b1,
["baclears.any"] = 0x1fe6,
["offcore_response"] = 0x01b7,
["fp_arith_inst_retired.256b_packed_single"] = 0x20c7,
["idq.ms_switches"] = 0x3079,
["cycle_activity.cycles_l1d_miss"] = 0x08a3,
["cycle_activity.cycles_l2_miss"] = 0x01a3,
["cycle_activity.cycles_mem_any"] = 0x02a3,
["cycle_activity.stalls_total"] = 0x04a3,
["cycle_activity.stalls_l1d_miss"] = 0x0ca3,
["cycle_activity.stalls_l2_miss"] = 0x05a3,
["cycle_activity.stalls_mem_any"] = 0x06a3,
["machine_clears.count"] = 0x01c3,
["lsd.cycles_4_uops"] = 0x01a8,
["rs_events.empty_end"] = 0x015e,
["lsd.cycles_active"] = 0x01a8,
["uops_executed_port.port_0"] = 0x01a1,
["uops_executed_port.port_1"] = 0x02a1,
["uops_executed_port.port_2"] = 0x04a1,
["uops_executed_port.port_3"] = 0x08a1,
["uops_executed_port.port_4"] = 0x10a1,
["uops_executed_port.port_5"] = 0x20a1,
["uops_executed_port.port_6"] = 0x40a1,
["uops_executed_port.port_7"] = 0x80a1,
["uop_dispatches_cancelled.simd_prf"] = 0x03a0,
["fp_arith_inst_retired.scalar"] = 0x03c7,
["fp_arith_inst_retired.packed"] = 0x3cc7,
["fp_arith_inst_retired.single"] = 0x15c7,
["fp_arith_inst_retired.double"] = 0x2ac7,
["cpu_clk_unhalted.thread_any"] = 0x0200,
["cpu_clk_unhalted.thread_p_any"] = 0x003c,
["cpu_clk_thread_unhalted.ref_xclk_any"] = 0x013c,
["int_misc.recovery_cycles_any"] = 0x030d,
["uops_executed.core_cycles_ge_1"] = 0x02b1,
["uops_executed.core_cycles_ge_2"] = 0x02b1,
["uops_executed.core_cycles_ge_3"] = 0x02b1,
["uops_executed.core_cycles_ge_4"] = 0x02b1,
["uops_executed.core_cycles_none"] = 0x02b1,
["offcore_requests_outstanding.demand_data_rd_ge_6"] = 0x0160,
["l1d_pend_miss.pending_cycles_any"] = 0x0148,
["l1d_pend_miss.fb_full"] = 0x0248,
},
},
}
| apache-2.0 |
alexandergall/snabbswitch | src/program/l2vpn/pseudowire.lua | 6 | 30676 | -- Simplified implementation of a pseudowire based on RFC 4664,
-- providing a L2 point-to-point VPN on top of IPv6.
--
-- This app has two connections, ac (Attachment Circuit) and uplink.
-- The former transports Ethernet frames while the latter transports
-- Ethernet frames encapsulated in IPv6 and a suitable tunneling
-- protocol. The push() method performs encapsulation between the ac
-- and uplink port and decapsulation between the uplink and ac ports,
-- respectively
--
-- The ac port can either attach directly to a physical device or a
-- "forwarder" in RFC 4664 terminology that handles
-- multiplexing/de-multiplexing of traffic between the actual AC and a
-- set of pseudowires to implement a multi-point L2 VPN. An instance
-- of such a forwarder is provided by the apps/bridge module.
--
-- The app currently supports IPv6 as transport protocol and GRE or a
-- variant of L2TPv3 known as "keyed IPv6 tunnel" as tunnel protocol.
--
-- The encapsulation includes a full Ethernet header with dummy values
-- for the src/dst MAC addresses. On its "uplink" link, the app
-- connects to a L3 interface, represented by a neiaghbor-discovery app
-- which fills in the actual src/dst MAC addresses.
module(..., package.seeall)
local ffi = require("ffi")
local C = ffi.C
local lib = require("core.lib")
local app = require("core.app")
local link = require("core.link")
local config = require("core.config")
local timer = require("core.timer")
local datagram = require("lib.protocol.datagram")
local ethernet = require("lib.protocol.ethernet")
local packet = require("core.packet")
local filter = require("lib.pcap.filter")
local pcap = require("apps.pcap.pcap")
local cc = require("program.l2vpn.control_channel")
local ipc_mib = require("lib.ipc.shmem.mib")
local logger = require("lib.logger")
pseudowire = subClass(nil)
pseudowire._name = "Pseudowire"
local dgram_options = { delayed_commit = true }
local function log(self, msg, print_peer)
if print_peer then
msg = "Peer "..self._transport.peer..": "..msg
end
self._logger:log(msg)
end
-- Defaults for the control channel
local cc_defaults = { heartbeat = 10, dead_factor = 3 }
-- Set SNMP OperStatus based on inbound/outbound status. The
-- semantics are slightly different in the CISCO-IETF-PW-MIB and the
-- STD-PW-MIB. For the former, the InboundOperStatus is simply set to
-- "up" whenever a heartbeat is received. For the latter, more
-- detailed status information is advertised by the peer through the
-- signalling protocol, see the description of the pwRemoteStatus
-- object. However, the control-channel does not currently implement
-- this and we treat the reception of a heartbeat like the reception
-- of a "no faults" status report. In any case, cpwVcOperStatus and
-- pwOperStatus are always guaranteed to have the same value.
local oper_status = { [1] = 'up', [2] = 'down', [4] = 'unknown' }
local function set_OperStatus (self, mib)
local old = mib:get('cpwVcOperStatus')
if (mib:get('cpwVcInboundOperStatus') == 1 and
mib:get('cpwVcOutboundOperStatus') == 1) then
new = 1 -- up
else
new = 2 -- down
end
if new ~= old then
mib:set('cpwVcOperStatus', new)
mib:set('pwOperStatus', new)
log(self, "Oper Status "..oper_status[old]..
" => "..oper_status[new], true)
if new == 1 then
local now = C.get_unix_time()
mib:set('_X_cpwVcUpTime_TicksBase', now)
mib:set('_X_pwUpTime_TicksBase', now)
mib:set('_X_pwLastChange_TicksBase', now)
-- Allow forwarding in push()
self._forward = true
else
mib:set('_X_cpwVcUpTime_TicksBase', 0)
mib:set('cpwVcUpTime', 0)
mib:set('_X_pwUpTime_TicksBase', 0)
mib:set('pwUpTime', 0)
mib:set('_X_pwLastChange_TicksBase', C.get_unix_time())
-- Stop forwarding in push()
self._forward = false
end
end
end
local function set_InboundStatus_up (self, mib)
mib:set('cpwVcInboundOperStatus', 1)
mib:set('pwRemoteStatus', {}) -- no fault
set_OperStatus(self, mib)
end
local function set_InboundStatus_down (self, mib)
mib:set('cpwVcInboundOperStatus', 2)
mib:set('pwRemoteStatus', { 0 }) -- pwNotForwarding
set_OperStatus(self, mib)
end
local function increment_errors(self)
self._mib:set('pwPerfTotalErrorPackets',
self._mib:get('pwPerfTotalErrorPackets') + 1)
self._mib:set('cpwVcPerfTotalErrorPackets',
self._mib:get('cpwVcPerfTotalErrorPackets') + 1)
end
-- Process a control message
local cc_state = cc.create_state()
local function process_cc (self, datagram)
local mib = self._mib
local status_ok = true
local have_heartbeat_p = false
local _cc = self._cc
if not _cc then
log(self, "Non-functional asymmetric control-channel "
.."remote enabled, local disabled)", true)
set_InboundStatus_down(self, mib)
return
end
cc_state.chunk[0], cc_state.len = datagram:payload()
for tlv, errmsg in cc.parse_next, cc_state do
if errmsg then
-- An error occured during parsing. This renders the
-- control-channel non-functional.
log(self, "Invalid control-channel packet: "..errmsg, true)
status_ok = false
break
end
local type = cc.types[tlv.h.type]
if type.name == 'heartbeat' then
have_heartbeat_p = true
local hb = type.get(tlv)
_cc.rcv_tstamp = math.floor(tonumber(C.get_time_ns())/1e9)
if _cc.remote_hb == nil then
log(self, "Starting remote heartbeat timer at "..hb
.." seconds", true)
local t = _cc.timer_hb
t.ticks = hb*1000
t.repeating = true
timer.activate(_cc.timer_hb)
_cc.remote_hb = hb
elseif _cc.remote_hb ~= hb then
log(self, "Changing remote heartbeat "..
_cc.remote_hb.." => "..hb.." seconds", true)
_cc.remote_hb = hb
_cc.timer_hb.ticks = hb*1000
end
elseif type.name == 'mtu' then
local mtu = type.get(tlv)
local old_mtu = mib:get('cpwVcRemoteIfMtu')
if mtu ~= old_mtu then
log(self, "Remote MTU change "..old_mtu.." => "..mtu, true)
end
mib:set('cpwVcRemoteIfMtu', type.get(tlv))
mib:set('pwRemoteIfMtu', type.get(tlv))
if mtu ~= self._conf.mtu then
log(self, "MTU mismatch, local "..self._conf.mtu
..", remote "..mtu, true)
status_ok = false
end
elseif type.name == 'if_description' then
local old_ifs = mib:get('cpwVcRemoteIfString')
local ifs = type.get(tlv)
mib:set('cpwVcRemoteIfString', ifs)
mib:set('pwRemoteIfString', ifs)
if old_ifs ~= ifs then
log(self, "Remote interface change '"
..old_ifs.."' => '"..ifs.."'", true)
end
elseif type.name == 'vc_id' then
if type.get(tlv) ~= self._conf.vc_id then
log(self, "VC ID mismatch, local "..self._conf.vc_id
..", remote "..type.get(tlv), true)
status_ok = false
end
end
end
if not have_heartbeat_p then
log(self, "Heartbeat option missing in control message.", true)
status_ok = false
end
if status_ok then
set_InboundStatus_up(self, mib)
else
set_InboundStatus_down(self, mib)
end
end
-- Configuration options
-- {
-- name = <name>,
-- mtu = <mtu>,
-- vc_id = <vc_id>,
-- ac = <interface>,
-- [ shmem_dir = <shmem-dir>, ]
-- transport = { type = 'ipv6',
-- [hop_limit = <hop_limit>],
-- src = <vpn_source>,
-- dst = <vpn_destination> }
-- tunnel = { type = 'gre' | 'l2tpv3',
-- -- type gre
-- [checksum = true | false],
-- [key = <key> | nil]
-- -- type l2tpv3
-- [local_session = <local_session> | nil,]
-- [remote_session = <remote_session> | nil,]
-- [local_cookie = <cookie> | nil],
-- [remote_cookie = <cookie> | nil] } }
-- [ cc = { [ heartbeat = <heartbeat>, ]
-- [ dead_factor = <dead_factor>, ]
-- } ]
-- }
function pseudowire:new (conf_in)
local conf = conf_in or {}
local o = pseudowire:superClass().new(self)
o._conf = conf
local bpf_program
o._logger = logger.new({ module = o._name.." ("..o._conf.name..")" })
-- Construct templates for the entire encapsulation chain
-- Ethernet header
--
-- Use dummy values for the MAC addresses. The actual addresses
-- will be filled in by the ND-app to which the PW's uplink
-- connects.
o._ether = ethernet:new({ src = ethernet:pton('00:00:00:00:00:00'),
dst = ethernet:pton('00:00:00:00:00:00'),
type = 0x86dd })
-- Tunnel header
assert(conf.tunnel, "missing tunnel configuration")
-- The control-channel is de-activated if either no
-- configuration is present or if the heartbeat interval
-- is set to 0.
local have_cc = (conf.cc and not (conf.cc.heartbeat and
conf.cc.heartbeat == 0))
o._tunnel = require("program.l2vpn.tunnels."..
conf.tunnel.type):new(conf.tunnel, have_cc, o._logger)
-- Transport header
assert(conf.transport, "missing transport configuration")
o._transport = require("program.l2vpn.transports."..
conf.transport.type):new(conf.transport, o._tunnel.proto,
o._logger)
o._decap_header_size = ethernet:sizeof() + o._transport.header:sizeof()
-- We want to avoid copying the encapsulation headers one by one in
-- the push() loop. For this purpose, we create a template
-- datagram that contains only the headers, which can be prepended
-- to the data packets with a single call to push_raw(). In order
-- to be able to update the headers before copying, we re-locate
-- the headers to the payload of the template packet.
local template = datagram:new(packet.allocate())
template:push(o._tunnel.header)
template:push(o._transport.header)
template:push(o._ether)
template:new(template:packet(), ethernet) -- Reset the parse stack
o._tunnel.header:free()
o._transport.header:free()
o._ether:free()
template:parse_n(3)
o._ether, o._tunnel.transport, o._tunnel.header = unpack(template:stack())
o._template = template
-- Create a packet filter for the tunnel protocol
bpf_program = " ip6 proto "..o._tunnel.proto
local filter, errmsg = filter:new(bpf_program)
assert(filter, errmsg and ffi.string(errmsg))
o._filter = filter
-- Create a datagram for re-use in the push() loop
o._dgram = datagram:new(nil, nil, dgram_options)
packet.free(o._dgram:packet())
---- Set up shared memory to interface with the SNMP sub-agent that
---- provides the MIBs related to the pseudowire. The PWE3
---- architecture (Pseudo Wire Emulation Edge-to-Edge) described in
---- RFC3985 uses a layered system of MIBs to describe the service.
-----
---- The top layer is called the "service layer" and describes the
---- emulated service (e.g. Ethernet). The bottom layer is the
---- PSN-specific layer (Packet Switched Network) and describes how
---- the emulated service is transported across the underlying
---- network. The middle layer provides the glue between these
---- layers and describes generic properties of the pseudowire
---- (i.e. properties that are independent of both, the emulated
---- service and the PSN). This layer is called the "generic PW
---- layer".
----
---- The standard MIB for the generic layer is called STD-PW-MIB,
---- defined in RFC5601. Over 5 years old, Cisco still hasn't
---- managed to implement it on most of their devices at the time of
---- writing and uses a proprietary MIB based on a draft version
---- dating from 2004, available at
---- ftp://ftp.cisco.com/pub/mibs/v2/CISCO-IETF-PW-MIB.my
---- So, for the time being, we support both. Sigh.
----
---- The MIB contains a table for every PW. The objects pwType
---- (cpwVcType) and pwPsnType (cpwVcPsnType) indicate the types of
---- the service-specific and PSN-specific layers. The tunnel
---- types supported by this implementation are not standardized.
---- This is expressed by the PsnType "other" and, as a
---- consequence, there is no MIB that describes the PSN-specific
---- layer.
----
---- The values 4 (tagged Ethernet) and 5 (Ethernet)
---- pwType (cpwVcType) identify the service-specific MIB to be
---- PW-ENET-STD-MIB defined by RFC5603. Again, Cisco didn't
---- bother to implement the standard and keeps using a proprietary
---- version based on a draft of RFC5603 called
---- CISCO-IETF-PW-ENET-MIB, available from
---- ftp://ftp.cisco.com/pub/mibs/v2/CISCO-IETF-PW-ENET-MIB.my.
----
---- The rows of the ENET MIB are indexed by the same value as
---- those of the STD-PW-MIB (pwIndex/cpwVcIndex, managed by the
---- SNMP agent). They have a second index that makes rows unique
---- which are associated with the same PW in the case of tagged
---- ACs.
local mib = ipc_mib:new({ directory = conf.shmem_dir or '/tmp/snabb-shmem',
filename = conf.name })
--
-- STD-PW-MIB
--
mib:register('pwType', 'Integer32', 5) -- Ethernet
mib:register('pwOwner', 'Integer32', 1) -- manual
-- The PSN Type indicates how the PW is transported over the
-- underlying packet switched network. It's purpose is to identify
-- which MIB is used at the "PSN VC Layer according to the
-- definition in RFC 3985, Section 8. The encapsulations
-- implemented in the current version are not covered by the
-- PsnType, hence the choice of "other".
mib:register('pwPsnType', 'Integer32', 6) -- other
mib:register('pwSetUpPriority', 'Integer32', 0) -- unused
mib:register('pwHoldingPriority', 'Integer32', 0) -- unused
mib:register('pwPeerAddrType', 'Integer32', 2) -- IPv6
mib:register('pwPeerAddr', { type = 'OctetStr', length = 16},
ffi.string(conf.transport.dst, 16))
mib:register('pwAttachedPwIndex', 'Unsigned32', 0)
mib:register('pwIfIndex', 'Integer32', 0)
assert(conf.vc_id, "missing VC ID")
mib:register('pwID', 'Unsigned32', conf.vc_id)
mib:register('pwLocalGroupID', 'Unsigned32', 0) -- unused
mib:register('pwGroupAttachmentID', { type = 'OctetStr', length = 0}) -- unused
mib:register('pwLocalAttachmentID', { type = 'OctetStr', length = 0}) -- unused
mib:register('pwRemoteAttachmentID', { type = 'OctetStr', length = 0}) -- unused
mib:register('pwCwPreference', 'Integer32', 2) -- false
assert(conf.mtu, "missing MTU")
mib:register('pwLocalIfMtu', 'Unsigned32', conf.mtu)
mib:register('pwLocalIfString', 'Integer32', 1) -- true
-- We advertise the pwVCCV capability, even though our "control
-- channel" protocol is proprietary.
mib:register('pwLocalCapabAdvert', 'Bits', { 1 }) -- pwVCCV
mib:register('pwRemoteGroupID', 'Unsigned32', 0) -- unused
mib:register('pwCwStatus', 'Integer32', 6) -- cwNotPresent
mib:register('pwRemoteIfMtu', 'Unsigned32', 0) -- not yet known
mib:register('pwRemoteIfString', { type = 'OctetStr',
length = 80 }, '') -- not yet known
mib:register('pwRemoteCapabilities', 'Bits', { 1 }) -- pwVCCV, see pwLocalCapabAdvert
mib:register('pwFragmentCfgSize', 'Unsigned32', 0) -- fragmentation not desired
-- Should be advertised on the CC
mib:register('pwRmtFragCapability', 'Bits', { 0 }) -- NoFrag
mib:register('pwFcsRetentionCfg', 'Integer32', 1) -- fcsRetentionDisable
mib:register('pwFcsRetentionStatus', 'Bits', { 3 }) -- fcsRetentionDisabled
if o._tunnel.OutboundVcLabel ~= nil then
mib:register('pwOutboundLabel', 'Unsigned32', o._tunnel.OutboundVcLabel)
end
if o._tunnel.InboundVcLabel ~= nil then
mib:register('pwInboundLabel', 'Unsigned32', o._tunnel.InboundVcLabel)
end
mib:register('pwName', 'OctetStr', conf.interface)
mib:register('pwDescr', 'OctetStr', conf.description)
-- We record the PW creation time as a regular timestamp in a
-- auxiliary 64-bit variable with the suffix "_TimeAbs". The SNMP
-- agent recognises this convention and calculates the actual
-- TimeStamp object from it (defined as the difference between two epochs
-- of the sysUpTime object).
mib:register('pwCreateTime', 'TimeTicks')
mib:register('_X_pwCreateTime_TimeAbs', 'Counter64',
C.get_unix_time())
-- The absolute time stamp when the VC transitions to the "up"
-- state is recorded in the auxiliary variable with the suffix
-- "_TicksBase". The SNMP agent recognises this convention and
-- calculates the actual TimeTicks object as the difference between
-- the current time and this timestamp, unless the time stamp has
-- the value 0, in which case the actual object will be used.
mib:register('pwUpTime', 'TimeTicks', 0)
mib:register('_X_pwUpTime_TicksBase', 'Counter64', 0)
mib:register('pwLastChange', 'TimeTicks', 0)
mib:register('_X_pwLastChange_TicksBase', 'Counter64', 0)
mib:register('pwAdminStatus', 'Integer32', 1) -- up
mib:register('pwOperStatus', 'Integer32', 2) -- down
mib:register('pwLocalStatus', 'Bits', {}) -- no faults
-- The remote status capability is statically set to
-- "remoteCapable" due to the presence of the control channel. The
-- remote status is inferred from the reception of heartbeats.
-- When heartbeats are received, the remote status is set to no
-- faults (no bits set). If the peer is declared dead, the status
-- is set to pwNotForwarding. Complete fault signalling may be
-- implemented in the future.
--
-- XXX if the control-channel is disabled, we should mark remote as
-- not status capable, since we are not able to determine the status.
mib:register('pwRemoteStatusCapable', 'Integer32', 3) -- remoteCapable
mib:register('pwRemoteStatus', 'Bits', { 0 }) -- pwNotForwarding
-- pwTimeElapsed, pwValidIntervals not implemented
mib:register('pwRowStatus', 'Integer32', 1) -- active
mib:register('pwStorageType', 'Integer32', 2) -- volatile
mib:register('pwOamEnable', 'Integer32', 2) -- false
-- AII/AGI not applicable
mib:register('pwGenAGIType', 'Unsigned32', 0)
mib:register('pwGenLocalAIIType', 'Unsigned32', 0)
mib:register('pwGenRemoteAIIType', 'Unsigned32', 0)
-- The MIB contains a scalar object as a global (PW-independent)
-- error counter. Due to the design of the pseudowire app, each
-- instance counts its errors independently. The scalar variable
-- is thus part of the mib table of each PW. The SNMP agent is
-- configured to accumulate the counters for each PW and serve this
-- sum to SNMP clients for a request of this scalar object.
mib:register('pwPerfTotalErrorPackets', 'Counter32', 10)
--
-- CISCO-IETF-PW-MIB
--
mib:register('cpwVcType', 'Integer32', 5) -- Ethernet
mib:register('cpwVcOwner', 'Integer32', 1) -- manual
mib:register('cpwVcPsnType', 'Integer32', 6) -- other
mib:register('cpwVcSetUpPriority', 'Integer32', 0) -- unused
mib:register('cpwVcHoldingPriority', 'Integer32', 0) -- unused
mib:register('cpwVcInboundMode', 'Integer32', 2) -- strict
mib:register('cpwVcPeerAddrType', 'Integer32', 2) -- IPv6
mib:register('cpwVcPeerAddr', { type = 'OctetStr', length = 16},
ffi.string(conf.transport.dst, 16))
mib:register('cpwVcID', 'Unsigned32', conf.vc_id)
mib:register('cpwVcLocalGroupID', 'Unsigned32', 0) -- unused
mib:register('cpwVcControlWord', 'Integer32', 2) -- false
mib:register('cpwVcLocalIfMtu', 'Unsigned32', conf.mtu)
mib:register('cpwVcLocalIfString', 'Integer32', 1) -- true
mib:register('cpwVcRemoteGroupID', 'Unsigned32', 0) -- unused
mib:register('cpwVcRemoteControlWord', 'Integer32', 1) -- noControlWord
mib:register('cpwVcRemoteIfMtu', 'Unsigned32', 0) -- not yet known
mib:register('cpwVcRemoteIfString', { type = 'OctetStr',
length = 80 }, '') -- not yet known
if o._tunnel.OutboundVcLabel ~= nil then
mib:register('cpwVcOutboundVcLabel', 'Unsigned32', o._tunnel.OutboundVcLabel)
end
if o._tunnel.InboundVcLabel ~= nil then
mib:register('cpwVcInboundVcLabel', 'Unsigned32', o._tunnel.InboundVcLabel)
end
mib:register('cpwVcName', 'OctetStr', conf.interface)
mib:register('cpwVcDescr', 'OctetStr', conf.description)
mib:register('cpwVcCreateTime', 'TimeTicks')
mib:register('_X_cpwVcCreateTime_TimeAbs', 'Counter64',
C.get_unix_time())
mib:register('cpwVcUpTime', 'TimeTicks', 0)
mib:register('_X_cpwVcUpTime_TicksBase', 'Counter64', 0)
mib:register('cpwVcAdminStatus', 'Integer32', 1) -- up
mib:register('cpwVcOperStatus', 'Integer32', 2) -- down
mib:register('cpwVcInboundOperStatus', 'Integer32', 2) -- down
mib:register('cpwVcOutboundOperStatus', 'Integer32', 1) -- up
-- cpwVcTimeElapsed, cpwVcValidIntervals not implemented
mib:register('cpwVcRowStatus', 'Integer32', 1) -- active
mib:register('cpwVcStorageType', 'Integer32', 2) -- volatile
-- See comment for pwPerfTotalErrorPackets
mib:register('cpwVcPerfTotalErrorPackets', 'Counter64', 0)
--
-- PW-ENET-STD-MIB
--
mib:register('pwEnetPwInstance', 'Unsigned32', 1)
mib:register('pwEnetPwVlan', 'Integer32', 4095) -- raw mode, map all frames to the PW
mib:register('pwEnetVlanMode', 'Integer32', 1) -- portBased
mib:register('pwEnetPortVlan', 'Integer32', 4095)
mib:register('pwEnetPortIfIndex', 'Integer32', 0)
mib:register('_X_pwEnetPortIfIndex', 'OctetStr', conf.interface)
mib:register('pwEnetPwIfIndex', 'Integer32', 0) -- PW not modelled as ifIndex
mib:register('pwEnetRowStatus', 'Integer32', 1) -- active
mib:register('pwEnetStorageType', 'Integer32', 2) -- volatile
--
-- CISCO-IETF-PW-ENET-MIB
--
mib:register('cpwVcEnetPwVlan', 'Integer32', 4097) -- raw mode, map all frames to the PW
mib:register('cpwVcEnetVlanMode', 'Integer32', 1) -- portBased
mib:register('cpwVcEnetPortVlan', 'Integer32', 4097)
mib:register('cpwVcEnetPortIfIndex', 'Integer32', 0)
mib:register('_X_cpwVcEnetPortIfIndex', 'OctetStr', conf.interface)
mib:register('cpwVcEnetVcIfIndex', 'Integer32', 0) -- PW not modelled as ifIndex
mib:register('cpwVcEnetRowStatus', 'Integer32', 1) -- active
mib:register('cpwVcEnetStorageType', 'Integer32', 2) -- volatile
o._mib = mib
-- Set up the control channel
if have_cc then
local c = conf.cc
for k, v in pairs(cc_defaults) do
if c[k] == nil then
c[k] = v
end
end
-- -- Create a static packet to transmit on the control channel
local dgram = datagram:new(packet.allocate())
dgram:push(o._tunnel.cc_header)
dgram:push(o._transport.header)
dgram:push(o._ether)
cc.add_tlv(dgram, 'heartbeat', c.heartbeat)
cc.add_tlv(dgram, 'mtu', conf.mtu)
-- The if_description ends up in the
-- pwRemoteIfString/cpwVCRemoteIfString MIB objects. The
-- CISCO-IETF-PW-MIB refers to this value as the "interface's
-- name as appears on the ifTable". The STD-PW-MIB is more
-- specific and defines the value to be sent to be the ifAlias
-- of the local interface.
cc.add_tlv(dgram, 'if_description', conf.name)
cc.add_tlv(dgram, 'vc_id', conf.vc_id)
-- Set the IPv6 payload length
dgram:new(dgram:packet(), ethernet)
local cc_ipv6 = dgram:parse_n(2)
local _, p_length = dgram:payload()
cc_ipv6:payload_length(p_length)
dgram:unparse(2) -- Free parsed protos
o._cc = {}
-- Set up control-channel processing
o._cc.timer_xmit = timer.new("pw "..conf.name.." control-channel xmit",
function (t)
link.transmit(o.output.uplink,
packet.clone(dgram:packet()))
end,
1e9 * c.heartbeat, 'repeating')
o._cc.timer_hb = timer.new("pw "..conf.name.." control-channel heartbeat",
function(t)
if mib:get('cpwVcInboundOperStatus') == 1 then
local now = math.floor(tonumber(C.get_time_ns())/1e9)
local diff = now - o._cc.rcv_tstamp
local hb = o._cc.remote_hb
if diff > hb then
log(o, "Missed remote heartbeat, dead in "
..(hb*(c.dead_factor+1)-diff).." seconds", true)
end
if diff > hb * c.dead_factor then
log(o, "Peer declared dead", true)
set_InboundStatus_down(o, mib)
-- Disable timer. It will be
-- restarted when heartbeats
-- start coming in again
o._cc.remote_hb = nil
o._cc.timer_hb.repeating = false
end
end
end,
0)
timer.activate(o._cc.timer_xmit)
end
-- Packet pointer cache to avoid cdata allocation in the push()
-- loop
o._p = ffi.new("struct packet *[1]")
return o
end
local full, empty, receive, transmit = link.full, link.empty, link.receive, link.transmit
function pseudowire:push()
local l_in = self.input.ac
local l_out = self.output.uplink
local p = self._p
while not full(l_out) and not empty(l_in) do
p[0] = receive(l_in)
if self._cc and not self._forward then
-- The PW is marked non-functional by the control channel,
-- discard packet
packet.free(p[0])
return
end
local datagram = self._dgram:new(p[0], ethernet)
-- Perform actions on transport and tunnel headers required for
-- encapsulation
self._transport:encapsulate(datagram, self._tunnel.header)
self._tunnel:encapsulate(datagram)
-- Copy the finished headers into the packet
datagram:push_raw(self._template:data())
transmit(l_out, datagram:packet())
end
l_in = self.input.uplink
l_out = self.output.ac
while not full(l_out) and not empty(l_in) do
p[0] = receive(l_in)
local datagram = self._dgram:new(p[0], ethernet, dgram_options)
if self._filter:match(datagram:payload()) then
datagram:pop_raw(self._decap_header_size, self._tunnel.class)
local status, code = self._tunnel:decapsulate(datagram)
if status == true then
datagram:commit()
transmit(l_out, datagram:packet())
else
if code == 0 then
increment_errors(self)
elseif code == 1 then
process_cc(self, datagram)
end
packet.free(p[0])
end
else
packet.free(datagram:packet())
end
end
end
local function selftest_aux(type, pseudowire_config, local_mac, remote_mac)
local c = config.new()
local pcap_base = "program/l2vpn/selftest/"
local pcap_type = pcap_base..type
local nd_light = require("apps.ipv6.nd_light").nd_light
config.app(c, "nd", nd_light,
{ local_mac = local_mac,
remote_mac = remote_mac,
local_ip = "::",
next_hop = "::" })
config.app(c, "from_uplink", pcap.PcapReader, pcap_type.."-uplink.cap.input")
config.app(c, "from_ac", pcap.PcapReader, pcap_base.."ac.cap.input")
config.app(c, "to_ac", pcap.PcapWriter, pcap_type.."-ac.cap.output")
config.app(c, "to_uplink", pcap.PcapWriter, pcap_type.."-uplink.cap.output")
config.app(c, "pw", pseudowire, pseudowire_config)
config.link(c, "from_uplink.output -> nd.south")
config.link(c, "nd.north -> pw.uplink")
config.link(c, "pw.ac -> to_ac.input")
config.link(c, "from_ac.output -> pw.ac")
config.link(c, "pw.uplink -> nd.north")
config.link(c, "nd.south -> to_uplink.input")
app.configure(c)
app.main({duration = 1})
local ok = true
if (io.open(pcap_type.."-ac.cap.output"):read('*a') ~=
io.open(pcap_type.."-ac.cap.expect"):read('*a')) then
print('tunnel '..type..' decapsulation selftest failed.')
ok = false
end
if (io.open(pcap_type.."-uplink.cap.output"):read('*a') ~=
io.open(pcap_type.."-uplink.cap.expect"):read('*a')) then
print('tunnel '..type..' encapsulation selftest failed.')
ok = false
end
if not ok then os.exit(1) end
app.configure(config.new())
end
function selftest()
local local_mac = "90:e2:ba:62:86:e5"
local remote_mac = "28:94:0f:fd:49:40"
local local_ip = "2001:620:0:C101:0:0:0:2"
local local_vpn_ip = "2001:620:0:C000:0:0:0:FC"
local remote_vpn_ip = "2001:620:0:C000:0:0:0:FE"
local config = { name = "pw",
vc_id = 1,
mtu = 1500,
shmem_dir = "/tmp",
ethernet = { src = local_mac,
dst = remote_mac },
transport = { type = 'ipv6',
src = local_vpn_ip,
dst = remote_vpn_ip },
tunnel = { type = 'gre',
checksum = true,
key = 0x12345678 } }
selftest_aux('gre', config, local_mac, remote_mac)
config.tunnel = { type = 'l2tpv3',
local_session = 0x11111111,
remote_session = 0x22222222,
local_cookie = '\x00\x11\x22\x33\x44\x55\x66\x77',
remote_cookie = '\x88\x99\xaa\xbb\xcc\xdd\xee\xff' }
selftest_aux('l2tpv3', config, local_mac, remote_mac)
end
| apache-2.0 |
xponen/Zero-K | LuaRules/Gadgets/ai_testing_functions.lua | 8 | 8090 | function gadget:GetInfo()
return {
name = "AI testing functions",
desc = "Test small parts of AI.",
author = "Google Frog",
date = "April 20 2014",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
local ceil = math.ceil
local floor = math.floor
local max = math.max
local min = math.min
local sqrt = math.sqrt
local MAP_WIDTH = Game.mapSizeX
local MAP_HEIGHT = Game.mapSizeZ
local PATH_SQUARE = 256
local PATH_MID = PATH_SQUARE/2
local PATH_X = ceil(MAP_WIDTH/PATH_SQUARE)
local PATH_Z = ceil(MAP_HEIGHT/PATH_SQUARE)
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
if (gadgetHandler:IsSyncedCode()) then
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
local HeatmapHandler = VFS.Include("LuaRules/Gadgets/CAI/HeatmapHandler.lua")
local PathfinderGenerator = VFS.Include("LuaRules/Gadgets/CAI/PathfinderGenerator.lua")
local AssetTracker = VFS.Include("LuaRules/Gadgets/CAI/AssetTracker.lua")
local ScoutHandler = VFS.Include("LuaRules/Gadgets/CAI/ScoutHandler.lua")
local UnitClusterHandler = VFS.Include("LuaRules/Gadgets/CAI/UnitClusterHandler.lua")
---------------------------------------------------------------
-- Heatmapping
---------------------------------------------------------------
local enemyForceHandler = AssetTracker.CreateAssetTracker(0,0)
local aaHeatmap = HeatmapHandler.CreateHeatmap(256, 0)
_G.heatmap = aaHeatmap.heatmap
local scoutHandler = ScoutHandler.CreateScoutHandler(0)
local enemyUnitCluster = UnitClusterHandler.CreateUnitCluster(0, 900)
function gadget:UnitCreated(unitID, unitDefID, teamID)
if teamID == 1 then
enemyUnitCluster.AddUnit(unitID, UnitDefs[unitDefID].metalCost)
end
--scoutHandler.AddUnit(unitID)
end
function gadget:UnitDestroyed(unitID, unitDefID, teamID)
if teamID == 1 then
enemyUnitCluster.RemoveUnit(unitID)
end
end
---------------------------------------------------------------
-- Pathfinding
---------------------------------------------------------------
-- veh, bot, spider, ship, hover, amph, air
local paths = {
PathfinderGenerator.CreatePathfinder(UnitDefNames["correap"].id, "tank4", true),
PathfinderGenerator.CreatePathfinder(UnitDefNames["dante"].id, "kbot4", true),
PathfinderGenerator.CreatePathfinder(UnitDefNames["armcrabe"].id, "tkbot4", true),
PathfinderGenerator.CreatePathfinder(UnitDefNames["armmanni"].id, "hover3"),
PathfinderGenerator.CreatePathfinder(UnitDefNames["subarty"].id, "uboat3", true),
PathfinderGenerator.CreatePathfinder(UnitDefNames["amphassault"].id, "akbot4", true),
PathfinderGenerator.CreatePathfinder(UnitDefNames["armmanni"].id, "hover3"),
PathfinderGenerator.CreatePathfinder(),
}
_G.pathMap = paths[1].pathMap
--_G.botPathMap = botPath.pathMap
--_G.amphPathMap = amphPath.pathMap
--_G.hoverPathMap = hoverPath.pathMap
--_G.shipPathMap = shipPath.pathMap
function gadget:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID)
if allyTeam == 0 then
local x, _,z = Spring.GetUnitPosition(unitID)
aaHeatmap.AddUnitHeat(unitID, x, z, 780, 260 )
enemyForceHandler.AddUnit(unitID, unitDefID)
end
end
function gadget:GameFrame(f)
if f%60 == 14 then
scoutHandler.UpdateHeatmap(f)
scoutHandler.RunJobHandler()
--Spring.Echo(scoutHandler.GetScoutedProportion())
end
if f%30 == 3 then
enemyUnitCluster.UpdateUnitPositions(200)
for x,z,cost,count in enemyUnitCluster.ClusterIterator() do
--Spring.MarkerAddPoint(x,0,z, cost .. " " .. count)
end
aaHeatmap.UpdateUnitPositions(true)
end
end
function gadget:AllowCommand_GetWantedCommand()
return {[CMD.MOVE] = true, [CMD.FIGHT] = true, [CMD.WAIT] = true}
end
function gadget:AllowCommand_GetWantedUnitDefID()
return true
end
function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions)
if cmdID == CMD.MOVE then
--turretHeat.AddHeatCircle(cmdParams[1], cmdParams[3], 500, 50)
return true
end
if cmdID == CMD.WAIT then
return false
--local economyList = enemyForceHandler.GetUnitList("economy")
--economyList.UpdateClustering()
--economyList.ExtractCluster()
--local coord = economyList.GetClusterCoordinates()
--Spring.Echo(#coord)
--for i = 1, #coord do
-- local c = coord[i]
-- Spring.MarkerAddPoint(c[1],0,c[3], "Coord, " .. c[4] .. ", Count " .. c[5])
--end
--local centriod = economyList.GetClusterCostCentroid()
--Spring.Echo(#centriod)
--for i = 1, #centriod do
-- local c = centriod[i]
-- Spring.MarkerAddPoint(c[1],0,c[3], "Centriod, Cost " .. c[4] .. ", Count " .. c[5])
--end
----turretHeat.AddHeatCircle(cmdParams[1], cmdParams[3], 500, 50)
--return false
end
if cmdID == CMD.FIGHT then
--vehPath.SetDefenseHeatmaps({aaHeatmap})
--local waypoints, waypointCount = vehPath.GetPath(1150, 650, cmdParams[1], cmdParams[3], false, 0.02)
--if waypoints then
-- for i = 1, waypointCount do
-- Spring.MarkerAddPoint(waypoints[i].x, 0, waypoints[i].z,i)
-- end
--end
return true
end
return true
end
function gadget:Initialize()
for _, unitID in ipairs(Spring.GetAllUnits()) do
local unitDefID = Spring.GetUnitDefID(unitID)
local teamID = Spring.GetUnitTeam(unitID)
gadget:UnitCreated(unitID, unitDefID, teamID)
end
end
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
else -- UNSYNCED
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
local function DrawLine(x0, y0, z0, c0, x1, y1, z1, c1)
gl.Color(c0)
gl.Vertex(x0, y0, z0)
gl.Color(c1)
gl.Vertex(x1, y1, z1)
end
local function DrawPathLink(start, finish, relation, color)
if start.linkRelationMap[relation[1]] and start.linkRelationMap[relation[1]][relation[2]] then
local sx, sz = start.x, start.z
local fx, fz = finish.x, finish.z
local sColor = ((SYNCED.heatmap[sx] and SYNCED.heatmap[sx][sz] and SYNCED.heatmap[sx][sz].value) or 0)*0.01
local fColor = ((SYNCED.heatmap[fx] and SYNCED.heatmap[fx][fz] and SYNCED.heatmap[fx][fz].value) or 0)*0.01
DrawLine(
start.px, start.py, start.pz, {sColor, sColor, sColor, 1},
finish.px, finish.py, finish.pz, {fColor, fColor, fColor, 1}
)
end
end
local function DrawGraph(array, color)
for i = 1, PATH_X do
for j = 1, PATH_Z do
if i < PATH_X then
DrawPathLink(array[i][j], array[i+1][j], {1,0})
end
if j < PATH_Z then
DrawPathLink(array[i][j], array[i][j+1], {0,1})
end
end
end
end
local function DrawPathMaps()
--gl.LineWidth(10)
--if SYNCED and SYNCED.shipPathMap then
-- gl.BeginEnd(GL.LINES, DrawGraph, SYNCED.shipPathMap, {0,1,1,0.5})
--end
--gl.LineWidth(7)
--if SYNCED and SYNCED.hoverPathMap then
-- gl.BeginEnd(GL.LINES, DrawGraph, SYNCED.hoverPathMap, {1,0,1,0.5})
--end
--gl.LineWidth(5)
--if SYNCED and SYNCED.amphPathMap then
-- gl.BeginEnd(GL.LINES, DrawGraph, SYNCED.amphPathMap, {0.8,0.8,0,0.5})
--end
--gl.LineWidth(3)
--if SYNCED and SYNCED.botPathMap then
-- gl.BeginEnd(GL.LINES, DrawGraph, SYNCED.botPathMap, {0,1,0.1,1})
--end
gl.LineWidth(2)
if SYNCED and SYNCED.pathMap and SYNCED.heatmap then
gl.BeginEnd(GL.LINES, DrawGraph, SYNCED.pathMap)
end
end
function gadget:DrawWorldPreUnit()
--DrawPathMaps()
end
function gadget:Initialize()
gadgetHandler:AddSyncAction('SetHeatmapDrawData',SetHeatmapDrawData)
end
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
end -- END UNSYNCED
-------------------------------------------------------------------------------------
------------------------------------------------------------------------------------- | gpl-2.0 |
DigitalVeer/Lua-Snippets | RobloxConcepts/CustomCamera.lua | 2 | 3592 | repeat wait() until game.Players.LocalPlayer;
local player = game.Players.LocalPlayer;
repeat wait() until player.Character;
repeat wait() until player.Character:FindFirstChild("Humanoid");
local character = player.Character;
local currentArm = character:FindFirstChild("Right Arm");
workspace.CurrentCamera:Destroy()
wait()
local camera = workspace.CurrentCamera;
camera.CameraType = "Scriptable"
camera.FieldOfView = 80;
local mouse = player:GetMouse();
local camPart = Instance.new("Part", camera);
camPart.FormFactor = "Custom"
camPart.Size = Vector3.new(.2,.2,.2)
camPart.Anchored = true;
camPart.CanCollide = false;
camPart.Name = "CameraPart";
--camPart.Shape = "Ball";
camPart.TopSurface = "Smooth";
camPart.BottomSurface = "Smooth";
camPart.BrickColor = BrickColor.new("White");
camPart.Transparency = .8;
local centerPart = character.HumanoidRootPart;
local motivator = Instance.new("BodyPosition", camPart);
motivator.D = motivator.D / 2;
local angle = 0;
local anglex = math.deg(({centerPart.CFrame:toEulerAnglesXYZ()})[1]);
local lastpos = Vector2.new(mouse.ViewSizeX/2, mouse.ViewSizeY/2);
local position = CFrame.new(centerPart.Position, centerPart.Position + centerPart.CFrame.lookVector) * CFrame.new((centerPart.Size.X/2) + currentArm.Size.X, centerPart.Size.Y/2, 0)
local pos = CFrame.new();
position = centerPart.CFrame:toObjectSpace(position);
print(position);
character.Humanoid.AutoRotate = false;
local characterMover = Instance.new("BodyGyro", character.HumanoidRootPart);
characterMover.maxTorque = Vector3.new(0, 400000, 0);
function updatePart()
local anglexPadder = anglex;
motivator.position = ((centerPart.CFrame * position) + (
(centerPart.CFrame * position * CFrame.Angles(math.rad(angle),0, 0)).lookVector * 10)).p
characterMover.cframe = CFrame.new(centerPart.Position) * CFrame.Angles(0, math.rad(-anglexPadder), 0);
end
camPart.Anchored = false;
camPart:BreakJoints();
local deltax = 0;
local deltay = 0;
function mouseMoveDeltaHandler(deltax, deltay)
if deltax~=0 then
local deltaxSign = deltax / math.abs(deltax);
local deltaxMove = (math.abs(deltax)>=5 and 5 or 1);
anglex = ((anglex + ((deltaxMove * deltaxSign)))) % 360;
else
end
if deltay~=0 then
local deltaySign = deltay / math.abs(deltay);
local deltayMove = (math.abs(deltay)>=5 and -5 or -1);
angle = math.min(math.max(angle + (deltayMove * deltaySign), -20), 30);
else
end;
updatePart();
end
game:GetService("UserInputService").MouseIconEnabled = false
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter;
game:GetService("UserInputService").InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
mouseMoveDeltaHandler(inputObject.Delta.x, inputObject.Delta.y);
print("delta is (" .. tostring(inputObject.Delta.x) .. ", " .. tostring(inputObject.Delta.y) .. ")")
end
end)
game:GetService("RunService").RenderStepped:connect(function()
updatePart();
pos = centerPart.CFrame * position;
local lookCFrame = CFrame.new(motivator.position, pos.p)
-- pos = pos + (lookCFrame.lookVector * 7);
-- pos = pos + Vector3.new(3, 4, 4);
camera.CoordinateFrame = CFrame.new(pos.p, camPart.Position);
end)
local b2Down = false;
mouse.Button2Down:connect(function()
b2Down = true;
for i = camera.FieldOfView, 50, -10 do
if not b2Down then break end;
camera.FieldOfView = i
wait()
end
end)
mouse.Button2Up:connect(function()
b2Down = false;
for i = camera.FieldOfView, 80, 10 do
if b2Down then break end;
camera.FieldOfView = i;
wait();
end
end)
| mit |
Schaka/gladdy | Libs/AceGUI-3.0/widgets/AceGUIWidget-ScrollFrame.lua | 7 | 6348 | local AceGUI = LibStub("AceGUI-3.0")
-------------
-- Widgets --
-------------
--[[
Widgets must provide the following functions
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
And the following members
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
type - the type of the object, same as the name given to :RegisterWidget()
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet
It will be cleared automatically when a widget is released
Placing values directly into a widget object should be avoided
If the Widget can act as a container for other Widgets the following
content - frame or derivitive that children will be anchored to
The Widget can supply the following Optional Members
]]
--------------------------
-- Scroll Frame --
--------------------------
do
local Type = "ScrollFrame"
local Version = 3
local function OnAcquire(self)
end
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
end
local function SetScroll(self, value)
local status = self.status or self.localstatus
local frame, child = self.scrollframe, self.content
local viewheight = frame:GetHeight()
local height = child:GetHeight()
local offset
if viewheight > height then
offset = 0
else
offset = floor((height - viewheight) / 1000.0 * value)
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset)
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset)
status.offset = offset
status.scrollvalue = value
end
local function MoveScroll(self, value)
local status = self.status or self.localstatus
local frame, child = self.scrollframe, self.content
local height, viewheight = frame:GetHeight(), child:GetHeight()
if height > viewheight then
self.scrollbar:Hide()
else
self.scrollbar:Show()
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.scrollbar:SetValue(math.min(math.max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end
local function FixScroll(self)
local status = self.status or self.localstatus
local frame, child = self.scrollframe, self.content
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset = status.offset
if not offset then
offset = 0
end
local curvalue = self.scrollbar:GetValue()
if viewheight < height then
self.scrollbar:Hide()
self.scrollbar:SetValue(0)
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0)
else
self.scrollbar:Show()
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-16,0)
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.scrollbar:SetValue(value)
self:SetScroll(value)
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset)
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset)
status.offset = offset
end
end
end
local function OnMouseWheel(this,value)
this.obj:MoveScroll(value)
end
local function OnScrollValueChanged(this, value)
this.obj:SetScroll(value)
end
local function FixScrollOnUpdate(this)
this:SetScript("OnUpdate", nil)
this.obj:FixScroll()
end
local function OnSizeChanged(this)
--this:SetScript("OnUpdate", FixScrollOnUpdate)
this.obj:FixScroll()
end
local function LayoutFinished(self,width,height)
self.content:SetHeight(height or 0 + 20)
self:FixScroll()
end
-- called to set an external table to store status in
local function SetStatusTable(self, status)
assert(type(status) == "table")
self.status = status
if not status.scrollvalue then
status.scrollvalue = 0
end
end
local createdcount = 0
local function OnWidthSet(self, width)
local content = self.content
content.width = width
end
local function OnHeightSet(self, height)
local content = self.content
content.height = height
end
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
self.type = Type
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
self.SetScroll = SetScroll
self.LayoutFinished = LayoutFinished
self.SetStatusTable = SetStatusTable
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.localstatus = {}
self.frame = frame
frame.obj = self
--Container Support
local scrollframe = CreateFrame("ScrollFrame",nil,frame)
local content = CreateFrame("Frame",nil,scrollframe)
createdcount = createdcount + 1
local scrollbar = CreateFrame("Slider",("AceConfigDialogScrollFrame%dScrollBar"):format(createdcount),scrollframe,"UIPanelScrollBarTemplate")
local scrollbg = scrollbar:CreateTexture(nil,"BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetTexture(0,0,0,0.4)
self.scrollframe = scrollframe
self.content = content
self.scrollbar = scrollbar
scrollbar.obj = self
scrollframe.obj = self
content.obj = self
scrollframe:SetScrollChild(content)
scrollframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-16,0)
scrollframe:EnableMouseWheel(true)
scrollframe:SetScript("OnMouseWheel", OnMouseWheel)
scrollframe:SetScript("OnSizeChanged", OnSizeChanged)
content:SetPoint("TOPLEFT",scrollframe,"TOPLEFT",0,0)
content:SetPoint("TOPRIGHT",scrollframe,"TOPRIGHT",0,0)
content:SetHeight(400)
scrollbar:SetPoint("TOPLEFT",scrollframe,"TOPRIGHT",0,-16)
scrollbar:SetPoint("BOTTOMLEFT",scrollframe,"BOTTOMRIGHT",0,16)
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged)
scrollbar:SetMinMaxValues(0,1000)
scrollbar:SetValueStep(1)
scrollbar:SetValue(0)
scrollbar:SetWidth(16)
self.localstatus.scrollvalue = 0
self:FixScroll()
AceGUI:RegisterAsContainer(self)
--AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
| mit |
anvilvapre/OpenRA | mods/ra/maps/soviet-04b/soviet04b-AI.lua | 19 | 3108 | IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end
IdlingUnits = function()
local lazyUnits = Greece.GetGroundAttackers()
Utils.Do(lazyUnits, function(unit)
Trigger.OnDamaged(unit, function()
Trigger.ClearAll(unit)
Trigger.AfterDelay(0, function() IdleHunt(unit) end)
end)
end)
end
BasePower = { type = "powr", pos = CVec.New(-4, -2), cost = 300, exists = true }
BaseBarracks = { type = "tent", pos = CVec.New(-8, 1), cost = 400, exists = true }
BaseProc = { type = "proc", pos = CVec.New(-5, 1), cost = 1400, exists = true }
BaseWeaponsFactory = { type = "weap", pos = CVec.New(-12, -1), cost = 2000, exists = true }
BaseBuildings = { BasePower, BaseBarracks, BaseProc, BaseWeaponsFactory }
BuildBase = function()
for i,v in ipairs(BaseBuildings) do
if not v.exists then
BuildBuilding(v)
return
end
end
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
if CYard.IsDead or CYard.Owner ~= Greece then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
end
local actor = Actor.Create(building.type, true, { Owner = Greece, Location = GreeceCYard.Location + building.pos })
Greece.Cash = Greece.Cash - building.cost
building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
end
end)
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end)
end
ProduceInfantry = function()
if not BaseBarracks.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(AlliedInfantryTypes) }
local Path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
InfAttack[#InfAttack + 1] = unit[1]
if #InfAttack >= 10 then
SendUnits(InfAttack, Path)
InfAttack = { }
Trigger.AfterDelay(DateTime.Minutes(2), ProduceInfantry)
else
Trigger.AfterDelay(delay, ProduceInfantry)
end
end)
end
ProduceArmor = function()
if not BaseWeaponsFactory.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 599 then
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
local toBuild = { Utils.Random(AlliedArmorTypes) }
local Path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
ArmorAttack[#ArmorAttack + 1] = unit[1]
if #ArmorAttack >= 6 then
SendUnits(ArmorAttack, Path)
ArmorAttack = { }
Trigger.AfterDelay(DateTime.Minutes(3), ProduceArmor)
else
Trigger.AfterDelay(delay, ProduceArmor)
end
end)
end
SendUnits = function(units, waypoints)
Utils.Do(units, function(unit)
if not unit.IsDead then
Utils.Do(waypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
unit.Hunt()
end
end)
end
| gpl-3.0 |
xponen/Zero-K | units/factorytank.lua | 1 | 4768 | unitDef = {
unitname = [[factorytank]],
name = [[Heavy Tank Factory]],
description = [[Produces Heavy and Specialized Vehicles, Builds at 10 m/s]],
acceleration = 0,
bmcode = [[0]],
brakeRate = 0,
buildCostEnergy = 600,
buildCostMetal = 600,
builder = true,
buildingGroundDecalDecaySpeed = 30,
buildingGroundDecalSizeX = 10,
buildingGroundDecalSizeY = 8,
buildingGroundDecalType = [[factorytank_aoplane.dds]],
buildoptions = {
[[coracv]],
[[logkoda]],
[[panther]],
[[tawf114]],
[[correap]],
[[corgol]],
[[cormart]],
[[trem]],
[[corsent]],
},
buildPic = [[factorytank.png]],
buildTime = 600,
canMove = true,
canPatrol = true,
canstop = [[1]],
category = [[SINK UNARMED]],
collisionVolumeTest = 1,
corpse = [[DEAD]],
customParams = {
description_de = [[Produziert schwere und speziallisierte Fahrzeuge, Baut mit 10 M/s]],
description_pl = [[Buduje czolgi, moc 10 m/s]],
helptext = [[The Heavy Tank Factory is the ultimate in brute force methods - nothing gets the job done quite like a sustained artillery barrage followed by a decisive push with the largest tanks in the field. Key units: Pillager, Reaper, Banisher, Goliath]],
helptext_de = [[Die Heavy Tank Factory ist das Ultimum für brachiale Gewalt. Nicht erledigt den Auftrag zu gut, wie ein anhaltendes Artilleriefeuer, gefolgt von einem entscheidenen Vorstoß mit den größten Panzern auf dem Feld. Wichtigste Einheiten: Pillager, Reaper, Banisher, Goliath]],
helptext_pl = [[Czolgi reprezentuja najprostsze podejscie do problemow - brutalna sile. Fabryka czolgow oferuje najciezsze sposrod polowych jednostek.]],
sortName = [[6]],
},
energyMake = 0.25,
energyUse = 0,
explodeAs = [[LARGE_BUILDINGEX]],
footprintX = 10,
footprintZ = 8,
iconType = [[factank]],
idleAutoHeal = 5,
idleTime = 1800,
levelGround = false,
mass = 324,
maxDamage = 4000,
maxSlope = 15,
maxVelocity = 0,
maxWaterDepth = 0,
metalMake = 0.25,
minCloakDistance = 150,
noAutoFire = false,
objectName = [[coravp2.s3o]],
script = [[factorytank.lua]],
seismicSignature = 4,
selfDestructAs = [[LARGE_BUILDINGEX]],
showNanoSpray = false,
side = [[CORE]],
sightDistance = 273,
smoothAnim = true,
sortbias = [[0]],
TEDClass = [[PLANT]],
turnRate = 0,
useBuildingGroundDecal = true,
workerTime = 10,
yardMap = [[oooooooooo oooooooooo oooooooooo oooccccooo oooccccooo yooccccooy yooccccooy yyoccccoyy ]],
featureDefs = {
DEAD = {
description = [[Wreckage - Heavy Tank Factory]],
blocking = true,
category = [[corpses]],
damage = 4000,
energy = 0,
featureDead = [[HEAP]],
featurereclamate = [[SMUDGE01]],
footprintX = 6,
footprintZ = 6,
height = [[20]],
hitdensity = [[100]],
metal = 240,
object = [[CORAVP_DEAD.s3o]],
reclaimable = true,
reclaimTime = 240,
seqnamereclamate = [[TREE1RECLAMATE]],
world = [[All Worlds]],
},
HEAP = {
description = [[Debris - Heavy Tank Factory]],
blocking = false,
category = [[heaps]],
damage = 4000,
energy = 0,
featurereclamate = [[SMUDGE01]],
footprintX = 6,
footprintZ = 6,
height = [[4]],
hitdensity = [[100]],
metal = 120,
object = [[debris4x4a.s3o]],
reclaimable = true,
reclaimTime = 120,
seqnamereclamate = [[TREE1RECLAMATE]],
world = [[All Worlds]],
},
},
}
return lowerkeys({ factorytank = unitDef })
| gpl-2.0 |
qskycolor/wax | lib/stdlib/helpers/frame.lua | 19 | 2670 | -- This is weird code... I'm just playing with an idea
function wax.frame(object)
return wax.dimensions(object, "frame")
end
function wax.bounds(object)
return wax.dimensions(object, "bounds")
end
function wax.dimensions(object, varName)
return setmetatable({
object = object,
center = function(self)
local offset = (wax.dimensions(self.object:superview(), varName).width - self.width) / 2
self.x = offset
return self
end,
},
{
__index = function(self, key)
if key == "y" then key = "top"
elseif key == "x" then key = "left"
end
local dimensions = (varName == "frame") and object:frame() or object:bounds()
if key == "left" then return dimensions.x
elseif key == "right" then return dimensions.x + dimensions.width
elseif key == "top" then return dimensions.y
elseif key == "bottom" then return dimensions.y + dimensions.height
elseif key == "height" then return dimensions.height
elseif key == "width" then return dimensions.width
elseif key == "size" then return CGSize(dimensions.width, dimensions.height)
elseif key == "origin" then return CGPoint(dimensions.x, dimensions.y)
else
error("Unknown frame key: " .. key)
end
end,
__newindex = function(self, key, value)
if key == "y" then key = "top"
elseif key == "x" then key = "left"
end
local dimensions = (varName == "frame") and object:frame() or object:bounds()
if key == "left" then dimensions.x = value
elseif key == "right" then dimensions.x = value - dimensions.width
elseif key == "top" then dimensions.y = value
elseif key == "bottom" then dimensions.y = value - dimensions.height
elseif key == "height" then dimensions.height = value
elseif key == "width" then dimensions.width = value
elseif key == "size" then dimensions.width = value.width dimensions.height = value.height
elseif key == "origin" then dimensions.x = value.x dimensions.y = value.y
elseif key == "stretchTop" then
dimensions.height = dimensions.height - (value - dimensions.y)
dimensions.y = value
elseif key == "stretchBottom" then
dimensions.height = dimensions.height + (value - (dimensions.height + dimensions.y))
elseif key == "stretchRight" then
dimensions.width = dimensions.width + (value - (dimensions.width + dimensions.x))
else
error("Unknown frame key: " .. key)
end
if (varName == "frame") then
object:setFrame(dimensions)
else
object:setBounds(dimensions)
end
return self
end
})
end | mit |
4aiman/MineClone | mods/head/init.lua | 3 | 1194 | -- head system
function addhead(node, desc)
minetest.register_node("head:"..node, {
description = ""..desc,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{ -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, },
},
},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,head=1},
tiles = {
node.."_top.png",
node.."_top.png",
node.."_left.png",
node.."_right.png",
node.."_back.png",
node.."_face.png",
},
paramtype = "light",
stack_max = 16,
paramtype2 = "facedir",
sunlight_propagates = true,
walkable = true,
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, },
},
})
end
--head add
addhead("zombie", "Zombie Head")
addhead("creeper", "Creeper Head")
addhead("steve", "Steve Head")
addhead("herobrine", "Herobrine Head")
minetest.register_abm(
{nodenames = {"head:herobrine"},
interval = 70,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
if math.random(1, 200) <= 1 then
minetest.add_entity(pos, "mobs:herobrine")
minetest.chat_send_all("Herobrine : I'm Here for you !")
end
end,
})
| lgpl-2.1 |
m2fan/cc | plugins/inrealm1.lua | 1 | 16761 | -- data saved to moderation.json
-- check moderation plugin
do
local function create_group(msg)
-- superuser and admins only (because sudo are always has privilege)
if is_sudo(msg) or is_realm(msg) and is_admin(msg) then
local group_creator = msg.from.print_name
create_group_chat (group_creator, group_name, ok_cb, false)
return 'Group '..string.gsub(group_name, '_', ' ')..' has been created.'
end
end
local function set_description(msg, data, target, about)
if not is_admin(msg) then
return "For admins only!"
end
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'Set group description to:\n'..about
end
local function set_rules(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'Set group rules to:\n'..rules
end
-- lock/unlock group name. bot automatically change group name when locked
local function lock_group_name(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'Group name is already locked'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'Group name has been locked'
end
end
local function unlock_group_name(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'Group name is already unlocked'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'Group name has been unlocked'
end
end
--lock/unlock group member. bot automatically kick new added user when locked
local function lock_group_member(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Group members are already locked'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Group members has been locked'
end
local function unlock_group_member(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Group members are not locked'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Group members has been unlocked'
end
end
--lock/unlock group photo. bot automatically keep group photo when locked
local function lock_group_photo(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'yes' then
return 'Group photo is already locked'
else
data[tostring(target)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
end
return 'Please send me the group photo now'
end
local function unlock_group_photo(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'Group photo is not locked'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'Group photo has been unlocked'
end
end
local function lock_group_flood(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Group flood is locked'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Group flood has been locked'
end
end
local function unlock_group_flood(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Group flood is not locked'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Group flood has been unlocked'
end
end
-- show group settings
local function show_group_settings(msg, data, target)
if not is_admin(msg) then
return "For admins only!"
end
local settings = data[tostring(target)]['settings']
local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member
return text
end
local function returnids(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
local text = 'Users in '..string.gsub(chatname,"_"," ")..' ('..result.id..'):'..'\n'..''
for k,v in pairs(result.members) do
local username = ""
text = text .. "- " .. string.gsub(v.print_name,"_"," ") .. " (" .. v.id .. ") \n"
end
send_large_msg(receiver, text)
local file = io.open("./groups/"..result.id.."memberlist.txt", "w")
file:write(text)
file:flush()
file:close()
end
local function returnidsfile(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
local text = 'Users in '..string.gsub(chatname,"_"," ")..' ('..result.id..'):'..'\n'..''
for k,v in pairs(result.members) do
local username = ""
text = text .. "- " .. string.gsub(v.print_name,"_"," ") .. " (" .. v.id .. ") \n"
end
local file = io.open("./groups/"..result.id.."memberlist.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..result.id,"./groups/"..result.id.."memberlist.txt", ok_cb, false)
end
local function admin_promote(msg, admin_id)
if not is_sudo(msg) then
return "Access denied!"
end
local data = load_data(_config.moderation.data)
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
if data[tostring(admins)][tostring(admin_id)] then
return admin_name..' is already an admin.'
end
data[tostring(admins)][tostring(admin_id)] = admin_id
save_data(_config.moderation.data, data)
return admin_id..' has been promoted as admin.'
end
local function admin_demote(msg, admin_id)
if not is_sudo(msg) then
return "Access denied!"
end
local data = load_data(_config.moderation.data)
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
if not data[tostring(admins)][tostring(admin_id)] then
return admin_id..' is not an admin.'
end
data[tostring(admins)][tostring(admin_id)] = nil
save_data(_config.moderation.data, data)
return admin_id..' has been demoted from admin.'
end
local function admin_list(msg)
local data = load_data(_config.moderation.data)
local admins = 'admins'
if not data[tostring(admins)] then
data[tostring(admins)] = {}
save_data(_config.moderation.data, data)
end
local message = 'List for Realm admins:\n'
for k,v in pairs(data[tostring(admins)]) do
message = message .. '- (at)' .. v .. ' [' .. k .. '] ' ..'\n'
end
return message
end
local function group_list(msg)
local data = load_data(_config.moderation.data)
local groups = 'groups'
if not data[tostring(groups)] then
return 'No groups at the moment'
end
local message = 'List of groups:\n'
for k,v in pairs(data[tostring(groups)]) do
local settings = data[tostring(v)]['settings']
for m,n in pairs(settings) do
if m == 'set_name' then
name = n
end
end
local group_owner = "no owner"
if data[tostring(v)]['set_owner'] then
group_owner = tostring(data[tostring(v)]['set_owner'])
end
print(group_owner)
message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n'
end
local file = io.open("groups.txt", "w")
file:write(message)
file:flush()
file:close()
return message
end
local function admin_user_promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
if not data['admins'] then
data['admins'] = {}
save_data(_config.moderation.data, data)
end
if data['admins'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is already as admin.')
end
data['admins'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, '@'..member_username..' has been promoted as admin.')
end
local function admin_user_demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
if not data['admins'] then
data['admins'] = {}
save_data(_config.moderation.data, data)
end
if not data['admins'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' is not an admin.')
end
data['admins'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'Admin '..member_username..' has been demoted.')
end
local function username_id(cb_extra, success, result)
local mod_cmd = cb_extra.mod_cmd
local receiver = cb_extra.receiver
local member = cb_extra.member
local text = 'No user @'..member..' in this group.'
for k,v in pairs(result.members) do
vusername = v.username
if vusername == member then
member_username = member
member_id = v.id
if mod_cmd == 'addadmin' then
return admin_user_promote(receiver, member_username, member_id)
elseif mod_cmd == 'removeadmin' then
return admin_user_demote(receiver, member_username, member_id)
end
end
end
send_large_msg(receiver, text)
end
function run(msg, matches)
--vardump(msg)
if matches[1] == 'creategroup' and matches[2] then
group_name = matches[2]
return create_group(msg)
end
if matches[1] == 'log' and is_owner(msg) then
savelog(msg.to.id, "log file created by owner")
send_document("chat#id"..msg.to.id,"./groups/"..msg.to.id.."log.txt", ok_cb, false)
end
if matches[1] == 'who' and is_momod(msg) then
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list ")
local receiver = get_receiver(msg)
chat_info(receiver, returnidsfile, {receiver=receiver})
end
if matches[1] == 'wholist' and is_momod(msg) then
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list in a file")
local receiver = get_receiver(msg)
chat_info(receiver, returnids, {receiver=receiver})
end
if not is_realm(msg) then
return
end
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if matches[2] then if data[tostring(matches[2])] then
local settings = data[tostring(matches[2])]['settings']
if matches[1] == 'setabout' and matches[2] then
local target = matches[2]
local about = matches[3]
return set_description(msg, data, target, about)
end
if matches[1] == 'setrules' then
rules = matches[3]
local target = matches[2]
return set_rules(msg, data, target)
end
if matches[1] == 'lock' then --group lock *
local target = matches[2]
if matches[3] == 'name' then
return lock_group_name(msg, data, target)
end
if matches[3] == 'member' then
return lock_group_member(msg, data, target)
end
if matches[3] == 'photo' then
return lock_group_photo(msg, data, target)
end
if matches[3] == 'flood' then
return lock_group_flood(msg, data, target)
end
end
if matches[1] == 'unlock' then --group unlock *
local target = matches[2]
if matches[3] == 'name' then
return unlock_group_name(msg, data, target)
end
if matches[3] == 'member' then
return unlock_group_member(msg, data, target)
end
if matches[3] == 'photo' then
return unlock_group_photo(msg, data, target)
end
if matches[3] == 'flood' then
return unlock_group_flood(msg, data, target)
end
end
if matches[1] == 'setting' and data[tostring(matches[2])]['settings'] then
local target = matches[2]
return show_group_settings(msg, data, target)
end
if matches[1] == 'setname' and is_admin(msg) then
local new_name = string.gsub(matches[3], '_', ' ')
data[tostring(matches[2])]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(matches[2])]['settings']['set_name']
local to_rename = 'chat#id'..matches[2]
rename_chat(to_rename, group_name_set, ok_cb, false)
end
end end
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
if not is_admin(msg) then
chat_del_user(chat, user, ok_cb, true)
end
end
if matches[1] == 'addadmin' then
if string.match(matches[2], '^%d+$') then
local admin_id = matches[2]
print("user "..admin_id.." has been promoted as admin")
return admin_promote(msg, admin_id)
else
local member = string.gsub(matches[2], "@", "")
local mod_cmd = "addadmin"
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
end
if matches[1] == 'removeadmin' then
if string.match(matches[2], '^%d+$') then
local admin_id = matches[2]
print("user "..admin_id.." has been demoted")
return admin_demote(msg, admin_id)
else
local member = string.gsub(matches[2], "@", "")
local mod_cmd = "removeadmin"
chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member})
end
end
if matches[1] == 'list' and matches[2] == 'admins' then
return admin_list(msg)
end
if matches[1] == 'list' and matches[2] == 'groups' then
group_list(msg)
send_document("chat#id"..msg.to.id, "groups.txt", ok_cb, false)
return " Group list created" --group_list(msg)
end
end
return {
patterns = {
"^(creategroup) (.*)$",
"^(setabout) (%d+) (.*)$",
"^(setrules) (%d+) (.*)$",
"^(setname) (%d+) (.*)$",
"^(lock) (%d+) (.*)$",
"^(unlock) (%d+) (.*)$",
"^(setting) (%d+)$",
"^(wholist)$",
"^(who)$",
"^(addadmin) (.*)$", -- sudoers only
"^(removeadmin) (.*)$", -- sudoers only
"^(list) (.*)$",
"^(log)$",
"^!!tgservice (.+)$",
},
run = run
}
end
| gpl-2.0 |
PixelCraft3D/PixelCraft_game | files/craftingguide/init.lua | 1 | 5793 | --
-- Crafting guide mod
-- By Kaadmy, for Pixture
--
craftingguide = {}
craftingguide.items = {}
craftingguide.itemlist = {}
craftingguide.users = {} -- {item = selected item, itemno = recipe no., page = page no.}
local page_size = 8 * 4
function craftingguide.get_formspec(name)
local user = craftingguide.users[name]
local page = user.page
local max_pages = math.floor(#craftingguide.itemlist / page_size) + 1
local form = ""
form = form .. default.ui.get_page("core_craftingguide")
form = form .. "label[0.41,1.74;"..user.itemno.."/"..#craftingguide.items[user.item].."]" -- itemno
form = form .. "label[3.9,8.15;"..page.."/"..max_pages.."]" -- page
form = form .. "label[4.4,2.5;"..user.item.."]" -- itemname
local method = craftingguide.items[user.item][user.itemno].type
if method == "normal" or method == "crafting" then
form = form .. "image[4.25,1.5;1,1;craftingguide_method_crafting.png]"
elseif method == "cooking" then
form = form .. "image[4.25,1.5;1,1;craftingguide_method_cooking.png]"
-- fuel recipes are different
-- elseif method == "fuel" then
-- form = form .. "image[4.25,1.5;1,1;craftingguide_method_fuel.png]"
else
form = form .. "image[4.25,1.5;1,1;craftingguide_method_unknown.png]"
form = form .. "label[4.1,1.73;"..method.."]"
end
form = form .. default.ui.fake_itemstack(6.25, 1.5, ItemStack(user.item), "guide_craftresult")
local recipes = craftingguide.items[user.item]
local recipe = recipes[user.itemno]
-- print(dump(recipe))
for slot_index, itemname in pairs(recipe.items) do
local x = slot_index - 1
local group = string.match(itemname, "group:(.*)")
if group == nil then
form = form .. default.ui.fake_simple_itemstack(1.25 + (x % 3), 0.5 + math.floor(x / 3), itemname, "guide_craftgrid_"..itemname)
else
form = form .. default.ui.item_group(1.25 + (x % 3), 0.5 + math.floor(x / 3), group, "guide_craftgrid_"..itemname)
end
end
local page_start = ((page * page_size) - page_size) + 1
local inv_x = 0
local inv_y = 0
for item_index = page_start, (page_start + page_size) - 1 do
local recipes = craftingguide.items[craftingguide.itemlist[item_index]]
if recipes ~= nil then
local itemname = ItemStack(recipes[1].output):get_name()
form = form .. default.ui.fake_simple_itemstack(0.25 + inv_x, 4 + inv_y, itemname, "guide_item_"..itemname)
inv_x = inv_x + 1
if inv_x >= 8 then
inv_x = 0
inv_y = inv_y + 1
end
else
break
end
end
return form
end
local function receive_fields(player, form_name, fields)
if form_name == "core_craftingguide" and not fields.quit then
local name = player:get_player_name()
local user = craftingguide.users[name]
local page = user.page
local recipes = craftingguide.items[user.item]
local itemno = user.itemno
local max_pages = math.floor(#craftingguide.itemlist / page_size) + 1
if fields.guide_next_recipe and itemno < #recipes then
itemno = itemno + 1
elseif fields.guide_prev_recipe and itemno > 1 then
itemno = itemno - 1
end
if fields.guide_next and page < max_pages then
page = page + 1
elseif fields.guide_prev and page > 1 then
page = page - 1
end
for fieldname, val in pairs(fields) do
local itemname = string.match(fieldname, "guide_item_(.*)")
if itemname ~= nil then
craftingguide.users[name].item = itemname
craftingguide.users[name].itemno = 1
end
end
craftingguide.users[name].page = page
craftingguide.users[name].itemno = itemno
minetest.show_formspec(name, "core_craftingguide", craftingguide.get_formspec(name))
end
end
local function on_joinplayer(player)
local name = player:get_player_name()
craftingguide.users[name] = {page = 1, item = craftingguide.itemlist[1], itemno = 1}
end
local function on_leaveplayer(player)
local name = player:get_player_name()
craftingguide.users[name] = nil
end
local function load_recipes()
for itemname, itemdef in pairs(minetest.registered_items) do
local recipes = minetest.get_all_craft_recipes(itemname)
if recipes ~= nil and itemname ~= "" and minetest.get_item_group(itemname, "not_in_craftingguide") ~= 1 then
-- print(dump(recipes))
craftingguide.items[itemname] = recipes
table.insert(craftingguide.itemlist, itemname)
end
end
table.sort(craftingguide.itemlist)
print("Got "..#craftingguide.itemlist.." craftable items")
end
minetest.after(0, load_recipes)
minetest.register_on_joinplayer(on_joinplayer)
minetest.register_on_leaveplayer(on_leaveplayer)
minetest.register_on_player_receive_fields(receive_fields)
local form_craftingguide = default.ui.get_page("core")
form_craftingguide = form_craftingguide .. default.ui.get_itemslot_bg(0.25, 4, 8, 4)
form_craftingguide = form_craftingguide .. default.ui.image_button(2.5, 7.9, 1, 1, "guide_prev", "ui_arrow_bg.png^[transformR90")
form_craftingguide = form_craftingguide .. default.ui.image_button(5, 7.9, 1, 1, "guide_next", "ui_arrow_bg.png^[transformR270")
form_craftingguide = form_craftingguide .. default.ui.image_button(0.25, 0.5, 1, 1, "guide_next_recipe", "ui_arrow_bg.png")
form_craftingguide = form_craftingguide .. default.ui.image_button(0.25, 2.5, 1, 1, "guide_prev_recipe", "ui_arrow_bg.png^[transformFY")
form_craftingguide = form_craftingguide .. default.ui.get_itemslot_bg(1.25, 0.5, 3, 3)
form_craftingguide = form_craftingguide .. default.ui.get_itemslot_bg(6.25, 1.5, 1, 1)
form_craftingguide = form_craftingguide .. "image[5.25,1.5;1,1;"..minetest.formspec_escape("ui_arrow.png^[transformR270").."]"
default.ui.register_page("core_craftingguide", form_craftingguide) | cc0-1.0 |
DreamHacks/dreamdota | DreamWarcraft/Build Tools/MPQFixEngine/lua/loop/thread/SocketScheduler.lua | 12 | 3473 | --------------------------------------------------------------------------------
---------------------- ## ##### ##### ###### -----------------------
---------------------- ## ## ## ## ## ## ## -----------------------
---------------------- ## ## ## ## ## ###### -----------------------
---------------------- ## ## ## ## ## ## -----------------------
---------------------- ###### ##### ##### ## -----------------------
---------------------- -----------------------
----------------------- Lua Object-Oriented Programming ------------------------
--------------------------------------------------------------------------------
-- Project: LOOP Class Library --
-- Release: 2.3 beta --
-- Title : Cooperative Threads Scheduler with Integrated Socket API --
-- Author : Renato Maia <maia@inf.puc-rio.br> --
--------------------------------------------------------------------------------
local getmetatable = getmetatable
local luasocket = require "socket.core"
local oo = require "loop.simple"
local IOScheduler = require "loop.thread.IOScheduler"
local CoSocket = require "loop.thread.CoSocket"
module "loop.thread.SocketScheduler"
oo.class(_M, IOScheduler)
--------------------------------------------------------------------------------
-- Initialization Code ---------------------------------------------------------
--------------------------------------------------------------------------------
function __init(class, self)
self = IOScheduler.__init(class, self)
self.sockets = CoSocket({ socketapi = luasocket }, self)
return self
end
__init(getmetatable(_M), _M)
--------------------------------------------------------------------------------
-- Customizable Behavior -------------------------------------------------------
--------------------------------------------------------------------------------
time = luasocket.gettime
select = luasocket.select
sleep = luasocket.sleep
--------------------------------------------------------------------------------
-- Component Version -----------------------------------------------------------
--[[----------------------------------------------------------------------------
SchedulerType = component.Type{
control = component.Facet,
threads = component.Facet,
}
SocketSchedulerType = component.Type{ SchedulerType,
sockets = component.Facet,
}
SocketScheduler = SchedulerType{ IOScheduler,
socket = CoSocket,
}
scheduler = SocketScheduler{
time = luasocket.gettime,
select = luasocket.select,
sleep = luasocket.sleep,
socket = { socketapi = luasocket }
}
subscheduler = SocketScheduler{
time = function(...) return scheduler.threads:time(...) end,
select = function(...) return scheduler.sockets:select(...) end,
sleep = function(...) return scheduler.threads:sleep(...) end,
socket = { socketapi = scheduler.sockets }
}
subscheduler.threads:register(coroutine.create(function()
local s = assert(scheduler.sockets:bind("localhost", 8080))
local c = assert(s:accept())
print("Got:", c:receive("*a"))
end))
scheduler.threads:register(coroutine.create(function()
return subscheduler.control:run()
end))
scheduler.control:run()
----------------------------------------------------------------------------]]-- | mit |
medoo3131/NEW-BOTT | plugins/su.lua | 2 | 103853 | --[[
#
#ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#:((
# For More Information ....!
# Developer : Aziz < @TH3_GHOST >
# our channel: @DevPointTeam
# Version: 1.1
#:))
#ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#
]]
--Begin supergrpup.lua
--Check members #Add supergroup
--channel : @DevPointTeam
local function check_member_super(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
if success == 0 then
send_large_msg(receiver, "Promote me to admin first!")
end
for k,v in pairs(result) do
local member_id = v.peer_id
if member_id ~= our_id then
-- SuperGroup configuration
data[tostring(msg.to.id)] = {
group_type = 'SuperGroup',
long_id = msg.to.peer_id,
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.title, '_', ' '),
lock_arabic = 'no',
lock_link = "no",
flood = 'yes',
lock_spam = 'yes',
lock_sticker = 'no',
member = 'no',
public = 'no',
lock_rtl = 'no',
lock_tgservice = 'yes',
lock_contacts = 'no',
strict = 'no'
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
local text = 'bot has been added ✅ in Group🔹'..msg.to.title
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Check Members #rem supergroup
local function check_member_superrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local text = 'bot has been removed ❎ in Group🔹'..msg.to.title
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Function to Add supergroup
local function superadd(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_super,{receiver = receiver, data = data, msg = msg})
end
--Function to remove supergroup
local function superrem(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_superrem,{receiver = receiver, data = data, msg = msg})
end
--Get and output admins and bots in supergroup
local function callback(cb_extra, success, result)
local i = 1
local chat_name = string.gsub(cb_extra.msg.to.print_name, "_", " ")
local member_type = cb_extra.member_type
local text = member_type.." for "..chat_name..":\n"
for k,v in pairsByKeys(result) do
if not v.first_name then
name = " "
else
vname = v.first_name:gsub("", "")
name = vname:gsub("_", " ")
end
text = text.."\n"..i.." - "..name.."["..v.peer_id.."]"
i = i + 1
end
send_large_msg(cb_extra.receiver, text)
end
--Get and output info about supergroup
local function callback_info(cb_extra, success, result)
local title ="Info for SuperGroup: ["..result.title.."]\n\n"
local admin_num = "Admin count: "..result.admins_count.."\n"
local user_num = "User count: "..result.participants_count.."\n"
local kicked_num = "Kicked user count: "..result.kicked_count.."\n"
local channel_id = "ID: "..result.peer_id.."\n"
if result.username then
channel_username = "Username: @"..result.username
else
channel_username = ""
end
local text = title..admin_num..user_num..kicked_num..channel_id..channel_username
send_large_msg(cb_extra.receiver, text)
end
--Get and output members of supergroup
local function callback_who(cb_extra, success, result)
local text = "Members for "..cb_extra.receiver
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
username = " @"..v.username
else
username = ""
end
text = text.."\n"..i.." - "..name.." "..username.." [ "..v.peer_id.." ]\n"
--text = text.."\n"..username Channel : @DevPointTeam
i = i + 1
end
local file = io.open("./groups/lists/supergroups/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/"..cb_extra.receiver..".txt", ok_cb, false)
post_msg(cb_extra.receiver, text, ok_cb, false)
end
--Get and output list of kicked users for supergroup
local function callback_kicked(cb_extra, success, result)
--vardump(result)
local text = "Kicked Members for SuperGroup "..cb_extra.receiver.."\n\n"
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
name = name.." @"..v.username
end
text = text.."\n"..i.." - "..name.." [ "..v.peer_id.." ]\n"
i = i + 1
end
local file = io.open("./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", ok_cb, false)
--send_large_msg(cb_extra.receiver, text)
end
--Begin supergroup locks
local function lock_group_links(msg, data, target)
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'yes' then
return 'Links is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_link'] = 'yes'
save_data(_config.moderation.data, data)
return 'Links has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_links(msg, data, target)
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'no' then
return 'Links is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_link'] = 'no'
save_data(_config.moderation.data, data)
return 'Links has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_all(msg, data, target)
if not is_momod(msg) then
return
end
local group_all_lock = data[tostring(target)]['settings']['all']
if group_all_lock == 'yes' then
return 'all settings is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['all'] = 'yes'
save_data(_config.moderation.data, data)
return 'all settings has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_all(msg, data, target)
if not is_momod(msg) then
return
end
local group_all_lock = data[tostring(target)]['settings']['all']
if group_all_lock == 'no' then
return 'all settings is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['all'] = 'no'
save_data(_config.moderation.data, data)
return 'all settings has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_etehad(msg, data, target)
if not is_momod(msg) then
return
end
local group_etehad_lock = data[tostring(target)]['settings']['etehad']
if group_etehad_lock == 'yes' then
return 'etehad setting is already locked'
else
data[tostring(target)]['settings']['etehad'] = 'yes'
save_data(_config.moderation.data, data)
return 'etehad setting has been locked'
end
end
local function unlock_group_etehad(msg, data, target)
if not is_momod(msg) then
return
end
local group_etehad_lock = data[tostring(target)]['settings']['etehad']
if group_etehad_lock == 'no' then
return 'etehad setting is not locked'
else
data[tostring(target)]['settings']['etehad'] = 'no'
save_data(_config.moderation.data, data)
return 'etehad setting has been unlocked'
end
end
local function lock_group_leave(msg, data, target)
if not is_momod(msg) then
return
end
local group_leave_lock = data[tostring(target)]['settings']['leave']
if group_leave_lock == 'yes' then
return 'leave is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['leave'] = 'yes'
save_data(_config.moderation.data, data)
return 'leave has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_leave(msg, data, target)
if not is_momod(msg) then
return
end
local group_leave_lock = data[tostring(target)]['settings']['leave']
if group_leave_lock == 'no' then
return 'leave is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['leave'] = 'no'
save_data(_config.moderation.data, data)
return 'leave has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_operator(msg, data, target)
if not is_momod(msg) then
return
end
local group_operator_lock = data[tostring(target)]['settings']['operator']
if group_operator_lock == 'yes' then
return 'operator is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['operator'] = 'yes'
save_data(_config.moderation.data, data)
return 'operator has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_operator(msg, data, target)
if not is_momod(msg) then
return
end
local group_operator_lock = data[tostring(target)]['settings']['operator']
if group_operator_lock == 'no' then
return 'operator is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['operator'] = 'no'
save_data(_config.moderation.data, data)
return 'operator has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_reply(msg, data, target)
if not is_momod(msg) then
return
end
local group_reply_lock = data[tostring(target)]['settings']['reply']
if group_reply_lock == 'yes' then
return 'Reply is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['reply'] = 'yes'
save_data(_config.moderation.data, data)
return 'Reply has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_reply(msg, data, target)
if not is_momod(msg) then
return
end
local group_reply_lock = data[tostring(target)]['settings']['reply']
if group_reply_lock == 'no' then
return 'Reply is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['reply'] = 'no'
save_data(_config.moderation.data, data)
return 'Reply has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_username(msg, data, target)
if not is_momod(msg) then
return
end
local group_username_lock = data[tostring(target)]['settings']['username']
if group_username_lock == 'yes' then
return 'Username is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['username'] = 'yes'
save_data(_config.moderation.data, data)
return 'Username has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_username(msg, data, target)
if not is_momod(msg) then
return
end
local group_username_lock = data[tostring(target)]['settings']['username']
if group_username_lock == 'no' then
return 'Username is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['username'] = 'no'
save_data(_config.moderation.data, data)
return 'Username has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_media(msg, data, target)
if not is_momod(msg) then
return
end
local group_media_lock = data[tostring(target)]['settings']['media']
if group_media_lock == 'yes' then
return 'Media is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['media'] = 'yes'
save_data(_config.moderation.data, data)
return 'Media has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_media(msg, data, target)
if not is_momod(msg) then
return
end
local group_media_lock = data[tostring(target)]['settings']['media']
if group_media_lock == 'no' then
return 'Media is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['media'] = 'no'
save_data(_config.moderation.data, data)
return 'Media has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_fosh(msg, data, target)
if not is_momod(msg) then
return
end
local group_fosh_lock = data[tostring(target)]['settings']['fosh']
if group_fosh_lock == 'yes' then
return 'badword is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['fosh'] = 'yes'
save_data(_config.moderation.data, data)
return 'badword has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_fosh(msg, data, target)
if not is_momod(msg) then
return
end
local group_fosh_lock = data[tostring(target)]['settings']['fosh']
if group_fosh_lock == 'no' then
return 'badword is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['fosh'] = 'no'
save_data(_config.moderation.data, data)
return 'badword has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_join(msg, data, target)
if not is_momod(msg) then
return
end
local group_join_lock = data[tostring(target)]['settings']['join']
if group_join_lock == 'yes' then
return 'join is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['join'] = 'yes'
save_data(_config.moderation.data, data)
return 'join has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_join(msg, data, target)
if not is_momod(msg) then
return
end
local group_join_lock = data[tostring(target)]['settings']['join']
if group_join_lock == 'no' then
return 'join is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['join'] = 'no'
save_data(_config.moderation.data, data)
return 'join has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_fwd(msg, data, target)
if not is_momod(msg) then
return
end
local group_fwd_lock = data[tostring(target)]['settings']['fwd']
if group_fwd_lock == 'yes' then
return 'fwd is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['fwd'] = 'yes'
save_data(_config.moderation.data, data)
return 'fwd has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_fwd(msg, data, target)
if not is_momod(msg) then
return
end
local group_fwd_lock = data[tostring(target)]['settings']['fwd']
if group_fwd_lock == 'no' then
return 'fwd is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['fwd'] = 'no'
save_data(_config.moderation.data, data)
return 'fwd has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_english(msg, data, target)
if not is_momod(msg) then
return
end
local group_english_lock = data[tostring(target)]['settings']['english']
if group_english_lock == 'yes' then
return 'English is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['english'] = 'yes'
save_data(_config.moderation.data, data)
return 'English has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_english(msg, data, target)
if not is_momod(msg) then
return
end
local group_english_lock = data[tostring(target)]['settings']['english']
if group_english_lock == 'no' then
return 'English is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['english'] = 'no'
save_data(_config.moderation.data, data)
return 'English has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_emoji(msg, data, target)
if not is_momod(msg) then
return
end
local group_emoji_lock = data[tostring(target)]['settings']['emoji']
if group_emoji_lock == 'yes' then
return 'Emoji is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['emoji'] = 'yes'
save_data(_config.moderation.data, data)
return 'Emoji has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_emoji(msg, data, target)
if not is_momod(msg) then
return
end
local group_emoji_lock = data[tostring(target)]['settings']['emoji']
if group_emoji_lock == 'no' then
return 'Emoji is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['emoji'] = 'no'
save_data(_config.moderation.data, data)
return 'Emoji has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_tag(msg, data, target)
if not is_momod(msg) then
return
end
local group_tag_lock = data[tostring(target)]['settings']['tag']
if group_tag_lock == 'yes' then
return 'tag is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['tag'] = 'yes'
save_data(_config.moderation.data, data)
return 'tag has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_tag(msg, data, target)
if not is_momod(msg) then
return
end
local group_tag_lock = data[tostring(target)]['settings']['tag']
if group_tag_lock == 'no' then
return 'tag is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['tag'] = 'no'
save_data(_config.moderation.data, data)
return 'tag has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_all(msg, data, target)
if not is_momod(msg) then
return
end
local group_all_lock = data[tostring(target)]['settings']['all']
if group_all_lock == 'no' then
return 'all settings is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['all'] = 'no'
save_data(_config.moderation.data, data)
return 'all settings has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_spam(msg, data, target)
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Owners only!"
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'yes' then
return 'Spam is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_spam'] = 'yes'
save_data(_config.moderation.data, data)
return 'Spam has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_spam(msg, data, target)
if not is_momod(msg) then
return
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'no' then
return 'Spam is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_spam'] = 'no'
save_data(_config.moderation.data, data)
return 'Spam has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_flood(msg, data, target)
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'Flood is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'Flood has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_flood(msg, data, target)
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'Flood is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'Flood has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'Arabic is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'Arabic has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'Arabic is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'Arabic has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'Members are already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'Members has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'Members are not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'Members has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_rtl(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'yes' then
return 'RTL is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_rtl'] = 'yes'
save_data(_config.moderation.data, data)
return 'RTL has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_rtl(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'no' then
return 'RTL is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_rtl'] = 'no'
save_data(_config.moderation.data, data)
return 'RTL has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_tgservice(msg, data, target)
if not is_momod(msg) then
return
end
local group_tgservice_lock = data[tostring(target)]['settings']['lock_tgservice']
if group_tgservice_lock == 'yes' then
return 'Tgservice is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_tgservice'] = 'yes'
save_data(_config.moderation.data, data)
return 'Tgservice has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_tgservice(msg, data, target)
if not is_momod(msg) then
return
end
local group_tgservice_lock = data[tostring(target)]['settings']['lock_tgservice']
if group_tgservice_lock == 'no' then
return 'Tgservice is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_tgservice'] = 'no'
save_data(_config.moderation.data, data)
return 'Tgservice has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_sticker(msg, data, target)
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'yes' then
return 'Sticker is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_sticker'] = 'yes'
save_data(_config.moderation.data, data)
return 'Sticker has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_sticker(msg, data, target)
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'no' then
return 'Sticker is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_sticker'] = 'no'
save_data(_config.moderation.data, data)
return 'Sticker has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_bots(msg, data, target)
if not is_momod(msg) then
return
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'yes' then
return 'Bots is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_bots'] = 'yes'
save_data(_config.moderation.data, data)
return 'Bots has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_bots(msg, data, target)
if not is_momod(msg) then
return
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'no' then
return 'Bots is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_bots'] = 'no'
save_data(_config.moderation.data, data)
return 'Bots has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function lock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'yes' then
return 'Contact is already locked 🔐\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_contacts'] = 'yes'
save_data(_config.moderation.data, data)
return 'Contact has been locked 🔐\n👮 Order by :️ @'..msg.from.username
end
end
local function unlock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_contacts_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'no' then
return 'Contact is not locked 🔓\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['lock_contacts'] = 'no'
save_data(_config.moderation.data, data)
return 'Contact has been unlocked 🔓\n👮 Order by :️ @'..msg.from.username
end
end
local function enable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'yes' then
return 'Settings are already strictly enforced 🛡\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['strict'] = 'yes'
save_data(_config.moderation.data, data)
return 'Settings will be strictly enforced 🛡\n👮 Order by :️ @'..msg.from.username
end
end
local function disable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'no' then
return 'Settings are not strictly enforced 🛡\n👮 Order by :️ @'..msg.from.username
else
data[tostring(target)]['settings']['strict'] = 'no'
save_data(_config.moderation.data, data)
return 'Settings will not be strictly enforced 🛡\n👮 Order by :️ @'..msg.from.username
end
end
--End supergroup locks
--'Set supergroup rules' function
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'SuperGroup rules set'
end
--'Get supergroup rules' function
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return 'No rules available.'
end
local rules = data[tostring(msg.to.id)][data_cat]
local group_name = data[tostring(msg.to.id)]['settings']['set_name']
local rules = group_name..' rules:\n\n'..rules:gsub("/n", " ")
return rules
end
--Set supergroup to public or not public function
local function set_public_membermod(msg, data, target)
if not is_momod(msg) then
return "For moderators only!"
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'yes' then
return 'Group is already public'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'SuperGroup is now: public'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'no' then
return 'Group is not public'
else
data[tostring(target)]['settings']['public'] = 'no'
data[tostring(target)]['long_id'] = msg.to.long_id
save_data(_config.moderation.data, data)
return 'SuperGroup is now: not public'
end
end
--Show supergroup settings; function
function show_supergroup_settingsmod(msg, target)
if not is_momod(msg) then
return
end
local data = load_data(_config.moderation.data)
if data[tostring(target)] then
if data[tostring(target)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local bots_protection = "Yes"
if data[tostring(target)]['settings']['lock_bots'] then
bots_protection = data[tostring(target)]['settings']['lock_bots']
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['public'] then
data[tostring(target)]['settings']['public'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_rtl'] then
data[tostring(target)]['settings']['lock_rtl'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_tgservice'] then
data[tostring(target)]['settings']['lock_tgservice'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['tag'] then
data[tostring(target)]['settings']['tag'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['emoji'] then
data[tostring(target)]['settings']['emoji'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['english'] then
data[tostring(target)]['settings']['english'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['fwd'] then
data[tostring(target)]['settings']['fwd'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['reply'] then
data[tostring(target)]['settings']['reply'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['join'] then
data[tostring(target)]['settings']['join'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['fosh'] then
data[tostring(target)]['settings']['fosh'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['username'] then
data[tostring(target)]['settings']['username'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['media'] then
data[tostring(target)]['settings']['media'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['leave'] then
data[tostring(target)]['settings']['leave'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_member'] then
data[tostring(target)]['settings']['lock_member'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['all'] then
data[tostring(target)]['settings']['all'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['operator'] then
data[tostring(target)]['settings']['operator'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['etehad'] then
data[tostring(target)]['settings']['etehad'] = 'no'
end
end
local gp_type = data[tostring(msg.to.id)]['group_type']
local settings = data[tostring(target)]['settings']
local text = "🎗➖➖➖🎗➖➖➖🎗\nℹ️SuperGroups Settings: ⬇️\n💟Group name : "..msg.to.title.."\n🎗➖➖➖🎗➖➖➖🎗\n🔗lock links : "..settings.lock_link.."\n📵Lock contacts: "..settings.lock_contacts.."\n🔐Lock flood: "..settings.flood.."\n👾Flood sensitivity : "..NUM_MSG_MAX.."\n📊Lock spam: "..settings.lock_spam.."\n🆎Lock Arabic: "..settings.lock_arabic.."\n🔠Lock english: "..settings.english.."\n👤Lock Member: "..settings.lock_member.."\n📌Lock RTL: "..settings.lock_rtl.."\n🔯Lock Tgservice: "..settings.lock_tgservice.."\n🎡Lock sticker: "..settings.lock_sticker.."\n➕Lock tag(#): "..settings.tag.."\n😃Lock emoji: "..settings.emoji.."\n🤖Lock bots: "..bots_protection.."\n↩️Lock fwd(forward): "..settings.fwd.."\n🔃lock reply: "..settings.reply.."\n🚷Lock join: "..settings.join.."\n♏️Lock username(@): "..settings.username.."\n🆘Lock media: "..settings.media.."\n🏧Lock badword: "..settings.fosh.."\n🚶Lock leave: "..settings.leave.."\n🔕Lock all: "..settings.all.."\n🎗➖➖➖🎗➖➖➖🎗\nℹ️About Group: ⬇️\n🎗➖➖➖🎗➖➖➖🎗\n⚠️Group type: "..gp_type.."\n✳️Public: "..settings.public.."\n⛔️Strict settings: "..settings.strict.."\n🎗➖➖➖🎗➖➖➖🎗\nℹ️bot version : v1.1\n\n🌐 DEV🎗POINT🎗TEAM 🌐"
return text
end
local function promote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' is already a moderator.')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
end
local function demote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..' is not a moderator.')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
end
local function promote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return send_large_msg(receiver, 'SuperGroup is not added.')
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' is already a moderator.')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' has been promoted.')
end
local function demote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added.')
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..' is not a moderator.')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' has been demoted.')
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'SuperGroup is not added.'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then
return 'No moderator in this group.'
end
local i = 1
local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
-- Start by reply actions
function get_message_callback(extra, success, result)
local get_cmd = extra.get_cmd
local msg = extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
if get_cmd == "id" and not result.action then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for: ["..result.from.peer_id.."]")
id1 = send_large_msg(channel, result.from.peer_id)
elseif get_cmd == 'id' and result.action then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
else
user_id = result.peer_id
end
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id by service msg for: ["..user_id.."]")
id1 = send_large_msg(channel, user_id)
end
elseif get_cmd == "idfrom" then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for msg fwd from: ["..result.fwd_from.peer_id.."]")
id2 = send_large_msg(channel, result.fwd_from.peer_id)
elseif get_cmd == 'channel_block' and not result.action then
local member_id = result.from.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
--savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply")
kick_user(member_id, channel_id)
elseif get_cmd == 'channel_block' and result.action and result.action.type == 'chat_add_user' then
local user_id = result.action.user.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply to sev. msg.")
kick_user(user_id, channel_id)
elseif get_cmd == "del" then
delete_msg(result.id, ok_cb, false)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted a message by reply")
elseif get_cmd == "setadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
channel_set_admin(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." set as an admin"
else
text = "[ "..user_id.." ]set as an admin"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..user_id.."] as admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "demoteadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
if is_admin2(result.from.peer_id) then
return send_large_msg(channel_id, "You can't demote global admins!")
end
channel_demote(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." has been demoted from admin"
else
text = "[ "..user_id.." ] has been demoted from admin"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted: ["..user_id.."] from admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "setowner" then
local group_owner = data[tostring(result.to.peer_id)]['set_owner']
if group_owner then
local channel_id = 'channel#id'..result.to.peer_id
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(channel_id, user, ok_cb, false)
end
local user_id = "user#id"..result.from.peer_id
channel_set_admin(channel_id, user_id, ok_cb, false)
data[tostring(result.to.peer_id)]['set_owner'] = tostring(result.from.peer_id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..result.from.peer_id.."] as owner by reply")
if result.from.username then
text = "@"..result.from.username.." [ "..result.from.peer_id.." ] added as owner"
else
text = "[ "..result.from.peer_id.." ] added as owner"
end
send_large_msg(channel_id, text)
end
elseif get_cmd == "promote" then
local receiver = result.to.peer_id
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
if result.to.peer_type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted mod: @"..member_username.."["..result.from.peer_id.."] by reply")
promote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_set_mod(channel_id, user, ok_cb, false)
end
elseif get_cmd == "demote" then
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
--local user = "user#id"..result.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted mod: @"..member_username.."["..result.from.peer_id.."] by reply")
demote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_demote(channel_id, user, ok_cb, false)
elseif get_cmd == 'mute_user' then
if result.service then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
end
end
if action == 'chat_add_user_link' then
if result.from then
user_id = result.from.peer_id
end
end
else
user_id = result.from.peer_id
end
local receiver = extra.receiver
local chat_id = msg.to.id
print(user_id)
print(chat_id)
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, "["..user_id.."] removed from the muted user list")
elseif is_admin1(msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] added to the muted user list")
end
end
end
-- End by reply actions
--By ID actions
local function cb_user_info(extra, success, result)
local receiver = extra.receiver
local user_id = result.peer_id
local get_cmd = extra.get_cmd
local data = load_data(_config.moderation.data)
--[[if get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
else
text = "[ "..result.peer_id.." ] has been set as an admin"
end
send_large_msg(receiver, text)]]
if get_cmd == "demoteadmin" then
if is_admin2(result.peer_id) then
return send_large_msg(receiver, "You can't demote global admins!")
end
local user_id = "user#id"..result.peer_id
channel_demote(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(receiver, text)
else
text = "[ "..result.peer_id.." ] has been demoted from admin"
send_large_msg(receiver, text)
end
elseif get_cmd == "promote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
promote2(receiver, member_username, user_id)
elseif get_cmd == "demote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
demote2(receiver, member_username, user_id)
end
end
-- Begin resolve username actions
local function callbackres(extra, success, result)
local member_id = result.peer_id
local member_username = "@"..result.username
local get_cmd = extra.get_cmd
if get_cmd == "res" then
local user = result.peer_id
local name = string.gsub(result.print_name, "_", " ")
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user..'\n'..name)
return user
elseif get_cmd == "id" then
local user = result.peer_id
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user)
return user
elseif get_cmd == "invite" then
local receiver = extra.channel
local user_id = "user#id"..result.peer_id
channel_invite(receiver, user_id, ok_cb, false)
--[[elseif get_cmd == "channel_block" then
local user_id = result.peer_id
local channel_id = extra.channelid
local sender = extra.sender
if member_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
kick_user(user_id, channel_id)
elseif get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
channel_set_admin(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been set as an admin"
send_large_msg(channel_id, text)
end
elseif Dev = Point
elseif get_cmd == "setowner" then
local receiver = extra.channel
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = extra.from_id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
local user = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(result.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.." ["..from_id.."] set ["..result.peer_id.."] as owner by username")
if result.username then
text = member_username.." [ "..result.peer_id.." ] added as owner"
else
text = "[ "..result.peer_id.." ] added as owner"
end
send_large_msg(receiver, text)
end]]
elseif get_cmd == "promote" then
local receiver = extra.channel
local user_id = result.peer_id
--local user = "user#id"..result.peer_id
promote2(receiver, member_username, user_id)
--channel_set_mod(receiver, user, ok_cb, false)
elseif get_cmd == "demote" then
local receiver = extra.channel
local user_id = result.peer_id
local user = "user#id"..result.peer_id
demote2(receiver, member_username, user_id)
elseif get_cmd == "demoteadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
if is_admin2(result.peer_id) then
return send_large_msg(channel_id, "You can't demote global admins!")
end
channel_demote(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been demoted from admin"
send_large_msg(channel_id, text)
end
local receiver = extra.channel
local user_id = result.peer_id
demote_admin(receiver, member_username, user_id)
elseif get_cmd == 'mute_user' then
local user_id = result.peer_id
local receiver = extra.receiver
local chat_id = string.gsub(receiver, 'channel#id', '')
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] removed from muted user list")
elseif is_owner(extra.msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] added to muted user list")
end
end
end
--End resolve username actions
--Begin non-channel_invite username actions
local function in_channel_cb(cb_extra, success, result)
local get_cmd = cb_extra.get_cmd
local receiver = cb_extra.receiver
local msg = cb_extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(cb_extra.msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local member = cb_extra.username
local memberid = cb_extra.user_id
if member then
text = 'No user @'..member..' in this SuperGroup.'
else
text = 'No user ['..memberid..'] in this SuperGroup.'
end
if get_cmd == "channel_block" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = v.peer_id
local channel_id = cb_extra.msg.to.id
local sender = cb_extra.msg.from.id
if user_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(user_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(user_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
if v.username then
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..v.username.." ["..v.peer_id.."]")
else
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..v.peer_id.."]")
end
kick_user(user_id, channel_id)
return
end
end
elseif get_cmd == "setadmin" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = "user#id"..v.peer_id
local channel_id = "channel#id"..cb_extra.msg.to.id
channel_set_admin(channel_id, user_id, ok_cb, false)
if v.username then
text = "@"..v.username.." ["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..v.username.." ["..v.peer_id.."]")
else
text = "["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin "..v.peer_id)
end
if v.username then
member_username = "@"..v.username
else
member_username = string.gsub(v.print_name, '_', ' ')
end
local receiver = channel_id
local user_id = v.peer_id
promote_admin(receiver, member_username, user_id)
end
send_large_msg(channel_id, text)
return
end
elseif get_cmd == 'setowner' then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..v.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(v.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..v.peer_id.."] as owner by username")
if result.username then
text = member_username.." ["..v.peer_id.."] added as owner"
else
text = "["..v.peer_id.."] added as owner"
end
end
elseif memberid and vusername ~= member and vpeer_id ~= memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
data[tostring(channel)]['set_owner'] = tostring(memberid)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..memberid.."] as owner by username")
text = "["..memberid.."] added as owner"
end
end
end
end
send_large_msg(receiver, text)
end
--End non-channel_invite username actions
--'Set supergroup photo' function
local function set_supergroup_photo(msg, success, result)
local data = load_data(_config.moderation.data)
if not data[tostring(msg.to.id)] then
return
end
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/channel_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
channel_set_photo(receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'Photo saved!', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
--Run function
local function DevPointTeam(msg, matches)
if msg.to.type == 'chat' then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
local receiver = get_receiver(msg)
chat_upgrade(receiver, ok_cb, false)
end
elseif msg.to.type == 'channel'then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
return "Already a SuperGroup"
end
end
if msg.to.type == 'channel' then
local support_id = msg.from.id
local receiver = get_receiver(msg)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local data = load_data(_config.moderation.data)
if matches[1] == 'addbot' and not matches[2] then
if not is_admin1(msg) and not is_support(support_id) then
return
end
if is_super_group(msg) then
local iDev1 = "is already added !"
return send_large_msg(receiver, iDev1)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") added")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] added SuperGroup")
superadd(msg)
set_mutes(msg.to.id)
channel_set_admin(receiver, 'user#id'..msg.from.id, ok_cb, false)
end
if matches[1] == 'addbot' and is_admin1(msg) and not matches[2] then
if not is_super_group(msg) then
local iDev1 = "This Group not added 🤖 OK I will add this Group"
return send_large_msg(receiver, iDev1)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") removed")
superrem(msg)
rem_mutes(msg.to.id)
end
if matches[1] == 'rembot' and is_admin1(msg) and not matches[2] then
if not is_super_group(msg) then
return reply_msg(msg.id, 'SuperGroup is not added.', ok_cb, false)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") removed")
superrem(msg)
rem_mutes(msg.to.id)
end
if not data[tostring(msg.to.id)] then
return
end--@DevPointTeam = Dont Remove
if matches[1] == "gpinfo" then
if not is_owner(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup info")
channel_info(receiver, callback_info, {receiver = receiver, msg = msg})
end
if matches[1] == "admins" then
if not is_owner(msg) and not is_support(msg.from.id) then
return
end
member_type = 'Admins'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup Admins list")
admins = channel_get_admins(receiver,callback, {receiver = receiver, msg = msg, member_type = member_type})
end
if matches[1] == "owner" then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
return "no owner,ask admins in support groups to set owner for your SuperGroup"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
return "SuperGroup owner is ["..group_owner..']'
end
if matches[1] == "modlist" then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
-- channel_get_admins(receiver,callback, {receiver = receiver})
end
if matches[1] == "bots" and is_momod(msg) then
member_type = 'Bots'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup bots list")
channel_get_bots(receiver, callback, {receiver = receiver, msg = msg, member_type = member_type})
end
if matches[1] == "who" and not matches[2] and is_momod(msg) then
local user_id = msg.from.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup users list")
channel_get_users(receiver, callback_who, {receiver = receiver})
end
if matches[1] == "kicked" and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested Kicked users list")
channel_get_kicked(receiver, callback_kicked, {receiver = receiver})
end
if matches[1] == 'del' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'del',
msg = msg
}
delete_msg(msg.id, ok_cb, false)
get_message(msg.reply_id, get_message_callback, cbreply_extra)
end
end
if matches[1] == 'bb' or matches[1] == 'kick' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'channel_block',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'bb' or matches[1] == 'kick' and string.match(matches[2], '^%d+$') then
--[[local user_id = matches[2]
local channel_id = msg.to.id Dev = Point
if is_momod2(user_id, channel_id) and not is_admin2(user_id) then
return send_large_msg(receiver, "You can't kick mods/owner/admins")
end
@DevPointTeam
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: [ user#id"..user_id.." ]")
kick_user(user_id, channel_id)]]
local get_cmd = 'channel_block'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif msg.text:match("@[%a%d]") then
--[[local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'channel_block',
sender = msg.from.id Dev = Point
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'channel_block'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'id' then
if type(msg.reply_id) ~= "nil" and is_momod(msg) and not matches[2] then
local cbreply_extra = {
get_cmd = 'id',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif type(msg.reply_id) ~= "nil" and matches[2] == "from" and is_momod(msg) then
local cbreply_extra = {
get_cmd = 'idfrom',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif msg.text:match("@[%a%d]") then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'id'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested ID for: @"..username)
resolve_username(username, callbackres, cbres_extra)
else
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup ID")
local text = "♍️- Name: " ..string.gsub(msg.from.print_name, "_", " ").. "\n♑️- Username: @"..(msg.from.username or '----').."\n🆔- ID: "..msg.from.id.."\n💟- Group Name: " ..string.gsub(msg.to.print_name, "_", " ").. "\nℹ️- Group ID: "..msg.to.id
return reply_msg(msg.id, text, ok_cb, false)
end
end
if matches[1] == 'kickme' then
if msg.to.type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] left via kickme")
channel_kick("channel#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false)
end
end
if matches[1] == 'newlink' and is_momod(msg)then
local function callback_link (extra , success, result)
local receiver = get_receiver(msg)
if success == 0 then
send_large_msg(receiver, '*Error: Failed to retrieve link* \nReason: Not creator.\n\nIf you have the link, please use /setlink to set it')
data[tostring(msg.to.id)]['settings']['set_link'] = nil
save_data(_config.moderation.data, data)
else
send_large_msg(receiver, "Created a new link")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to create a new SuperGroup link")
export_channel_link(receiver, callback_link, false)
end
if matches[1] == 'setlink' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = 'waiting'
save_data(_config.moderation.data, data)
return 'Please send the new group link now'
end
if msg.text then
if msg.text:match("^(https://telegram.me/joinchat/%S+)$") and data[tostring(msg.to.id)]['settings']['set_link'] == 'waiting' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = msg.text
save_data(_config.moderation.data, data)
return "New link set"
end
end
if matches[1] == 'link' then
if not is_momod(msg) then
return
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "Create a link using /newlink first!\n\nOr if I am not creator use /setlink to set your link"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "link Group ["..msg.to.title.."] :\n"..group_link
end
if matches[1] == "invite" and is_sudo(msg) then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = "invite"
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] invited @"..username)
resolve_username(username, callbackres, cbres_extra)
end
if matches[1] == 'res' and is_owner(msg) then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'res'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] resolved username: @"..username)
resolve_username(username, callbackres, cbres_extra)
end
--[[if matches[1] == 'kick' and is_momod(msg) then
local receiver = channel..matches[3]
local user = "user#id"..matches[2]
chaannel_kick(receiver, user, ok_cb, false)
@DevPointTeam
end]]
if matches[1] == 'setadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'setadmin',
msg = msg
}
setadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'setadmin' and string.match(matches[2], '^%d+$') then
--[[] local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'setadmin' Dev = Point
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})]]
local get_cmd = 'setadmin'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'setadmin' and not string.match(matches[2], '^%d+$') then
--[[local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'setadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'setadmin'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'demoteadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demoteadmin',
msg = msg
}
demoteadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demoteadmin' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demoteadmin'
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'demoteadmin' and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demoteadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted admin @"..username)
resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'setowner' and is_owner(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'setowner',
msg = msg
}
setowner = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'setowner' and string.match(matches[2], '^%d+$') then
--[[ local group_owner = data[tostring(msg.to.id)]['set_owner']
if group_owner then
local receiver = get_receiver(msg)
local user_id = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user_id, ok_cb, false)
end
local user = "user#id"..matches[2]
channel_set_admin(receiver, user, ok_cb, false)
data[tostring(msg.to.id)]['set_owner'] = tostring(matches[2])
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = "[ "..matches[2].." ] added as owner"
return text Dev = Point
end]]
local get_cmd = 'setowner'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'setowner' and not string.match(matches[2], '^%d+$') then
local get_cmd = 'setowner'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'promote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner/admin can promote"
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'promote',
msg = msg
}
promote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'promote' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'promote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'promote' and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'promote',
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'mp' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_set_mod(channel, user_id, ok_cb, false)
return "ok"
end
if matches[1] == 'md' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_demote(channel, user_id, ok_cb, false)
return "ok"
end
if matches[1] == 'demote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "Only owner/support/admin can promote"
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demote',
msg = msg
}
demote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demote' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demote'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == "setname" and is_momod(msg) then
local receiver = get_receiver(msg)
local set_name = string.gsub(matches[2], '_', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] renamed SuperGroup to: "..matches[2])
rename_channel(receiver, set_name, ok_cb, false)
end
if msg.service and msg.action.type == 'chat_rename' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] renamed SuperGroup to: "..msg.to.title)
data[tostring(msg.to.id)]['settings']['set_name'] = msg.to.title
save_data(_config.moderation.data, data)
end
if matches[1] == "setabout" and is_momod(msg) then
local receiver = get_receiver(msg)
local about_text = matches[2]
local data_cat = 'description'
local target = msg.to.id
data[tostring(target)][data_cat] = about_text
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup description to: "..about_text)
channel_set_about(receiver, about_text, ok_cb, false)
return "Description has been set.\n\nSelect the chat again to see the changes."
end
if matches[1] == "setusername" and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "SuperGroup username Set.\n\nSelect the chat again to see the changes.")
elseif success == 0 then
send_large_msg(receiver, "Failed to set SuperGroup username.\nUsername may already be taken.\n\nNote: Username can use a-z, 0-9 and underscores.\nMinimum length is 5 characters.")
end
end
local username = string.gsub(matches[2], '@', '')
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
if matches[1] == 'setrules' and is_momod(msg) then
rules = matches[2]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[2].."]")
return set_rulesmod(msg, data, target)
end
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set new SuperGroup photo")
load_photo(msg.id, set_supergroup_photo, msg)
return
end
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] started setting new SuperGroup photo")
return 'Please send the new group photo now'
end
if matches[1] == 'clean' then
if not is_momod(msg) then
return
end
if not is_momod(msg) then
return "Only owner can clean"
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then
return 'No moderator(s) in this SuperGroup.'
end
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
return 'Modlist has been cleaned'
end
if matches[2] == 'rules' then
local data_cat = 'rules'
if data[tostring(msg.to.id)][data_cat] == nil then
return "Rules have not been set"
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
return 'Rules have been cleaned'
end
if matches[2] == 'about' then
local receiver = get_receiver(msg)
local about_text = ' '
local data_cat = 'description'
if data[tostring(msg.to.id)][data_cat] == nil then
return 'About is not set'
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
channel_set_about(receiver, about_text, ok_cb, false)
return "About has been cleaned"
end
if matches[2] == 'silentlist' then
chat_id = msg.to.id
local hash = 'mute_user:'..chat_id
redis:del(hash)
return "silentlist Cleaned"
end
if matches[2] == 'username' and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "SuperGroup username cleaned.")
elseif success == 0 then
send_large_msg(receiver, "Failed to clean SuperGroup username.")
end
end
local username = ""
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
end
if matches[1] == 'd' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'all' then
local safemode ={
lock_group_links(msg, data, target),
lock_group_tag(msg, data, target),
lock_group_spam(msg, data, target),
lock_group_flood(msg, data, target),
lock_group_arabic(msg, data, target),
lock_group_membermod(msg, data, target),
lock_group_rtl(msg, data, target),
lock_group_tgservice(msg, data, target),
lock_group_sticker(msg, data, target),
lock_group_contacts(msg, data, target),
lock_group_english(msg, data, target),
lock_group_fwd(msg, data, target),
lock_group_reply(msg, data, target),
lock_group_join(msg, data, target),
lock_group_emoji(msg, data, target),
lock_group_username(msg, data, target),
lock_group_fosh(msg, data, target),
lock_group_media(msg, data, target),
lock_group_leave(msg, data, target),
lock_group_bots(msg, data, target),
lock_group_operator(msg, data, target),
}
return lock_group_all(msg, data, target), safemode
end
if matches[2] == 'etehad' then
local etehad ={
unlock_group_links(msg, data, target),
lock_group_tag(msg, data, target),
lock_group_spam(msg, data, target),
lock_group_flood(msg, data, target),
unlock_group_arabic(msg, data, target),
lock_group_membermod(msg, data, target),
unlock_group_rtl(msg, data, target),
lock_group_tgservice(msg, data, target),
lock_group_sticker(msg, data, target),
unlock_group_contacts(msg, data, target),
unlock_group_english(msg, data, target),
unlock_group_fwd(msg, data, target),
unlock_group_reply(msg, data, target),
lock_group_join(msg, data, target),
unlock_group_emoji(msg, data, target),
unlock_group_username(msg, data, target),
lock_group_fosh(msg, data, target),
unlock_group_media(msg, data, target),
lock_group_leave(msg, data, target),
lock_group_bots(msg, data, target),
unlock_group_operator(msg, data, target),
}
return lock_group_etehad(msg, data, target), etehad
end
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked link posting ")
return lock_group_links(msg, data, target)
end
if matches[2] == 'join' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked join ")
return lock_group_join(msg, data, target)
end
if matches[2] == 'tag' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked tag ")
return lock_group_tag(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked spam ")
return lock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_flood(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked rtl chars. in names")
return lock_group_rtl(msg, data, target)
end
if matches[2] == 'tgservice' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked Tgservice Actions")
return lock_group_tgservice(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked sticker posting")
return lock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked contact posting")
return lock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked enabled strict settings")
return enable_strict_rules(msg, data, target)
end
if matches[2] == 'english' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked english")
return lock_group_english(msg, data, target)
end
if matches[2] == 'fwd' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked fwd")
return lock_group_fwd(msg, data, target)
end
if matches[2] == 'reply' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked reply")
return lock_group_reply(msg, data, target)
end
if matches[2] == 'emoji' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked emoji")
return lock_group_emoji(msg, data, target)
end
if matches[2] == 'badword' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked fosh")
return lock_group_fosh(msg, data, target)
end
if matches[2] == 'media' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked media")
return lock_group_media(msg, data, target)
end
if matches[2] == 'username' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked username")
return lock_group_username(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leave")
return lock_group_leave(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots")
return lock_group_bots(msg, data, target)
end
if matches[2] == 'operator' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked operator")
return lock_group_operator(msg, data, target)
end
end
if matches[1] == 'u' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'all' then
local dsafemode ={
unlock_group_links(msg, data, target),
unlock_group_tag(msg, data, target),
unlock_group_spam(msg, data, target),
unlock_group_flood(msg, data, target),
unlock_group_arabic(msg, data, target),
unlock_group_membermod(msg, data, target),
unlock_group_rtl(msg, data, target),
unlock_group_tgservice(msg, data, target),
unlock_group_sticker(msg, data, target),
unlock_group_contacts(msg, data, target),
unlock_group_english(msg, data, target),
unlock_group_fwd(msg, data, target),
unlock_group_reply(msg, data, target),
unlock_group_join(msg, data, target),
unlock_group_emoji(msg, data, target),
unlock_group_username(msg, data, target),
unlock_group_fosh(msg, data, target),
unlock_group_media(msg, data, target),
unlock_group_leave(msg, data, target),
unlock_group_bots(msg, data, target),
unlock_group_operator(msg, data, target),
}
return unlock_group_all(msg, data, target), dsafemode
end
if matches[2] == 'etehad' then
local detehad ={
lock_group_links(msg, data, target),
unlock_group_tag(msg, data, target),
lock_group_spam(msg, data, target),
lock_group_flood(msg, data, target),
unlock_group_arabic(msg, data, target),
unlock_group_membermod(msg, data, target),
unlock_group_rtl(msg, data, target),
unlock_group_tgservice(msg, data, target),
unlock_group_sticker(msg, data, target),
unlock_group_contacts(msg, data, target),
unlock_group_english(msg, data, target),
unlock_group_fwd(msg, data, target),
unlock_group_reply(msg, data, target),
unlock_group_join(msg, data, target),
unlock_group_emoji(msg, data, target),
unlock_group_username(msg, data, target),
unlock_group_fosh(msg, data, target),
unlock_group_media(msg, data, target),
unlock_group_leave(msg, data, target),
unlock_group_bots(msg, data, target),
unlock_group_operator(msg, data, target),
}
return unlock_group_etehad(msg, data, target), detehad
end
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked link posting")
return unlock_group_links(msg, data, target)
end
if matches[2] == 'join' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked join")
return unlock_group_join(msg, data, target)
end
if matches[2] == 'tag' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked tag")
return unlock_group_tag(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked spam")
return unlock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood")
return unlock_group_flood(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked Arabic")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked RTL chars. in names")
return unlock_group_rtl(msg, data, target)
end
if matches[2] == 'tgservice' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked tgservice actions")
return unlock_group_tgservice(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked sticker posting")
return unlock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked contact posting")
return unlock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked disabled strict settings")
return disable_strict_rules(msg, data, target)
end
if matches[2] == 'english' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked english")
return unlock_group_english(msg, data, target)
end
if matches[2] == 'fwd' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked fwd")
return unlock_group_fwd(msg, data, target)
end
if matches[2] == 'reply' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked reply")
return unlock_group_reply(msg, data, target)
end
if matches[2] == 'emoji' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked disabled emoji")
return unlock_group_emoji(msg, data, target)
end
if matches[2] == 'badword' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked fosh")
return unlock_group_fosh(msg, data, target)
end
if matches[2] == 'media' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked media")
return unlock_group_media(msg, data, target)
end
if matches[2] == 'username' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked disabled username")
return unlock_group_username(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leave")
return unlock_group_leave(msg, data, target)
end
if matches[2] == 'bots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots")
return unlock_group_bots(msg, data, target)
end
if matches[2] == 'operator' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked operator")
return unlock_group_operator(msg, data, target)
end
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
return 'Flood has been set to: '..matches[2]
end
if matches[1] == 'public' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: not public")
return unset_public_membermod(msg, data, target)
end
end
if matches[1] == 'd' and is_owner(msg) then
local chat_id = msg.to.id
if matches[2] == 'audio' then
local msg_type = 'Audio'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Audio has been muted 🎵🔐\n👮 Order by :️ @'..msg.from.username
else
return 'Audio is already muted 🎵🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'photo' then
local msg_type = 'Photo'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Photo has been muted 🎡🔐\n👮 Order by :️ @'..msg.from.username
else
return 'Photo is already muted 🎡🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Video has been muted 🎥🔐\n👮 Order by :️ @'..msg.from.username
else
return 'Video is already muted 🎥🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Gifs has been muted 🎆🔐\n👮 Order by :️ @'..msg.from.username
else
return 'Gifs is already muted 🎆🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'doc' then
local msg_type = 'Documents'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'documents has been muted 📂🔐\n👮 Order by :️ @'..msg.from.username
else
return 'documents is already muted 📂🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Text has been muted 📝🔐\n👮 Order by :️ @'..msg.from.username
else
return 'Text is already muted 📝🔐\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'all' then
local msg_type = 'All'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
return 'Mute all has been enabled 🔕\n👮 Order by :️ @'..msg.from.username
else
return 'Mute all is already enabled 🔕\n👮 Order by :️ @'..msg.from.username
end
end
end
if matches[1] == 'u' and is_momod(msg) then
local chat_id = msg.to.id
if matches[2] == 'audio' then
local msg_type = 'Audio'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'Audio has been unmuted 🎵🔓\n👮 Order by :️ @'..msg.from.username
else
return 'Audio is already unmuted 🎵🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'photo' then
local msg_type = 'Photo'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'Photo has been unmuted 🎡🔓\n👮 Order by :️ @'..msg.from.username
else
return 'Photo is already unmuted 🎡🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'Video has been unmuted 🎥🔓\n👮 Order by :️ @'..msg.from.username
else
return 'Video is already unmuted 🎥🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'Gifs has been unmuted 🎆🔓\n👮 Order by :️ @'..msg.from.username
else
return 'Gifs is already unmuted 🎆🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'doc' then
local msg_type = 'Documents'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'documents has been unmuted 📂🔓\n👮 Order by :️ @'..msg.from.username
else
return 'documents is already unmuted 📂🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute message")
unmute(chat_id, msg_type)
return 'Text has been unmuted 📝🔓\n👮 Order by :️ @'..msg.from.username
else
return 'Text is already unmuted 📝🔓\n👮 Order by :️ @'..msg.from.username
end
end
if matches[2] == 'all' then
local msg_type = 'All'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
return 'Mute all has been disabled 🔔\n👮 Order by :️ @'..msg.from.username
else
return 'Mute all is already disabled 🔔\n👮 Order by :️ @'..msg.from.username
end
end
end
if matches[1] == "silent" or matches[1] == "unsilent" and is_momod(msg) then
local chat_id = msg.to.id
local hash = "mute_user"..chat_id
local user_id = ""
if type(msg.reply_id) ~= "nil" then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
muteuser = get_message(msg.reply_id, get_message_callback, {receiver = receiver, get_cmd = get_cmd, msg = msg})
elseif matches[1] == "silent" or matches[1] == "unsilent" and string.match(matches[2], '^%d+$') then
local user_id = matches[2]
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] removed ["..user_id.."] from the muted users list")
return "["..user_id.."] removed from the muted users list"
elseif is_momod(msg) then
mute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] added ["..user_id.."] to the muted users list")
return "["..user_id.."] added to the muted user list"
end
elseif matches[1] == "silent" or matches[1] == "unsilent" and not string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
resolve_username(username, callbackres, {receiver = receiver, get_cmd = get_cmd, msg=msg})
end
end
if matches[1] == "muteslist" and is_momod(msg) then
local chat_id = msg.to.id
if not has_mutes(chat_id) then
set_mutes(chat_id)
return mutes_list(chat_id)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup muteslist")
return mutes_list(chat_id)
end
if matches[1] == "silentlist" and is_momod(msg) then
local chat_id = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup mutelist")
return muted_user_list(chat_id)
end
if matches[1] == 'settings' and is_momod(msg) then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup settings ")
return show_supergroup_settingsmod(msg, target)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'help' and not is_owner(msg) then
text = "Only managers 😐⛔️"
reply_msg(msg.id, text, ok_cb, false)
elseif matches[1] == 'help' and is_owner(msg) then
local name_log = user_print_name(msg.from)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /superhelp")
return super_help()
end
if matches[1] == 'peer_id' and is_admin1(msg)then
text = msg.to.peer_id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
if matches[1] == 'msg.to.id' and is_admin1(msg) then
text = msg.to.id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
--Admin Join Service Message
if msg.service then
local action = msg.action.type
if action == 'chat_add_user_link' then
if is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Admin ["..msg.from.id.."] joined the SuperGroup via link")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.from.id) and not is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Support member ["..msg.from.id.."] joined the SuperGroup")
channel_set_mod(receiver, user, ok_cb, false)
end
end
if action == 'chat_add_user' then
if is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Admin ["..msg.action.user.id.."] added to the SuperGroup by [ "..msg.from.id.." ]")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.action.user.id) and not is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Support member ["..msg.action.user.id.."] added to the SuperGroup by [ "..msg.from.id.." ]")
channel_set_mod(receiver, user, ok_cb, false)
end
end
end
if matches[1] == 'msg.to.peer_id' then
post_large_msg(receiver, msg.to.peer_id)
end
end
end
local function pre_process(msg)
if not msg.text and msg.media then
msg.text = '['..msg.media.type..']'
end
return msg
end
return {
patterns = {
"^([Aa]ddbot)$",
"^([Rr]embot)$",
"^([Mm]ove) (.*)$",
"^([Gg]pinfo)$",
"^([Aa]dmins)$",
"^([Oo]wner)$",
"^([Mm]odlist)$",
"^([Bb]ots)$",
"^([Ww]ho)$",
"^([Kk]icked)$",
"^([Bb]b) (.*)",
"^([Bb]b)",
"^([Kk]ick) (.*)",
"^([Kk]ick)",
"^([Tt]osuper)$",
"^([Ii][Dd])$",
"^([Ii][Dd]) (.*)$",
"^([Kk]ickme)$",
"^([Nn]ewlink)$",
"^([Ss]etlink)$",
"^([Ll]ink)$",
"^([Rr]es) (.*)$",
"^([Ss]etadmin) (.*)$",
"^([Ss]etadmin)",
"^([Dd]emoteadmin) (.*)$",
"^([Dd]emoteadmin)",
"^([Ss]etowner) (.*)$",
"^([Ss]etowner)$",
"^([Pp]romote) (.*)$",
"^([Pp]romote)",
"^([Dd]emote) (.*)$",
"^([Dd]emote)",
"^([Ss]etname) (.*)$",
"^([Ss]etabout) (.*)$",
"^([Ss]etrules) (.*)$",
"^([Ss]etphoto)$",
"^([Ss]etusername) (.*)$",
"^([Dd]el)$",
"^(d) (.*)$",
"^(u) (.*)$",
"^(d) ([^%s]+)$",
"^(u) ([^%s]+)$",
"^([Ss]ilent)$",
"^([Ss]ilent) (.*)$",
"^([Uu]nsilent)$",
"^([Uu]nsilent) (.*)$",
"^([Pp]ublic) (.*)$",
"^([Ss]ettings)$",
"^([Rr]ules)$",
"^([Ss]etflood) (%d+)$",
"^([Cc]lean) (.*)$",
"^[#!/]([Hh]elp)$",
"^([Mm]uteslist)$",
"^([Ss]ilentlist)$",
"(mp) (.*)",
"(md) (.*)",
"^(https://telegram.me/joinchat/%S+)$",
"msg.to.peer_id",
"%[(document)%]",
"%[(photo)%]",
"%[(video)%]",
"%[(audio)%]",
"%[(contact)%]",
"^!!tgservice (.+)$",
},
run = DevPointTeam,
pre_process = pre_process
}
--@DevPointTeam
--@TH3_GHOST
| gpl-2.0 |
alexandergall/snabbswitch | src/lib/protocol/ipv6.lua | 7 | 5307 | -- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local ffi = require("ffi")
local C = ffi.C
local lib = require("core.lib")
local header = require("lib.protocol.header")
local htons, ntohs = lib.htons, lib.ntohs
local AF_INET6 = 10
local INET6_ADDRSTRLEN = 48
local defaults = {
traffic_class = 0,
flow_label = 0,
next_header = 59, -- no next header
hop_limit = 64,
}
local ipv6hdr_pseudo_t = ffi.typeof[[
struct {
char src_ip[16];
char dst_ip[16];
uint16_t ulp_zero;
uint16_t ulp_length;
uint8_t zero[3];
uint8_t next_header;
} __attribute__((packed))
]]
local ipv6_addr_t = ffi.typeof("uint16_t[8]")
local ipv6 = subClass(header)
-- Class variables
ipv6._name = "ipv6"
ipv6._ulp = {
class_map = {
[6] = "lib.protocol.tcp",
[17] = "lib.protocol.udp",
[47] = "lib.protocol.gre",
[58] = "lib.protocol.icmp.header",
[115] = "lib.protocol.keyed_ipv6_tunnel",
},
method = 'next_header' }
header.init(ipv6,
{
[1] = ffi.typeof[[
struct {
uint32_t v_tc_fl; // version, tc, flow_label
uint16_t payload_length;
uint8_t next_header;
uint8_t hop_limit;
uint8_t src_ip[16];
uint8_t dst_ip[16];
} __attribute__((packed))
]]
})
-- Class methods
function ipv6:new (config)
local o = ipv6:superClass().new(self)
if not o._recycled then
o._ph = ipv6hdr_pseudo_t()
end
o:version(6)
o:traffic_class(config.traffic_class or defaults.traffic_class)
o:flow_label(config.flow_label or defaults.flow_label)
o:next_header(config.next_header or defaults.next_header)
o:hop_limit(config.hop_limit or defaults.hop_limit)
o:src(config.src)
o:dst(config.dst)
return o
end
function ipv6:new_from_mem(mem, size)
local o = ipv6:superClass().new_from_mem(self, mem, size)
if o == nil then
return nil
end
if not o._recycled then
o._ph = ipv6hdr_pseudo_t()
end
return o
end
function ipv6:pton (p)
local in_addr = ffi.new("uint8_t[16]")
local result = C.inet_pton(AF_INET6, p, in_addr)
if result ~= 1 then
return false, "malformed IPv6 address: " .. p
end
return in_addr
end
function ipv6:ntop (n)
local p = ffi.new("char[?]", INET6_ADDRSTRLEN)
local c_str = C.inet_ntop(AF_INET6, n, p, INET6_ADDRSTRLEN)
return ffi.string(c_str)
end
function ipv6:get()
return self:ntop(self)
end
function ipv6:set(addr)
self:pton(addr)
end
-- Construct the solicited-node multicast address from the given
-- unicast address by appending the last 24 bits to ff02::1:ff00:0/104
function ipv6:solicited_node_mcast (n)
local n = ffi.cast("uint8_t *", n)
local result = self:pton("ff02:0:0:0:0:1:ff00:0")
ffi.copy(ffi.cast("uint8_t *", result)+13, n+13, 3)
return result
end
-- Instance methods
function ipv6:version (v)
return lib.bitfield(32, self:header(), 'v_tc_fl', 0, 4, v)
end
function ipv6:traffic_class (tc)
return lib.bitfield(32, self:header(), 'v_tc_fl', 4, 8, tc)
end
function ipv6:dscp (dscp)
return lib.bitfield(32, self:header(), 'v_tc_fl', 4, 6, dscp)
end
function ipv6:ecn (ecn)
return lib.bitfield(32, self:header(), 'v_tc_fl', 10, 2, ecn)
end
function ipv6:flow_label (fl)
return lib.bitfield(32, self:header(), 'v_tc_fl', 12, 20, fl)
end
function ipv6:payload_length (length)
if length ~= nil then
self:header().payload_length = htons(length)
else
return(ntohs(self:header().payload_length))
end
end
function ipv6:next_header (nh)
if nh ~= nil then
self:header().next_header = nh
else
return(self:header().next_header)
end
end
function ipv6:hop_limit (limit)
if limit ~= nil then
self:header().hop_limit = limit
else
return(self:header().hop_limit)
end
end
function ipv6:src (ip)
if ip ~= nil then
ffi.copy(self:header().src_ip, ip, 16)
else
return self:header().src_ip
end
end
function ipv6:src_eq (ip)
return C.memcmp(ip, self:header().src_ip, 16) == 0
end
function ipv6:dst (ip)
if ip ~= nil then
ffi.copy(self:header().dst_ip, ip, 16)
else
return self:header().dst_ip
end
end
function ipv6:dst_eq (ip)
return C.memcmp(ip, self:header().dst_ip, 16) == 0
end
-- Return a pseudo header for checksum calculation in a upper-layer
-- protocol (e.g. icmp). Note that the payload length and next-header
-- values in the pseudo-header refer to the effective upper-layer
-- protocol. They differ from the respective values of the ipv6
-- header if extension headers are present.
function ipv6:pseudo_header (plen, nh)
local ph = self._ph
ffi.fill(ph, ffi.sizeof(ph))
local h = self:header()
ffi.copy(ph, h.src_ip, 32) -- Copy source and destination
ph.ulp_length = htons(plen)
ph.next_header = nh
return(ph)
end
function selftest()
local ipv6_address = "2001:620:0:c101::2"
assert(ipv6_address == ipv6:ntop(ipv6:pton(ipv6_address)),
'ipv6 text to binary conversion failed.')
end
ipv6.selftest = selftest
return ipv6
| apache-2.0 |
Canaan-Creative/luci | modules/admin-full/luasrc/model/cbi/admin_network/iface_add.lua | 79 | 3091 | --[[
LuCI - Lua Configuration Interface
Copyright 2009-2010 Jo-Philipp Wich <xm@subsignal.org>
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
$Id$
]]--
local nw = require "luci.model.network".init()
local fw = require "luci.model.firewall".init()
local utl = require "luci.util"
local uci = require "luci.model.uci".cursor()
m = SimpleForm("network", translate("Create Interface"))
m.redirect = luci.dispatcher.build_url("admin/network/network")
m.reset = false
newnet = m:field(Value, "_netname", translate("Name of the new interface"),
translate("The allowed characters are: <code>A-Z</code>, <code>a-z</code>, " ..
"<code>0-9</code> and <code>_</code>"
))
newnet:depends("_attach", "")
newnet.default = arg[1] and "net_" .. arg[1]:gsub("[^%w_]+", "_")
newnet.datatype = "uciname"
newproto = m:field(ListValue, "_netproto", translate("Protocol of the new interface"))
netbridge = m:field(Flag, "_bridge", translate("Create a bridge over multiple interfaces"))
sifname = m:field(Value, "_ifname", translate("Cover the following interface"))
sifname.widget = "radio"
sifname.template = "cbi/network_ifacelist"
sifname.nobridges = true
mifname = m:field(Value, "_ifnames", translate("Cover the following interfaces"))
mifname.widget = "checkbox"
mifname.template = "cbi/network_ifacelist"
mifname.nobridges = true
local _, p
for _, p in ipairs(nw:get_protocols()) do
if p:is_installed() then
newproto:value(p:proto(), p:get_i18n())
if not p:is_virtual() then netbridge:depends("_netproto", p:proto()) end
if not p:is_floating() then
sifname:depends({ _bridge = "", _netproto = p:proto()})
mifname:depends({ _bridge = "1", _netproto = p:proto()})
end
end
end
function newproto.validate(self, value, section)
local name = newnet:formvalue(section)
if not name or #name == 0 then
newnet:add_error(section, translate("No network name specified"))
elseif m:get(name) then
newnet:add_error(section, translate("The given network name is not unique"))
end
local proto = nw:get_protocol(value)
if proto and not proto:is_floating() then
local br = (netbridge:formvalue(section) == "1")
local ifn = br and mifname:formvalue(section) or sifname:formvalue(section)
for ifn in utl.imatch(ifn) do
return value
end
return nil, translate("The selected protocol needs a device assigned")
end
return value
end
function newproto.write(self, section, value)
local name = newnet:formvalue(section)
if name and #name > 0 then
local br = (netbridge:formvalue(section) == "1") and "bridge" or nil
local net = nw:add_network(name, { proto = value, type = br })
if net then
local ifn
for ifn in utl.imatch(
br and mifname:formvalue(section) or sifname:formvalue(section)
) do
net:add_interface(ifn)
end
nw:save("network")
nw:save("wireless")
end
luci.http.redirect(luci.dispatcher.build_url("admin/network/network", name))
end
end
return m
| apache-2.0 |
rogerpueyo/luci | modules/luci-compat/luasrc/model/network/proto_relay.lua | 11 | 3063 | -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
local netmod = luci.model.network
local device = luci.util.class(netmod.interface)
netmod:register_pattern_virtual("^relay%-%w")
local proto = netmod:register_protocol("relay")
function proto.get_i18n(self)
return luci.i18n.translate("Relay bridge")
end
function proto.ifname(self)
return "relay-" .. self.sid
end
function proto.opkg_package(self)
return "relayd"
end
function proto.is_installed(self)
return nixio.fs.access("/etc/init.d/relayd")
end
function proto.is_floating(self)
return true
end
function proto.is_virtual(self)
return true
end
function proto.is_up(self)
local iface = self:get_interface()
return iface and iface:is_up() or false
end
function proto.get_interface(self)
return device(self.sid, self)
end
function proto.get_interfaces(self)
if not self.ifaces then
local ifs = { }
local _, net, dev
for net in luci.util.imatch(self:_get("network")) do
net = netmod:get_network(net)
if net then
dev = net:get_interface()
if dev then
ifs[dev:name()] = dev
end
end
end
for dev in luci.util.imatch(self:_get("ifname")) do
dev = netmod:get_interface(dev)
if dev then
ifs[dev:name()] = dev
end
end
self.ifaces = { }
for _, dev in luci.util.kspairs(ifs) do
self.ifaces[#self.ifaces+1] = dev
end
end
return self.ifaces
end
function proto.uptime(self)
local net
local upt = 0
for net in luci.util.imatch(self:_get("network")) do
net = netmod:get_network(net)
if net then
upt = math.max(upt, net:uptime())
end
end
return upt
end
function proto.errors(self)
return nil
end
function device.__init__(self, ifname, network)
self.ifname = ifname
self.network = network
end
function device.type(self)
return "tunnel"
end
function device.is_up(self)
if self.network then
local _, dev
for _, dev in ipairs(self.network:get_interfaces()) do
if not dev:is_up() then
return false
end
end
return true
end
return false
end
function device._stat(self, what)
local v = 0
if self.network then
local _, dev
for _, dev in ipairs(self.network:get_interfaces()) do
v = v + dev[what](dev)
end
end
return v
end
function device.rx_bytes(self) return self:_stat("rx_bytes") end
function device.tx_bytes(self) return self:_stat("tx_bytes") end
function device.rx_packets(self) return self:_stat("rx_packets") end
function device.tx_packets(self) return self:_stat("tx_packets") end
function device.mac(self)
if self.network then
local _, dev
for _, dev in ipairs(self.network:get_interfaces()) do
return dev:mac()
end
end
end
function device.ipaddrs(self)
local addrs = { }
if self.network then
addrs[1] = luci.ip.IPv4(self.network:_get("ipaddr"))
end
return addrs
end
function device.ip6addrs(self)
return { }
end
function device.shortname(self)
return "%s %q" % { luci.i18n.translate("Relay"), self.ifname }
end
function device.get_type_i18n(self)
return luci.i18n.translate("Relay Bridge")
end
| apache-2.0 |
jackywgw/ntopng_test | scripts/lua/get_system_hosts_interaction.lua | 2 | 5405 | --
-- (C) 2013-15 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
sendHTTPHeader('text/json')
interface.select(ifname)
flows_stats,total = aggregateFlowsStats(flows_stats = interface.getFlowsInfo())
local debug = false
local httpdocs = dirs.installdir..'/httpdocs'
local icon_root = ntop.getHttpPrefix() .. '/img/interaction-graph-icons/'
local icon_extension = '.png'
links = {}
num = 0
function file_exists(path)
local f=io.open(path,"r")
if f~=nil then io.close(f) return true else return false end
end
function get_icon_url(name)
local icon_url = icon_root..name..icon_extension
if (file_exists(httpdocs..icon_url)) then return icon_url else return '' end
end
is_loopback = isLoopback(ifname)
for key, value in pairs(flows_stats) do
-- Find client and server name
srv_name = flows_stats[key]["srv.host"]
if((srv_name == "") or (srv_name == nil)) then
srv_name = flows_stats[key]["srv.ip"]
end
srv_name = ntop.getResolvedAddress(srv_name)
cli_name = flows_stats[key]["cli.host"]
if((cli_name == "") or (cli_name == nil)) then
cli_name = flows_stats[key]["cli.ip"]
end
cli_name = ntop.getResolvedAddress(cli_name)
-- consider only full meshed connections
if((flows_stats[key]["client_process"] ~= nil) or (flows_stats[key]["system_process"] ~= nil) ) then
-- Get client and server information
if (flows_stats[key]["client_process"] ~= nil) then
if(is_loopback) then
client_id = flows_stats[key]["cli.source_id"]..'-localhost-'..flows_stats[key]["client_process"]["pid"]
else
client_id = flows_stats[key]["cli.source_id"]..'-'..flows_stats[key]["cli.ip"]..'-'..flows_stats[key]["client_process"]["pid"]
end
client_name = flows_stats[key]["client_process"]["name"]
client_type = "syshost"
else
client_id = flows_stats[key]["cli.source_id"]..'-'..flows_stats[key]["cli.ip"]
client_name = abbreviateString(cli_name, 20)
client_type = "host"
end
if (flows_stats[key]["server_process"] ~= nil) then
if(is_loopback) then
server_id = flows_stats[key]["srv.source_id"]..'-localhost-'..flows_stats[key]["server_process"]["pid"]
else
server_id = flows_stats[key]["srv.source_id"]..'-'..flows_stats[key]["srv.ip"]..'-'..flows_stats[key]["server_process"]["pid"]
end
server_name = flows_stats[key]["server_process"]["name"]
server_type = "syshost"
else
server_id = flows_stats[key]["srv.source_id"]..'-'..flows_stats[key]["srv.ip"]
server_name = abbreviateString(srv_name, 20)
server_type = "host"
end
-- Create link key (0-127.0.0.1-24829-chromium-browser:0-127.0.0.1-29911-ntopng)
key_link = client_id.."-"..client_name..":"..server_id.."-"..server_name
if (debug) then io.write("Link key:"..key_link.."\n") end
if (links[key_link] == nil) then
-- Init links whit default values
links[key_link] = {};
links[key_link]["client_id"] = client_id
links[key_link]["client_system_id"] = flows_stats[key]["cli.source_id"];
links[key_link]["client_name"] = client_name
links[key_link]["client_type"] = client_type
links[key_link]["server_id"] = server_id
links[key_link]["server_system_id"] = flows_stats[key]["srv.source_id"];
links[key_link]["server_name"] = server_name
links[key_link]["server_type"] = server_type
-- Init Links aggregation values
links[key_link]["bytes"] = flows_stats[key]["bytes"]
links[key_link]["srv2cli.bytes"] = flows_stats[key]["srv2cli.bytes"]
links[key_link]["cli2srv.bytes"] = flows_stats[key]["cli2srv.bytes"]
else
-- Aggregate values
links[key_link]["bytes"] = links[key_link]["bytes"] + flows_stats[key]["bytes"]
links[key_link]["cli2srv.bytes"] = links[key_link]["cli2srv.bytes"] + flows_stats[key]["cli2srv.bytes"]
links[key_link]["srv2cli.bytes"] = links[key_link]["srv2cli.bytes"] + flows_stats[key]["srv2cli.bytes"]
end
end
end
print('[\n')
-- Create link (flows)
num = 0
for key, value in pairs(links) do
link = links[key]
process = 1
-- Condition
-- if ((flows_stats[key]["server_process"] == nil) or
-- (flows_stats[key]["client_process"] == nil)) then
-- process = 0
-- end
-- Get information
if(process == 1) then
if (num > 0) then print(',\n') end
print('{'..
'\"client\":\"' .. link["client_id"] .. '\",' ..
'\"client_system_id\":\"' .. link["client_system_id"] .. '\",' ..
'\"client_name\":\"' .. link["client_name"] .. '\",' ..
'\"client_type\":\"' .. link["client_type"] .. '\",' ..
'\"client_icon\":\"' .. get_icon_url(link["client_name"]) .. '\",' ..
'\"server\":\"' .. link["server_id"] .. '\",' ..
'\"server_system_id\":\"' .. link["server_system_id"] .. '\",' ..
'\"server_name\":\"' .. link["server_name"] .. '\",' ..
'\"server_type\":\"' .. link["server_type"] .. '\",' ..
'\"server_icon\":\"' .. get_icon_url(link["server_name"]) .. '\",' ..
'\"bytes\":' .. link["bytes"] .. ',' ..
'\"cli2srv_bytes\":' .. link["cli2srv.bytes"] .. ',' ..
'\"srv2cli_bytes\":' .. link["srv2cli.bytes"] ..
'}')
num = num + 1
end
end
print('\n]')
| gpl-3.0 |
nwf/nodemcu-firmware | app/lua53/host/tests/attrib.lua | 7 | 12047 | -- $Id: attrib.lua,v 1.65 2016/11/07 13:11:28 roberto Exp $
-- See Copyright Notice in file all.lua
print "testing require"
assert(require"string" == string)
assert(require"math" == math)
assert(require"table" == table)
assert(require"io" == io)
assert(require"os" == os)
assert(require"coroutine" == coroutine)
assert(type(package.path) == "string")
--[[NodeMCU doesn't support dynamic C loading
assert(type(package.cpath) == "string")
]]
assert(type(package.loaded) == "table")
assert(type(package.preload) == "table")
assert(type(package.config) == "string")
print("package config: "..string.gsub(package.config, "\n", "|"))
--[[TODO: NodeMCU doesn't support dynamic C loading
do
-- create a path with 'max' templates,
-- each with 1-10 repetitions of '?'
local max = _soft and 100 or 2000
local t = {}
for i = 1,max do t[i] = string.rep("?", i%10 + 1) end
t[#t + 1] = ";" -- empty template
local path = table.concat(t, ";")
-- use that path in a search
local s, err = package.searchpath("xuxu", path)
-- search fails; check that message has an occurence of
-- '??????????' with ? replaced by xuxu and at least 'max' lines
assert(not s and
string.find(err, string.rep("xuxu", 10)) and
#string.gsub(err, "[^\n]", "") >= max)
-- path with one very long template
local path = string.rep("?", max)
local s, err = package.searchpath("xuxu", path)
assert(not s and string.find(err, string.rep('xuxu', max)))
end
]]
do
local oldpath = package.path
package.path = {}
local s, err = pcall(require, "no-such-file")
assert(not s and string.find(err, "package.path"))
package.path = oldpath
end
print('+')
-- The next tests for 'require' assume some specific directories and
-- libraries.
--[=[TODO: NodeMCU doesn't support dynamic loading and rich FS. Might to use a subset here
if not _port then --[
local dirsep = string.match(package.config, "^([^\n]+)\n")
-- auxiliary directory with C modules and temporary files
local DIR = "libs" .. dirsep
-- prepend DIR to a name and correct directory separators
local function D (x)
x = string.gsub(x, "/", dirsep)
return DIR .. x
end
-- prepend DIR and pospend proper C lib. extension to a name
local function DC (x)
local ext = (dirsep == '\\') and ".dll" or ".so"
return D(x .. ext)
end
local function createfiles (files, preextras, posextras)
for n,c in pairs(files) do
io.output(D(n))
io.write(string.format(preextras, n))
io.write(c)
io.write(string.format(posextras, n))
io.close(io.output())
end
end
function removefiles (files)
for n in pairs(files) do
os.remove(D(n))
end
end
local files = {
["names.lua"] = "do return {...} end\n",
["err.lua"] = "B = 15; a = a + 1;",
["synerr.lua"] = "B =",
["A.lua"] = "",
["B.lua"] = "assert(...=='B');require 'A'",
["A.lc"] = "",
["A"] = "",
["L"] = "",
["XXxX"] = "",
["C.lua"] = "package.loaded[...] = 25; require'C'",
}
AA = nil
local extras = [[
NAME = '%s'
REQUIRED = ...
return AA]]
createfiles(files, "", extras)
-- testing explicit "dir" separator in 'searchpath'
assert(package.searchpath("C.lua", D"?", "", "") == D"C.lua")
assert(package.searchpath("C.lua", D"?", ".", ".") == D"C.lua")
assert(package.searchpath("--x-", D"?", "-", "X") == D"XXxX")
assert(package.searchpath("---xX", D"?", "---", "XX") == D"XXxX")
assert(package.searchpath(D"C.lua", "?", dirsep) == D"C.lua")
assert(package.searchpath(".\\C.lua", D"?", "\\") == D"./C.lua")
local oldpath = package.path
package.path = string.gsub("D/?.lua;D/?.lc;D/?;D/??x?;D/L", "D/", DIR)
local try = function (p, n, r)
NAME = nil
local rr = require(p)
assert(NAME == n)
assert(REQUIRED == p)
assert(rr == r)
end
a = require"names"
assert(a[1] == "names" and a[2] == D"names.lua")
_G.a = nil
local st, msg = pcall(require, "err")
assert(not st and string.find(msg, "arithmetic") and B == 15)
st, msg = pcall(require, "synerr")
assert(not st and string.find(msg, "error loading module"))
assert(package.searchpath("C", package.path) == D"C.lua")
assert(require"C" == 25)
assert(require"C" == 25)
AA = nil
try('B', 'B.lua', true)
assert(package.loaded.B)
assert(require"B" == true)
assert(package.loaded.A)
assert(require"C" == 25)
package.loaded.A = nil
try('B', nil, true) -- should not reload package
try('A', 'A.lua', true)
package.loaded.A = nil
os.remove(D'A.lua')
AA = {}
try('A', 'A.lc', AA) -- now must find second option
assert(package.searchpath("A", package.path) == D"A.lc")
assert(require("A") == AA)
AA = false
try('K', 'L', false) -- default option
try('K', 'L', false) -- default option (should reload it)
assert(rawget(_G, "_REQUIREDNAME") == nil)
AA = "x"
try("X", "XXxX", AA)
removefiles(files)
-- testing require of sub-packages
local _G = _G
package.path = string.gsub("D/?.lua;D/?/init.lua", "D/", DIR)
files = {
["P1/init.lua"] = "AA = 10",
["P1/xuxu.lua"] = "AA = 20",
}
createfiles(files, "_ENV = {}\n", "\nreturn _ENV\n")
AA = 0
local m = assert(require"P1")
assert(AA == 0 and m.AA == 10)
assert(require"P1" == m)
assert(require"P1" == m)
assert(package.searchpath("P1.xuxu", package.path) == D"P1/xuxu.lua")
m.xuxu = assert(require"P1.xuxu")
assert(AA == 0 and m.xuxu.AA == 20)
assert(require"P1.xuxu" == m.xuxu)
assert(require"P1.xuxu" == m.xuxu)
assert(require"P1" == m and m.AA == 10)
removefiles(files)
package.path = ""
assert(not pcall(require, "file_does_not_exist"))
package.path = "??\0?"
assert(not pcall(require, "file_does_not_exist1"))
package.path = oldpath
-- check 'require' error message
local fname = "file_does_not_exist2"
local m, err = pcall(require, fname)
for t in string.gmatch(package.path..";"..package.cpath, "[^;]+") do
t = string.gsub(t, "?", fname)
assert(string.find(err, t, 1, true))
end
do -- testing 'package.searchers' not being a table
local searchers = package.searchers
package.searchers = 3
local st, msg = pcall(require, 'a')
assert(not st and string.find(msg, "must be a table"))
package.searchers = searchers
end
local function import(...)
local f = {...}
return function (m)
for i=1, #f do m[f[i]] = _G[f[i]] end
end
end
-- cannot change environment of a C function
assert(not pcall(module, 'XUXU'))
-- testing require of C libraries
local p = "" -- On Mac OS X, redefine this to "_"
-- check whether loadlib works in this system
local st, err, when = package.loadlib(DC"lib1", "*")
if not st then
local f, err, when = package.loadlib("donotexist", p.."xuxu")
assert(not f and type(err) == "string" and when == "absent")
;(Message or print)('\n >>> cannot load dynamic library <<<\n')
print(err, when)
else
-- tests for loadlib
local f = assert(package.loadlib(DC"lib1", p.."onefunction"))
local a, b = f(15, 25)
assert(a == 25 and b == 15)
f = assert(package.loadlib(DC"lib1", p.."anotherfunc"))
assert(f(10, 20) == "10%20\n")
-- check error messages
local f, err, when = package.loadlib(DC"lib1", p.."xuxu")
assert(not f and type(err) == "string" and when == "init")
f, err, when = package.loadlib("donotexist", p.."xuxu")
assert(not f and type(err) == "string" and when == "open")
-- symbols from 'lib1' must be visible to other libraries
f = assert(package.loadlib(DC"lib11", p.."luaopen_lib11"))
assert(f() == "exported")
-- test C modules with prefixes in names
package.cpath = DC"?"
local lib2 = require"lib2-v2"
-- check correct access to global environment and correct
-- parameters
assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2")
assert(lib2.id("x") == "x")
-- test C submodules
local fs = require"lib1.sub"
assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1")
assert(fs.id(45) == 45)
end
_ENV = _G
-- testing preload
do
local p = package
package = {}
p.preload.pl = function (...)
local _ENV = {...}
function xuxu (x) return x+20 end
return _ENV
end
local pl = require"pl"
assert(require"pl" == pl)
assert(pl.xuxu(10) == 30)
assert(pl[1] == "pl" and pl[2] == nil)
package = p
assert(type(package.path) == "string")
end
print('+')
end --]
--]=]
print("testing assignments, logical operators, and constructors")
local res, res2 = 27
a, b = 1, 2+3
assert(a==1 and b==5)
a={}
function f() return 10, 11, 12 end
a.x, b, a[1] = 1, 2, f()
assert(a.x==1 and b==2 and a[1]==10)
a[f()], b, a[f()+3] = f(), a, 'x'
assert(a[10] == 10 and b == a and a[13] == 'x')
do
local f = function (n) local x = {}; for i=1,n do x[i]=i end;
return table.unpack(x) end;
local a,b,c
a,b = 0, f(1)
assert(a == 0 and b == 1)
A,b = 0, f(1)
assert(A == 0 and b == 1)
a,b,c = 0,5,f(4)
assert(a==0 and b==5 and c==1)
a,b,c = 0,5,f(0)
assert(a==0 and b==5 and c==nil)
end
a, b, c, d = 1 and nil, 1 or nil, (1 and (nil or 1)), 6
assert(not a and b and c and d==6)
d = 20
a, b, c, d = f()
assert(a==10 and b==11 and c==12 and d==nil)
a,b = f(), 1, 2, 3, f()
assert(a==10 and b==1)
assert(a<b == false and a>b == true)
assert((10 and 2) == 2)
assert((10 or 2) == 10)
assert((10 or assert(nil)) == 10)
assert(not (nil and assert(nil)))
assert((nil or "alo") == "alo")
assert((nil and 10) == nil)
assert((false and 10) == false)
assert((true or 10) == true)
assert((false or 10) == 10)
assert(false ~= nil)
assert(nil ~= false)
assert(not nil == true)
assert(not not nil == false)
assert(not not 1 == true)
assert(not not a == true)
assert(not not (6 or nil) == true)
assert(not not (nil and 56) == false)
assert(not not (nil and true) == false)
assert(not 10 == false)
assert(not {} == false)
assert(not 0.5 == false)
assert(not "x" == false)
assert({} ~= {})
print('+')
a = {}
a[true] = 20
a[false] = 10
assert(a[1<2] == 20 and a[1>2] == 10)
function f(a) return a end
local a = {}
for i=3000,-3000,-1 do a[i + 0.0] = i; end
a[10e30] = "alo"; a[true] = 10; a[false] = 20
assert(a[10e30] == 'alo' and a[not 1] == 20 and a[10<20] == 10)
for i=3000,-3000,-1 do assert(a[i] == i); end
a[print] = assert
a[f] = print
a[a] = a
assert(a[a][a][a][a][print] == assert)
a[print](a[a[f]] == a[print])
assert(not pcall(function () local a = {}; a[nil] = 10 end))
assert(not pcall(function () local a = {[nil] = 10} end))
assert(a[nil] == nil)
a = nil
a = {10,9,8,7,6,5,4,3,2; [-3]='a', [f]=print, a='a', b='ab'}
a, a.x, a.y = a, a[-3]
assert(a[1]==10 and a[-3]==a.a and a[f]==print and a.x=='a' and not a.y)
a[1], f(a)[2], b, c = {['alo']=assert}, 10, a[1], a[f], 6, 10, 23, f(a), 2
a[1].alo(a[2]==10 and b==10 and c==print)
-- test of large float/integer indices
-- compute maximum integer where all bits fit in a float
local maxint = math.maxinteger
while maxint - 1.0 == maxint - 0.0 do -- trim (if needed) to fit in a float
maxint = maxint // 2
end
maxintF = maxint + 0.0 -- float version
assert(math.type(maxintF) == "float" and maxintF >= 2.0^14)
-- floats and integers must index the same places
a[maxintF] = 10; a[maxintF - 1.0] = 11;
a[-maxintF] = 12; a[-maxintF + 1.0] = 13;
assert(a[maxint] == 10 and a[maxint - 1] == 11 and
a[-maxint] == 12 and a[-maxint + 1] == 13)
a[maxint] = 20
a[-maxint] = 22
assert(a[maxintF] == 20 and a[maxintF - 1.0] == 11 and
a[-maxintF] == 22 and a[-maxintF + 1.0] == 13)
a = nil
-- test conflicts in multiple assignment
do
local a,i,j,b
a = {'a', 'b'}; i=1; j=2; b=a
i, a[i], a, j, a[j], a[i+j] = j, i, i, b, j, i
assert(i == 2 and b[1] == 1 and a == 1 and j == b and b[2] == 2 and
b[3] == 1)
end
-- repeat test with upvalues
do
local a,i,j,b
a = {'a', 'b'}; i=1; j=2; b=a
local function foo ()
i, a[i], a, j, a[j], a[i+j] = j, i, i, b, j, i
end
foo()
assert(i == 2 and b[1] == 1 and a == 1 and j == b and b[2] == 2 and
b[3] == 1)
local t = {}
(function (a) t[a], a = 10, 20 end)(1);
assert(t[1] == 10)
end
-- bug in 5.2 beta
local function foo ()
local a
return function ()
local b
a, b = 3, 14 -- local and upvalue have same index
return a, b
end
end
local a, b = foo()()
assert(a == 3 and b == 14)
print('OK')
return res
| mit |
xponen/Zero-K | effects/yellow_lightning.lua | 8 | 19026 | -- yellow_lightning_bomb
-- yellow_lightning_bluebolts
-- yellow_lightning_groundflash
-- yellow_lightning_bomb_yellowbolts
-- yellow_lightning_muzzle
-- yellow_lightning_yellowbolts
-- yellow_lightning_bomb_bluebolts
-- yellow_lightningplosion
-- yellow_lightning_stormbolt
return {
["mixed_white_lightning_bomb_small"] = {
usedefaultexplosions = true,
groundflash = {
circlealpha = 1,
circlegrowth = 2,
flashalpha = 1.3,
flashsize = 25,
ground = true,
water = true,
ttl = 4,
color = {
[1] = 1,
[2] = 0.9,
[3] = 0.65,
},
},
whitebolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 3,
explosiongenerator = [[custom:WHITE_LIGHTNING_BOMB_BOLTS_SMALL]],
pos = [[0, 0, 0]],
},
},
pikes = {
air = true,
class = [[explspike]],
count = 2,
ground = true,
water = true,
properties = {
alpha = 0.8,
alphadecay = 0.1,
color = [[1,1,1]],
dir = [[-5 r10,-5 r10,-5 r10]],
length = 10,
width = 1.5,
},
},
},
["white_lightning_bomb"] = {
whitebolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 3,
explosiongenerator = [[custom:WHITE_LIGHTNING_BOMB_BOLTS]],
pos = [[0, 0, 0]],
},
},
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 32,
ground = true,
water = true,
ttl = 12,
color = {
[1] = 1,
[2] = 1,
[3] = 1,
},
},
pikes = {
air = true,
class = [[explspike]],
count = 2,
ground = true,
water = true,
properties = {
alpha = 0.8,
alphadecay = 0.1,
color = [[1,1,1]],
dir = [[-15 r30,-15 r30,-15 r30]],
length = 16,
width = 2,
},
},
},
["white_lightning_bomb_bolts_small"] = {
bluebolts = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[1 1 1 0.01 1 1 1 0.01 0.5 0.5 0.5 0.01 1 1 1 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 180,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 3,
particlelife = 1.5,
particlelifespread = 3,
particlesize = 20,
particlesizespread = 0,
particlespeed = 2,
particlespeedspread = 0,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["white_lightning_bomb_bolts"] = {
bluebolts = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[1 1 1 0.01 1 1 1 0.01 0.5 0.5 0.5 0.01 1 1 1 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 180,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 5,
particlelife = 2,
particlelifespread = 5,
particlesize = 40,
particlesizespread = 0,
particlespeed = 2,
particlespeedspread = 0,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["yellow_lightning_stormbolt"] = {
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 32,
ttl = 3,
color = {
[1] = 1,
[2] = 1,
[3] = 1,
},
},
lightningballs = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 1,
colormap = [[0 0 0 0.01 1 1 1 0.01 0 0 0 0.01]],
directional = true,
emitrot = 80,
emitrotspread = 0,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 1,
particlelife = 3,
particlelifespread = 0,
particlesize = 2,
particlesizespread = 20,
particlespeed = 0.01,
particlespeedspread = 0,
pos = [[-10 r20, 1.0, -10 r20]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["yellow_lightning_bomb"] = {
bluebolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 3,
explosiongenerator = [[custom:YELLOW_LIGHTNING_BOMB_BLUEBOLTS]],
pos = [[0, 0, 0]],
},
},
electricstorm = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = [[10 r200]],
explosiongenerator = [[custom:YELLOW_LIGHTNING_STORMBOLT]],
pos = [[-100 r200, 1, -100 r200]],
},
},
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 32,
ttl = 12,
color = {
[1] = 1,
[2] = 1,
[3] = 0.25,
},
},
pikes = {
air = true,
class = [[explspike]],
count = 2,
ground = true,
water = true,
properties = {
alpha = 0.8,
alphadecay = 0.1,
color = [[1,1,0.25]],
dir = [[-15 r30,-15 r30,-15 r30]],
length = 16,
width = 2,
},
},
yellowbolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 3,
explosiongenerator = [[custom:YELLOW_LIGHTNING_BOMB_YELLOWBOLTS]],
pos = [[0, 0, 0]],
},
},
},
["yellow_lightning_bluebolts"] = {
["electric thingies"] = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[1 1 0.25 0.01 1 1 0.25 0.01 0.5 0.5 1 0.01 1 1 0.25 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 180,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 5,
particlelife = 2,
particlelifespread = 5,
particlesize = 40,
particlesizespread = 0,
particlespeed = 2,
particlespeedspread = 0,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
sparks = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.97,
colormap = [[1 1 0.2 0.01 1 1 0.4 0.01 0.0 0.0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 60,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 40,
particlelife = 20,
particlelifespread = 5,
particlesize = 5,
particlesizespread = 0,
particlespeed = 5,
particlespeedspread = 0,
pos = [[0, 0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[spark]],
},
},
},
["yellow_lightning_groundflash"] = {
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 46,
ttl = 12,
color = {
[1] = 1,
[2] = 1,
[3] = 0.25,
},
},
},
["yellow_lightning_bomb_yellowbolts"] = {
yellowbolts = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.1,
colormap = [[1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 80,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 5,
particlelife = 8,
particlelifespread = 4,
particlesize = 15,
particlesizespread = 15,
particlespeed = 20,
particlespeedspread = 20,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["yellow_lightning_muzzle"] = {
usedefaultexplosions = false,
lightball = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[0.7 0.6 0 0.01 1 0.85 0 0.01 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = 1,
emitvector = [[dir]],
gravity = [[0, 0, 0]],
numparticles = 1,
particlelife = 20,
particlelifespread = 0,
particlesize = 15,
particlesizespread = 0,
particlespeed = 0,
particlespeedspread = 0,
pos = [[0, 0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[lightb3]],
},
},
lightball2 = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[0 0 0 0.01 0.3 0.25 0 0.01 0.7 0.6 0 0.01 1 0.85 0 0.01 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = 1,
emitvector = [[dir]],
gravity = [[0, 0, 0]],
numparticles = 1,
particlelife = 20,
particlelifespread = 0,
particlesize = 15,
particlesizespread = 0,
particlespeed = 0,
particlespeedspread = 0,
pos = [[0, 0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[lightb4]],
},
},
lightring = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[0.7 0.7 0 0.01 1 1 0 0.01 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = 1,
emitvector = [[dir]],
gravity = [[0, 0, 0]],
numparticles = 1,
particlelife = 20,
particlelifespread = 0,
particlesize = 1,
particlesizespread = 0,
particlespeed = 0,
particlespeedspread = 0,
pos = [[0, 0, 0]],
sizegrowth = 1,
sizemod = 1.0,
texture = [[lightring]],
},
},
},
["yellow_lightning_yellowbolts"] = {
["electric thingies2"] = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.1,
colormap = [[1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 1 1 0.25 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 80,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 10,
particlelife = 8,
particlelifespread = 4,
particlesize = 15,
particlesizespread = 15,
particlespeed = 20,
particlespeedspread = 20,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["yellow_lightning_bomb_bluebolts"] = {
bluebolts = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.95,
colormap = [[1 1 0.25 0.01 1 1 0.25 0.01 0.5 0.5 1 0.01 1 1 0.25 0.01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 180,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 5,
particlelife = 2,
particlelifespread = 5,
particlesize = 40,
particlesizespread = 0,
particlespeed = 2,
particlespeedspread = 0,
pos = [[0, 1.0, 0]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
["yellow_lightningplosion"] = {
bluebolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 0,
explosiongenerator = [[custom:YELLOW_LIGHTNING_BLUEBOLTS]],
pos = [[0, 0, 0]],
},
},
electricstorm = {
air = true,
class = [[CExpGenSpawner]],
count = 20,
ground = true,
water = true,
properties = {
delay = [[10 r200]],
explosiongenerator = [[custom:YELLOW_LIGHTNING_STORMBOLT]],
pos = [[-100 r200, 1, -100 r200]],
},
},
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 86,
ttl = 12,
color = {
[1] = 1,
[2] = 1,
[3] = 0.25,
},
},
pikes = {
air = true,
class = [[explspike]],
count = 15,
ground = true,
water = true,
properties = {
alpha = 0.8,
alphadecay = 0.1,
color = [[1,1,0.25]],
dir = [[-15 r30,-15 r30,-15 r30]],
length = 30,
width = 5,
},
},
yellowbolts = {
air = true,
class = [[CExpGenSpawner]],
count = 1,
ground = true,
water = true,
properties = {
delay = 3,
explosiongenerator = [[custom:YELLOW_LIGHTNING_YELLOWBOLTS]],
pos = [[0, 0, 0]],
},
},
},
["yellow_lightning_stormbolt"] = {
groundflash = {
circlealpha = 1,
circlegrowth = 0,
flashalpha = 0.3,
flashsize = 32,
ttl = 3,
color = {
[1] = 1,
[2] = 1,
[3] = 0.25,
},
},
lightningballs = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 1,
colormap = [[0 0 0 0.01 1 1 0.25 0.01 0 0 0 0.01]],
directional = true,
emitrot = 80,
emitrotspread = 0,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 1,
particlelife = 3,
particlelifespread = 0,
particlesize = 2,
particlesizespread = 20,
particlespeed = 0.01,
particlespeedspread = 0,
pos = [[-10 r20, 1.0, -10 r20]],
sizegrowth = 0,
sizemod = 1.0,
texture = [[whitelightb]],
},
},
},
}
| gpl-2.0 |
pokorj18/vlc | share/lua/playlist/koreus.lua | 4 | 2055 | --[[
Copyright © 2009 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-- Probe function.
function probe()
if vlc.access ~= "http" then
return false
end
koreus_site = string.match( vlc.path, "koreus" )
if not koreus_site then
return false
end
return ( string.match( vlc.path, "video" ) ) -- http://www.koreus.com/video/pouet.html
end
-- Parse function.
function parse()
while true do
line = vlc.readline()
if not line then break end
if string.match( line, "<meta name=\"title\"" ) then
_,_,name = string.find( line, "content=\"(.-)\"" )
name = vlc.strings.resolve_xml_special_chars( name )
end
if string.match( line, "<meta name=\"description\"" ) then
_,_,description = string.find( line, "content=\"(.-)\"" )
description = vlc.strings.resolve_xml_special_chars( description )
end
if string.match( line, "<meta name=\"author\"" ) then
_,_,artist = string.find( line, "content=\"(.-)\"" )
artist = vlc.strings.resolve_xml_special_chars( artist )
end
if string.match( line, "link rel=\"image_src\"" ) then
_,_,arturl = string.find( line, "href=\"(.-)\"" )
end
vid_url = string.match( line, '(http://embed%.koreus%.com/%d+/%d+/[%w-]*%.mp4)' )
if vid_url then
return { { path = vid_url; name = name; description = description; artist = artist; arturl = arturl } }
end
end
return {}
end
| gpl-2.0 |
iresty/gin | spec/core/response_spec.lua | 4 | 1063 | require 'spec.spec_helper'
-- gin
local Response = require 'gin.core.response'
describe("Response", function()
describe(".new", function()
describe("when no options are passed in", function()
it("initializes an instance with defaults", function()
local response = Response.new()
assert.are.same(200, response.status)
assert.are.same({}, response.headers)
assert.are.same({}, response.body)
end)
end)
describe("when options are passed in", function()
it("saves them to the instance", function()
local response = Response.new({
status = 403,
headers = { ["X-Custom"] = "custom" },
body = "The body."
})
assert.are.same(403, response.status)
assert.are.same({ ["X-Custom"] = "custom" }, response.headers)
assert.are.same("The body.", response.body)
end)
end)
end)
end) | mit |
xuejian1354/barrier_breaker | feeds/luci/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua | 69 | 2769 | --[[
Luci statistics - interface plugin diagram definition
(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
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
$Id$
]]--
module("luci.statistics.rrdtool.definitions.interface", package.seeall)
function rrdargs( graph, plugin, plugin_instance )
--
-- traffic diagram
--
local traffic = {
-- draw this diagram for each data instance
per_instance = true,
title = "%H: Transfer on %di",
vlabel = "Bytes/s",
-- diagram data description
data = {
-- defined sources for data types, if ommitted assume a single DS named "value" (optional)
sources = {
if_octets = { "tx", "rx" }
},
-- special options for single data lines
options = {
if_octets__tx = {
total = true, -- report total amount of bytes
color = "00ff00", -- tx is green
title = "Bytes (TX)"
},
if_octets__rx = {
flip = true, -- flip rx line
total = true, -- report total amount of bytes
color = "0000ff", -- rx is blue
title = "Bytes (RX)"
}
}
}
}
--
-- packet diagram
--
local packets = {
-- draw this diagram for each data instance
per_instance = true,
title = "%H: Packets on %di",
vlabel = "Packets/s",
-- diagram data description
data = {
-- data type order
types = { "if_packets", "if_errors" },
-- defined sources for data types
sources = {
if_packets = { "tx", "rx" },
if_errors = { "tx", "rx" }
},
-- special options for single data lines
options = {
-- processed packets (tx DS)
if_packets__tx = {
overlay = true, -- don't summarize
total = true, -- report total amount of bytes
color = "00ff00", -- processed tx is green
title = "Processed (tx)"
},
-- processed packets (rx DS)
if_packets__rx = {
overlay = true, -- don't summarize
flip = true, -- flip rx line
total = true, -- report total amount of bytes
color = "0000ff", -- processed rx is blue
title = "Processed (rx)"
},
-- packet errors (tx DS)
if_errors__tx = {
overlay = true, -- don't summarize
total = true, -- report total amount of packets
color = "ff5500", -- tx errors are orange
title = "Errors (tx)"
},
-- packet errors (rx DS)
if_errors__rx = {
overlay = true, -- don't summarize
flip = true, -- flip rx line
total = true, -- report total amount of packets
color = "ff0000", -- rx errors are red
title = "Errors (rx)"
}
}
}
}
return { traffic, packets }
end
| gpl-2.0 |
Schaka/gladdy | Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua | 4 | 16945 | --[[ $Id: AceGUIWidget-DropDown.lua 81438 2008-09-06 13:44:36Z nevcairiel $ ]]--
local min, max, floor = math.min, math.max, math.floor
local AceGUI = LibStub("AceGUI-3.0")
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
while child do
child:SetFrameLevel(parent:GetFrameLevel()+1)
fixlevels(child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
local function fixstrata(strata, parent, ...)
local i = 1
local child = select(i, ...)
parent:SetFrameStrata(strata)
while child do
fixstrata(strata, child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
do
local widgetType = "Dropdown-Pullout"
local widgetVersion = 2
--[[ Static data ]]--
local backdrop = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
edgeSize = 32,
tileSize = 32,
tile = true,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
}
local sliderBackdrop = {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
local defaultWidth = 200
local defaultMaxHeight = 600
--[[ UI Event Handlers ]]--
-- HACK: This should be no part of the pullout, but there
-- is no other 'clean' way to response to any item-OnEnter
-- Used to close Submenus when an other item is entered
local function OnEnter(item)
local self = item.pullout
for k, v in ipairs(self.items) do
if v.CloseMenu and v ~= item then
v:CloseMenu()
end
end
end
-- See the note in Constructor() for each scroll related function
local function OnMouseWheel(this, value)
this.obj:MoveScroll(value)
end
local function OnScrollValueChanged(this, value)
this.obj:SetScroll(value)
end
local function OnSizeChanged(this)
this.obj:FixScroll()
end
--[[ Exported methods ]]--
-- exported
local function SetScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset
if height > viewheight then
offset = 0
else
offset = floor((viewheight - height) / 1000 * value)
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", self.slider:IsShown() and -12 or 0, offset)
status.offset = offset
status.scrollvalue = value
end
-- exported
local function MoveScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
if height > viewheight then
self.slider:Hide()
else
self.slider:Show()
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.slider:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end
-- exported
local function FixScroll(self)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset = status.offset or 0
if viewheight < height then
self.slider:Hide()
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, offset)
self.slider:SetValue(0)
else
self.slider:Show()
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.slider:SetValue(value)
self:SetScroll(value)
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -12, offset)
status.offset = offset
end
end
end
-- exported, AceGUI callback
local function OnAcquire(self)
self.frame:SetParent(UIParent)
--self.itemFrame:SetToplevel(true)
end
-- exported, AceGUI callback
local function OnRelease(self)
self:Clear()
self.frame:ClearAllPoints()
self.frame:Hide()
end
-- exported
local function AddItem(self, item)
self.items[#self.items + 1] = item
local h = #self.items * 16
self.itemFrame:SetHeight(h)
self.frame:SetHeight(min(h + 34, self.maxHeight)) -- +34: 20 for scrollFrame placement (10 offset) and +14 for item placement
item.frame:SetPoint("LEFT", self.itemFrame, "LEFT")
item.frame:SetPoint("RIGHT", self.itemFrame, "RIGHT")
item:SetPullout(self)
item:SetOnEnter(OnEnter)
end
-- exported
local function Open(self, point, relFrame, relPoint, x, y)
local items = self.items
local frame = self.frame
local itemFrame = self.itemFrame
frame:SetPoint(point, relFrame, relPoint, x, y)
local height = 8
for i, item in pairs(items) do
if i == 1 then
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
item:Show()
height = height + 16
end
itemFrame:SetHeight(height)
fixstrata("TOOLTIP", frame, frame:GetChildren())
frame:Show()
self:Fire("OnOpen")
end
-- exported
local function Close(self)
self.frame:Hide()
self:Fire("OnClose")
end
-- exported
local function Clear(self)
local items = self.items
for i, item in pairs(items) do
AceGUI:Release(item)
items[i] = nil
end
end
-- exported
local function IterateItems(self)
return ipairs(self.items)
end
-- exported
local function SetHideOnLeave(self, val)
self.hideOnLeave = val
end
-- exported
local function SetMaxHeight(self, height)
self.maxHeight = height or defaultMaxHeight
if self.frame:GetHeight() > height then
self.frame:SetHeight(height)
elseif (self.itemFrame:GetHeight() + 34) < height then
self.frame:SetHeight(self.itemFrame:GetHeight() + 34) -- see :AddItem
end
end
-- exported
local function GetRightBorderWidth(self)
return 6 + (self.slider:IsShown() and 12 or 0)
end
-- exported
local function GetLeftBorderWidth(self)
return 6
end
--[[ Constructor ]]--
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent)
local self = {}
self.count = count
self.type = widgetType
self.frame = frame
frame.obj = self
self.OnAcquire = OnAcquire
self.OnRelease = OnRelease
self.AddItem = AddItem
self.Open = Open
self.Close = Close
self.Clear = Clear
self.IterateItems = IterateItems
self.SetHideOnLeave = SetHideOnLeave
self.SetScroll = SetScroll
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
self.SetMaxHeight = SetMaxHeight
self.GetRightBorderWidth = GetRightBorderWidth
self.GetLeftBorderWidth = GetLeftBorderWidth
self.items = {}
self.scrollStatus = {
scrollvalue = 0,
}
self.maxHeight = defaultMaxHeight
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(0, 0, 0)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetClampedToScreen(true)
frame:SetWidth(defaultWidth)
frame:SetHeight(self.maxHeight)
--frame:SetToplevel(true)
-- NOTE: The whole scroll frame code is copied from the AceGUI-3.0 widget ScrollFrame
local scrollFrame = CreateFrame("ScrollFrame", nil, frame)
local itemFrame = CreateFrame("Frame", nil, scrollFrame)
self.scrollFrame = scrollFrame
self.itemFrame = itemFrame
scrollFrame.obj = self
itemFrame.obj = self
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame)
slider:SetOrientation("VERTICAL")
slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(sliderBackdrop)
slider:SetWidth(8)
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Vertical")
slider:SetFrameStrata("FULLSCREEN_DIALOG")
self.slider = slider
slider.obj = self
scrollFrame:SetScrollChild(itemFrame)
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -12)
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 12)
scrollFrame:EnableMouseWheel(true)
scrollFrame:SetScript("OnMouseWheel", OnMouseWheel)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:SetToplevel(true)
scrollFrame:SetFrameStrata("FULLSCREEN_DIALOG")
itemFrame:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
itemFrame:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -12, 0)
itemFrame:SetHeight(400)
itemFrame:SetToplevel(true)
itemFrame:SetFrameStrata("FULLSCREEN_DIALOG")
slider:SetPoint("TOPLEFT", scrollFrame, "TOPRIGHT", -16, 0)
slider:SetPoint("BOTTOMLEFT", scrollFrame, "BOTTOMRIGHT", -16, 0)
slider:SetScript("OnValueChanged", OnScrollValueChanged)
slider:SetMinMaxValues(0, 1000)
slider:SetValueStep(1)
slider:SetValue(0)
scrollFrame:Show()
itemFrame:Show()
slider:Hide()
self:FixScroll()
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
do
local widgetType = "Dropdown"
local widgetVersion = 18
--[[ Static data ]]--
--[[ UI event handler ]]--
local function Control_OnEnter(this)
this.obj:Fire("OnEnter")
end
local function Control_OnLeave(this)
this.obj:Fire("OnLeave")
end
local function Dropdown_OnHide(this)
local self = this.obj
if self.open then
self.pullout:Close()
end
end
local function Dropdown_TogglePullout(this)
local self = this.obj
if self.open then
self.open = nil
self.pullout:Close()
AceGUI:ClearFocus()
else
self.open = true
self.pullout:SetWidth(self.frame:GetWidth())
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
AceGUI:SetFocus(self)
end
end
local function OnPulloutOpen(this)
local self = this.userdata.obj
local value = self.value
if not self.multiselect then
for i, item in this:IterateItems() do
item:SetValue(item.userdata.value == value)
end
end
self.open = true
end
local function OnPulloutClose(this)
local self = this.userdata.obj
self.open = nil
self:Fire("OnClosed")
end
local function ShowMultiText(self)
local text
for i, widget in self.pullout:IterateItems() do
if widget.type == "Dropdown-Item-Toggle" then
if widget:GetValue() then
if text then
text = text..", "..widget:GetText()
else
text = widget:GetText()
end
end
end
end
self:SetText(text)
end
local function OnItemValueChanged(this, event, checked)
local self = this.userdata.obj
if self.multiselect then
self:Fire("OnValueChanged", this.userdata.value, checked)
ShowMultiText(self)
else
if checked then
self:SetValue(this.userdata.value)
self:Fire("OnValueChanged", this.userdata.value)
else
this:SetValue(true)
end
if self.open then
self.pullout:Close()
end
end
end
--[[ Exported methods ]]--
-- exported, AceGUI callback
local function OnAcquire(self)
local pullout = AceGUI:Create("Dropdown-Pullout")
self.pullout = pullout
pullout.userdata.obj = self
pullout:SetCallback("OnClose", OnPulloutClose)
pullout:SetCallback("OnOpen", OnPulloutOpen)
self.pullout.frame:SetFrameLevel(self.frame:GetFrameLevel() + 1)
fixlevels(self.pullout.frame, self.pullout.frame:GetChildren())
end
-- exported, AceGUI callback
local function OnRelease(self)
if self.open then
self.pullout:Close()
end
AceGUI:Release(self.pullout)
self:SetText("")
self:SetLabel("")
self:SetDisabled(false)
self:SetMultiselect(false)
self.value = nil
self.list = nil
self.open = nil
self.hasClose = nil
self.frame:ClearAllPoints()
self.frame:Hide()
end
-- exported
local function SetDisabled(self, disabled)
self.disabled = disabled
if disabled then
self.text:SetTextColor(0.5,0.5,0.5)
self.button:Disable()
self.label:SetTextColor(0.5,0.5,0.5)
else
self.button:Enable()
self.label:SetTextColor(1,.82,0)
self.text:SetTextColor(1,1,1)
end
end
-- exported
local function ClearFocus(self)
if self.open then
self.pullout:Close()
end
end
-- exported
local function SetText(self, text)
self.text:SetText(text or "")
end
-- exported
local function SetLabel(self, text)
if text and text ~= "" then
self.label:SetText(text)
self.label:Show()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-18)
self.frame:SetHeight(44)
else
self.label:SetText("")
self.label:Hide()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,0)
self.frame:SetHeight(26)
end
end
-- exported
local function SetValue(self, value)
if self.list then
self:SetText(self.list[value] or "")
end
self.value = value
end
-- exported
local function SetItemValue(self, item, value)
if not self.multiselect then return end
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
if widget.SetValue then
widget:SetValue(value)
end
end
end
ShowMultiText(self)
end
-- exported
local function SetItemDisabled(self, item, disabled)
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
widget:SetDisabled(disabled)
end
end
end
local function AddListItem(self, value, text)
local item = AceGUI:Create("Dropdown-Item-Toggle")
item:SetText(text)
item.userdata.obj = self
item.userdata.value = value
item:SetCallback("OnValueChanged", OnItemValueChanged)
self.pullout:AddItem(item)
end
local function AddCloseButton(self)
if not self.hasClose then
local close = AceGUI:Create("Dropdown-Item-Execute")
close:SetText(CLOSE)
self.pullout:AddItem(close)
self.hasClose = true
end
end
-- exported
local sortlist = {}
local function SetList(self, list)
self.list = list
self.pullout:Clear()
self.hasClose = nil
if not list then return end
for v in pairs(list) do
sortlist[#sortlist + 1] = v
end
table.sort(sortlist)
for i, value in pairs(sortlist) do
AddListItem(self, value, list[value])
sortlist[i] = nil
end
if self.multiselect then
ShowMultiText(self)
AddCloseButton(self)
end
end
-- exported
local function AddItem(self, value, text)
if self.list then
self.list[value] = text
AddListItem(self, value, text)
end
end
-- exported
local function SetMultiselect(self, multi)
self.multiselect = multi
if multi then
ShowMultiText(self)
AddCloseButton(self)
end
end
-- exported
local function GetMultiselect(self)
return self.multiselect
end
--[[ Constructor ]]--
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", nil, UIParent)
local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate")
local self = {}
self.type = widgetType
self.frame = frame
self.dropdown = dropdown
self.count = count
frame.obj = self
dropdown.obj = self
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.ClearFocus = ClearFocus
self.SetText = SetText
self.SetValue = SetValue
self.SetList = SetList
self.SetLabel = SetLabel
self.SetDisabled = SetDisabled
self.AddItem = AddItem
self.SetMultiselect = SetMultiselect
self.GetMultiselect = GetMultiselect
self.SetItemValue = SetItemValue
self.SetItemDisabled = SetItemDisabled
self.alignoffset = 31
frame:SetHeight(44)
frame:SetWidth(200)
frame:SetScript("OnHide",Dropdown_OnHide)
dropdown:ClearAllPoints()
dropdown:SetPoint("TOPLEFT",frame,"TOPLEFT",-15,0)
dropdown:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",17,0)
dropdown:SetScript("OnHide", nil)
local left = _G[dropdown:GetName() .. "Left"]
local middle = _G[dropdown:GetName() .. "Middle"]
local right = _G[dropdown:GetName() .. "Right"]
middle:ClearAllPoints()
right:ClearAllPoints()
middle:SetPoint("LEFT", left, "RIGHT", 0, 0)
middle:SetPoint("RIGHT", right, "LEFT", 0, 0)
right:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", 0, 17)
local button = _G[dropdown:GetName() .. "Button"]
self.button = button
button.obj = self
button:SetScript("OnEnter",Control_OnEnter)
button:SetScript("OnLeave",Control_OnLeave)
button:SetScript("OnClick",Dropdown_TogglePullout)
local text = _G[dropdown:GetName() .. "Text"]
self.text = text
text.obj = self
text:ClearAllPoints()
text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2)
text:SetPoint("LEFT", left, "LEFT", 25, 2)
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
label:SetJustifyH("LEFT")
label:SetHeight(18)
label:Hide()
self.label = label
AceGUI:RegisterAsWidget(self)
return self
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
| mit |
D3vMa3sTrO/superbot | plugins/replay.lua | 2 | 40096 | --[[
_ _ _ _____ _____ ____ ____
/ \ / \ / \ | ____|___|_ _| /_\ \ / __ \ Đєⱴ 💀: @MaEsTrO_0
/ / \/ / \ / _ \ | _| / __| | | | |_\_/| | | | Đєⱴ 💀: @devmaestr0
/ / \ \/ \ \ / ___ \| |___\__ \ | | | | \ \| |__| | Đєⱴ ฿๏ͳ💀: @iqMaestroBot
/_/ \/ \_/_/ \_|_____|___/ |_| |_| \_\\____/ Đєⱴ ฿๏ͳ💀: @maestr0bot
Đєⱴ Ϲḫ₳ͷͷєℓ💀: @DevMaestro
—]]
do
ws = {}
rs = {}
-- some examples of how to use this :3
ws[1] = "هلو" -- msg
rs[1] = "هلاوووات عيني نورتـ/ي😻🙈 " -- reply
ws[2] = "😒" -- msg
rs[2] = "عابت هالخلقـة وبِلَت😒وج الطاوة🌚" -- reply
ws[3] = "شلونكم" -- msg
rs[3] = "اني تعبان☹️الأدمنيـة تعبوني😞🔫" -- reply
ws[4] = "دنجب" -- msg
rs[4] = "🌚چبابـة تچبـكـ/چ" -- reply
ws[5] = "حجي" -- msg
rs[5] ="يـَعيون الحجي گولـ/ي😻🙊" -- replyrs[] ="يـَعيون الحجي گولـ/ي😻🙊" -- reply
ws[6] = "ضوجة" -- msg
rs[6] = "شي أكيد الكبل ماكو😉😄لو بعدكـ/چ ما زاحفـ/ـة😹🔪" -- reply
ws[7] = "مرحبا" -- msg
rs[7] = "مـراحـب😻يـمه هله😻" -- reply
ws[8] = "السلام عليكم" -- msg
rs[8] = "وعلـيكُم السلامُ والرحمـة😍" -- reply
ws[9] = "مساء الخير" -- msg
rs[9] = "مسـاء الخيرات يـا وجـه الخير😽" -- reply
ws[10] = "صباح الخير" -- msg
rs[10] = "صبـاح الخيرات عُمري😻😽" -- reply
ws[11] = "تصبحون على خير" -- msg
rs[11] = " وانتـ/ي مـن اهـلو حيـاتي💋 " -- reply
ws[12] = "اكرهك" -- msg
rs[12] = "طبكـ/چ مـرض🌚🔪" -- reply
ws[13] = "احبك" -- msg
rs[13] = "وانـه امووت عليكـ/يرووحي😻💋" -- reply
ws[14] = "بوتي" -- msg
rs[14] = "هـا يروووح بوتك اامرني🙈❤️" -- reply
ws[15] = "وجع" -- msg
rs[15] = "اليـوجع ضلـوعكـ/چ🌝😷" -- reply
ws[16] = "باي" -- msg
rs[16] = "بـايات عُمري😚سد/ي الباب وراكـ/چ☺️😻" -- reply
ws[17] = "نوشة" -- msg
rs[17] = "هـاي الـگلُب مالتي🙊😻💋" -- reply
ws[18] = "اريد بوت" -- msg
rs[18] = "راسل المطورين @iqMaestroBot 💋" --reply
ws[19] = "علاوي" --msg
rs[19] = "يومـه يومـه😻العقل المُدَبِر فديتو💋" -- reply
ws[20] = "الحجي" -- msg
rs[20] = "بووويـاي😻ابو الكـلفات بعد شيبـي😻💋" -- reply
ws[21] = "حنين" -- msg
rs[21] = "خـوش ضلعـة😻بس من كَبَلَت خُربَت☹️" -- reply
ws[22] = "وسام" -- msg
rs[22] = "هذا الفَخـر والذُخُر😻💋فديت ربـه💋" -- reply
ws[23] = "حسوني" -- msg
rs[23] = "فد واحـد دُرةَ😻بس يضحكـ هوايـة😹🍃" -- reply
ws[24] = "كناري" -- msg
rs[24] = " واحـد ملَگلگ🌞💯بس احبـه😻💋" -- reply
ws[25] = "حجوج" -- msg
rs[25] = "هـذا الحقيـر🙄اخذ نص گلـبي وسحـرني بحبـه" -- reply
ws[26] = "بوسني" -- msg
rs[26] = "مممممح💋😻" -- reply
ws[27] = "شخباركم" -- msg
rs[27] = "يعمُـر داركـم☺️عايشـين😁وانتـ/ي؟🤔" -- reply
ws[28] = "ضوجه" -- msg
rs[28] = "تعال/ـي سويلي 😒بلكي تروح الضوجه" -- reply
ws[29] = "هاي" -- msg
rs[29] = "وعليكم الهااااي ورحمة الله😘" -- reply
ws[30] = "احم" -- msg
rs[30] = "اسـم الله😧اشربـ/ي دوة😓" -- reply
ws[31] = "ابوك شلونه" -- msg
rs[31] = "الحمد لله زين بس طايح حظة 🙄😅"
ws[32] = "سلام عليكم" -- msg
rs[32] = "وعليكـم السلام والرحمـة😻" -- reply
ws[33] = "هلوو" -- msg
rs[33] = "هلاوات كـبد عمري😍😚" -- reply
ws[34] = "خاص" -- msg
rs[34] = "بـاع الزحـف😈بلشت رحمة الله" -- reply
ws[35] = "شباب" -- msg
rs[35] = "هـا مولااااي😇" -- reply
ws[36] = "زاحف" -- msg
rs[36] = "تـعلم منكـ/چ😈" -- reply
ws[37] = "اجكم" -- msg
rs[37] = "مظغوط/ـة من جمالي فوديتني 🌚" --reply
ws[38] = "ولي" -- msg
rs[38] = "صدگ ماعندكـ/چ ذوق😒" -- reply
ws[39] = "😏" -- msg
rs[39] = "عـود شوفـوني انـه شخصيـة🌝كبر" -- reply
ws[40] = "وينك" -- msg
rs[40] = "موجـود حبي😶" -- reply
ws[41] = "شبيك" -- msg
rs[41] = "احب وحدة تخـبل بـس ثـولـة😓😿" -- reply
ws[42] = "محمد" -- msg
rs[42] = "صلى الله عليـه وسلـم😍🍃" -- reply
ws[43] = "😒😒" -- msg
rs[43] = "عابـت هالشـكول وبلت😒" -- reply
ws[44] = "😂" -- msg
rs[44] = "دوووم😁" -- reply
ws[45] = "😂😂" -- msg
rs[45] = "دوووووم" -- reply
ws[46] = "فديت" -- msg
rs[46] = "لا فديت ولا تضل تزحف بطلهن واثكل شوية😍😂" -- reply
ws[47] = "هونر" -- msg
rs[47] = "فد واحد وردة مـال الله😻بس يضحـك هوايـة😂" -- reply
ws[48] = "شلونك" -- msg
rs[48] = "اني زيـن الحمـد لله وانتـ/ي؟😽" -- reply
ws[49] = "اكو احد" -- msg
rs[49] = "يي عيني انـي موجـود😁" -- reply
ws[50] = "نايمين" -- msg
rs[50] = "خما نايمين بهول الحجي خليهم ماكو احسن من هذا الفندق😐🍃" -- reply
ws[51] = "كمال" -- msg
rs[51] = "يعني سنايـدي😎" -- reply
ws[52] = "كيمو" -- msg
rs[52] = "فديت ربـه شگد احبـه😍" -- reply
ws[53] = "🌚" -- msg
rs[53] = "نورتـ/ي صخـام الجـدر🌝😂" -- reply
ws[54] = "تف" -- msg
rs[54] = "تف بوجهـكـ/چ🌚" -- reply
ws[55] = "تحبني" -- msg
rs[55] = "يااااا😱غير اعشقكـ/چ😢" -- reply
ws[56] = "نجب" -- msg
rs[56] = "ياعديمـ/ـة الذوق😑" -- reply
ws[57] = "تخليني" -- msg
rs[57] = "باوعـوا مدَود/ة☝😂" -- reply
ws[58] = "تفو" -- msg
rs[58] = " بخلقتكـ/ـچ الزفـرة🙌" -- reply
ws[58] = "اموت عليك" -- msg
rs[58] = "مي توو گلبي💋" -- reply
ws[59] = "كافي لغوة" -- msg
rs[59] = "ماگـدر والله بيـة دودة😷" -- reply
ws[60] = "🌚🌝" -- msg
rs[60] = "بيكـ/چ انفصام باشخصـيـة بابا!!" -- reply
ws[61] = "🌝🌚" -- msg
rs[61] = "هـذا انفصـام بالشخصيـة مستفحل🐸😷" -- reply
ws[62] = "🌚🌚" -- msg
rs[62] = "نرجع ونگول :منور/ة صخـام الجـدر🌝😂" -- reply
ws[63] = "ليش" -- msg
rs[63] = "تاكل خره الجيييش 🍃😽" -- reply
ws[64] = "اسكت" -- msg
rs[64] = "ليـش بالله😐داحچي من حلگكـ/چ مثلاً😑" -- reply
ws[65] = "خطية" -- msg
rs[65] = "يييييييييييييييييي😓" -- reply
ws[66] = "زوزايه" -- msg
rs[66] = " هاي حبيبـة حسوني😻🙊ومعشـوقته 🙊هو گالي والله☝️😁مممممممح 💋💋💋" -- reply
ws[67] = "وين" -- msg
rs[67] = "بأرض الله الواسعـة🙄" -- reply
ws[68] = "شكو" -- msg
rs[68] = "كلشي وكلاشي🐸تگـول عبالك احنـة بالشورجـة🌝" -- reply
ws[69] = "وين؟" -- msg
rs[69] = "للبحـرين🙄🤓" -- reply
ws[70] = "شونكم" -- msg
rs[70] = "تمـام بُحي🐸وانتـ/ي؟" -- reply
ws[71] = "شونك" -- msg
rs[71] = "تمـام الحمد لله😚وانتـ/ي؟" -- reply
ws[72] = "اوف" -- msg
rs[72] = "سلامتـكـ/چ من الأووف يـا بعد افادي☹️💔" -- reply
ws[73] = "احبج" -- msg
rs[73] = "واليحب بلوة🙄وين الله وزحفتي تجيبلي عيونچ الحلـوة🙄🤓" -- reply
ws[74] = "دنجب" -- msg
rs[74] = "چـبابـة تچبكـ/چ😇" -- reply
ws[75] = "انجب لك" -- msg
rs[75] = "اول شي لكلاكـة تلكلك ضلوعكـ/چ🐸وثاني شي چبابـة تچبكـ/چ☹️👌🏼" -- reply
ws[76] = "زاحف على اختك" -- msg
rs[76] = "أختكـ/چ اختي🐸😇" -- reply
ws[77] = "زاحف ع اختك" -- msg
rs[77] = "أختكـ/چ أختي🐸😇" -- reply
ws[78] = "😢" -- msg
rs[78] = "ياااا😱گامـ/ت تـ/يبچي خطيـة منو أخذ چبس منهـ/هـة😐" -- reply
ws[79] = "☹️" -- msg
rs[79] = "هل تعلمـ/ين أن حلگكـ/چ مثل حلگ الجريـة😶🙌🏾" -- reply
ws[80] = "😍" -- msg
rs[80] = "صَعَد الحُـب وابتدا الزحف 🙄❣" -- reply
ws[81] = "😘" -- msg
rs[81] = "عيب البـوس هنـا تعالـ/ي خاص😍😬" -- reply
ws[82] = "😪" -- msg
rs[82] = "امسحـ/ي مخاطينكـ/چ بابا خزيتونـة😾🙌🏾" -- reply
ws[83] = "🙄" -- msg
rs[83] = "ورجعنـا ع التلصلص🙄" -- reply
ws[84] = "انته منو" -- msg
rs[84] = "آني كامـل مفيد أكبر زنگين اگعدة عالحديد😼🙌🏾" -- reply
ws[85] = "انتة منو" -- msg
rs[85] = "آني كـامل مفيد اكبر زنگين أگعدة عالحديـد😼🙌🏾" -- reply
ws[86] = "كافي" -- msg
rs[86] = "كافي وگيمـر عرب🤓🐸" -- reply
ws[87] = "💔🌝" -- msg
rs[87] = "صارت قديمـة🐸" -- reply
ws[88] = "🌝💔" -- msg
rs[88] = "صارت قديمـة هاي🐸🙌🏾" -- reply
ws[89] = "تمام" -- msg
rs[89] = "دوووم" -- reply
ws[90] = "بخير" -- msg
rs[90] = "عساكـ/چ دووم😋" -- reply
ws[91] = "تسلم" -- msg
rs[91] = "ولـو😚" -- reply
ws[92] = "يسلمو" -- msg
rs[92] = "يدللـو😋" -- reply
ws[93] = "يسلموو" -- msg
rs[93] = "يدندل الحلـو😋🙌🏾" -- reply
ws[94] = "شكرا" -- msg
rs[94] = "عفواً😇" -- reply
ws[95] = "شكراً" -- msg
rs[95] = "عفواً😇" -- reply
ws[96] = "شكرن" -- msg
rs[96] = "عفواً😇" -- reply
ws[97] = "هذا منو" -- msg
rs[97] = "هذا اللمبي هع هع 🙄🙌🏾" -- reply
ws[98] = "هاي منو" -- msg
rs[98] = "عدويـة البياتي🙄💔" -- reply
ws[99] = "انته شبيك" -- msg
rs[99] = "معجب بيك/ـج🙄🙌🏾" -- reply
ws[100] = "فدوة" -- msg
rs[100] = "لخشمكـ/چ الأفنـص❣🙊" -- reply
ws[101] = "فديتك" -- msg
rs[101] = "فداكـ/چ الي ابالي😉" -- reply
ws[102] = "منو ابالك" -- msg
rs[102] = "بطل العرگ 🌝😢" -- reply
ws[103] = "منو بالك" -- msg
rs[103] = "عباس أبـو الغاز🐸🙌🏾" -- reply
ws[104] = "حرام" -- msg
rs[104] = "صار شيخنـا بعد ماعيدهـة اكلك صدك وين عمامتك؟؟🙄🙌🏾" -- reply
ws[105] = "استغفر الله" -- msg
rs[105] = "بركاتكـ/چ مولاي😈" -- reply
ws[106] = "استغفرالله" -- msg
rs[106] = "بركاتكـ/چ مولاي" -- reply
ws[107] = "🌝" -- msg
rs[107] = "خطيـة بيهـ/ـة ابو صفار🙄ديروبالكم من العدوى" -- reply
ws[108] = "راح اكفر" -- msg
rs[108] = "اشگ حلگكـ/چ اذا سويهـة😒🐸" -- reply
ws[109] = "شونج" -- msg
rs[109] = "زينـة وعايشـة وبخير🙄ارتاحيتـ/ي؟ يلا كافي زحـف ع الكبد ماتي🐸😒" -- reply
ws[110] = "فديتج" -- msg
rs[110] = "شنو هاللواگـة هاي🐸بابا عيب منا العالم🌝" -- reply
ws[111] = "اعشقك" -- msg
rs[111] = "يومـه اروحن فدوة 😻❤️" -- reply
ws[112] = "حبك" -- msg
rs[112] = "أفيش ربي 😍واني اكثر💋" -- reply
ws[113] = "عشقك" -- msg
rs[113] = "اتنفسكـ/چ واختنگ بيكـ/چ😍😂" -- reply
ws[114] = "موت عليك" -- msg
rs[114] = "اموت بيكـ/چ😍❤️" -- reply
ws[115] = "😍😍" -- msg
rs[115] = "فدوة اروحـن والله لهالعيـون😍" -- reply
ws[116] = "😁" -- msg
rs[116] = "عابت هالسنون الحلوات چنهن دگم😂" -- reply
ws[117] = "😂😂😂" -- msg
rs[117] = "دوووووم يبعد الگلب😍" -- reply
ws[118] = "عفية" -- msg
rs[118] = "الله يعافيكـ/چ🙂😇" -- reply
ws[119] = "بوت ملطلط" -- msg
rs[119] = "فوگ الحگة دگة😒والله يا الله فوگ ما اضحكهم يحچون عليـة🌝🙌🏾ربي صبرني😔" -- reply
ws[120] = "امداك" -- msg
rs[120] = "أتجاوزكـ/چ بسرعتي أمري لله🌝🙌🏾" -- reply
ws[121] = "😔" -- msg
rs[121] = "اوووي كسرتـ/ي قلبي الزعطـوط☹️💔" -- reply
ws[122] = "🤔" -- msg
rs[122] = "بدأت الأفكـار🙄والنتيجـة خريييط كالعادة🙂😂" -- reply
ws[123] = "زينب" -- msg
rs[123] = "الكبل مال حسوني🙄صاكة تمووت🙄عبالي اكبل وياهة بس حسوني مخبل اخاف يسويلي شي😭" -- reply
ws[124] = "زوزه" -- msg
rs[124] = "صاگـة تموووت😻عسل لگروب😻❤️ومحبوبة الگلوب😎🌹" -- reply
ws[125] = "ابو الويس" -- msg
rs[125] = "اخلاق✋🏾ذووق✋🏾انحراف🙄من جوة لجوة🙄اصلي يخبل🙂❤️" -- reply
ws[126] = "حمايد" -- msg
rs[126] = "هيبـة الشيخ😎بس خطيـة نفسيتـة مجعوصـة😞شيخ اني انصحک روح اسكر☹️✋🏾🍷" -- reply
ws[127] = "امك شلونهه" -- msg
rs[127] = "مو لبارحة جانت يم امك🌚نو هاللواكة😐🐸" -- reply
ws[128] = "نموري"
rs[128] = "عيون نموري كول حياتي 😍🙈"
ws[129] = "شوشة" -- msg
rs[129] = " هاي حبيبـة مطوري😻🙊ومعشـوقته 🙊هو گالي والله☝️😁مممممممح 💋💋💋" --
ws[130] = "بوت"
rs[130] = "وجعة ابوي حتى وجعة ابوي😠 \n يكفر واحد ينخمدلة ساعة بهل كروب \n 😤كول بلا دشوف سالفتك \n بيهة حظ لو مثل وجهك🙌"
ws[131] = "البوت"
rs[131] = "كول شتريد/ين مني 😒🍷 عندي شغل 🏌"
ws[132] = "مطور"
rs[132] = "مطور السورس @iqMaestroBot💋😻 "
ws[133] = "@MaEsTrO_0"
rs[133] = "فديت ربه 🙊 هذا مطور السورس 😻❤️"
ws[134] ="اريد قناة"
rs[134] =" @DevMaestro😌"
ws[135] = "اكلج"
rs[135] = "تاحسك تريد تبدي تسحف ☹️"
ws[136] = "اكولج"
rs[136] = "تاحسك تريد تبدي تسحف ☹️"
ws[137] = "حسين"
rs[137] = "تحون فدوة لـ؏ـيــ❦ـونة لحبيبي 😘 حسوني 😻❤️ تاج راســك وحامـ❦ـي اعراضـك 🐸🖕🏿"
ws[138] = "😂😂😂😂"
rs[138] = "شوف الناس وين وصلت ونته تضحك كبر يلخبل 🌚😹"
ws[139] = "نيجه"
rs[139] = "ميسوه اجب عليه 🐸😹🖕🏿"
ws[140] = "اغتصبه"
rs[140] = "حرامات اخرب مستقبلي بي 🐸🌝🖕🏿"
ws[141] = "طيز"
rs[141] = "ااوف ابلس 😻🖕🏿"
ws[142] = "🤔🤔"
rs[142] = "على كيفك انشتاين 😹🤘🏿"
ws[143] = "🤐"
rs[143] = "عفيه لو هيج تخيط حلكك لو لا 😹😹"
ws[144] = "😛"
rs[144] = "هذا مطلع لسانه كيوت 😹"
ws[145] = "😜"
rs[145] = "ضم لسانك 😁 فضحتنه"
ws[146] = "😚"
rs[146] = "عساس مستحي/ة بعد بست 😹"
ws[147] = "😘"
rs[147] = "ممنوع التقبيل في هذا الكروب 😹 هسه \nيزعلون الحدايق"
ws[148] = "☺️"
rs[148] = "خجلان الحلو/ة 😂 منو تحارش بيك/ج غيري 😌"
ws[149] = "🙂"
rs[149] = "ابتسامه مال واحد مكتول كتله غسل ولبس 😍😹"
ws[150] = "😊"
rs[150] = "انها احقر ابتسامه على وجه الكره الارضيه 😹"
ws[151] = "😇"
rs[151] = "بس لا تحس/ـين نفسك/ـج ملاك ترة سوالفك/ـج مال شيخ سمعوو"
ws[152] = "😅"
rs[152] = "شبيك جنك واحد دايضربو ابره 😂"
ws[153] = "😃"
rs[153] = "فرحان/ه دووووم الفرحه ☺️😍"
ws[154] = "😹😹"
ws[154] = "دوم الضحكات عيوني 😍"
ws[155] = "😬"
rs[155] = "ضم سنونك/ج فضحتنه 🙀😹"
ws[156] = "😀"
rs[156] = "عيوووون مال كوري 😹😹"
ws[157] = "ضلعتي"
rs[157] = "هلا هلا اجن الضلوعات 😍😹"
ws[158] = "جاو"
rs[158] = "بعد وكت خليك مضوجنا 😹❤️"
ws[159] = "بوسه جبيره"
rs[159]= "امــــ💋💋ــــمـــ💋💋ــــمــــــ💋💋ــــمــــــــــــــــ💋💋ــــمــؤوووووواح 😹\n بهاي البوسه انسف وجهك/ج 😹😹"
ws[160] = "تعشقني"
rs[160] = "😌☝🏿️اعشقكج لدرجه اذا خلوج بين 10 وردات اطلعج واني مغمض لان بس انتي الشوكه 😹\n #طــــن_تم_القصف"
ws[161] = "ممكن"
rs[161] = "كضوووو راح يزحف 🙀😹"
ws[162] = "عركة"
rs[162] = "🙀يا الهي \n عركه اجيب 🏃🏻 السجاجين 🔪والمسدسات 🔫"
ws[163] = "عركه"
rs[163] = "🙀يا الهي \n فل ترحمناا الالهة 🏃🏻 🔪 🔫"
ws[164] = "مساء الخير"
rs[164] = "مساء الخيرات اشرقت وانورت 😌🍁"
ws[165] = "صباحوو"
rs[165] = "صباحووو اشرقت وانورت 😌🍁"
ws[166] = "صباحو"
rs[166] = "صباحو اشرقت وانورت 😌🍁"
ws[167] = "صباح الخير"
rs[167] = "يا صباح العافية اشرقت وانورت 😌🍁"
ws[168] = "منو بيتهوفن"
rs[168] = "😹😹😹 شوف ياربي يطلب من الحافي نعال"
ws[169] = "موسيقى"
rs[169] = "😒☝🏿️اكعد راحه بيتهوفن 😹 \n #اذا_ماتعرف_منو_بيتهوفن \n #اكتب منو بيتهوفن"
ws[170] = "موال"
rs[170] = "🙁☝🏿️شكولي مال تحشيش ماخربها بلموال 😹❤️"
ws[171] = "ردح حزين"
rs[171] = "😹😹 مشت عليكم وين اكو ردح حزين عود هاي انته الجبير 🤑😹"
ws[172] = "ردح"
rs[172] = "😹😹😹تره رمضان قريب صلي صوم احسلك"
ws[173] = "حزين"
rs[173] = "اكو هواي مجروحين 😔 خاف غني وذكرهم"
ws[174] = "راب"
rs[174] = "شكولك مال ثريد لاتخربها بلراب 😹❤️"
ws[175] = "شسمها"
rs[175] = "لو اعرف اسمها جان مابقيت يمك/ج 😹"
ws[176] = "شسمه"
rs[176] = "لو اعرف اسمه جان مابقيت يمك/ج 😹"
ws[177] = "شسمج"
rs[177] = "اسمها جعجوعه ام اللبن😜😜"
ws[178] = "شسمك"
rs[178] = "تاج راسك المايسترووو 😘❤️"
ws[179] = "شوف"
rs[179] = "👀ششوف 👀"
ws[180]= "اسمعي"
rs[180] = "كوووووؤ👂🏿🌝👂🏿ؤؤؤؤؤل/ي سامعك/ج"
ws[181] = "اسمع"
rs[181] = "كوووووؤ👂🏿🌝👂🏿ؤؤؤؤؤل/ي سامعك/ج"
ws[182] = "خالتك"
rs[182] = "هَـ (⊙﹏⊙) ــاآك😝افلوس💵جيبلي خالتك😂"
ws[183] = "مودي"
rs[183] = "ۿہ✯ہذآإ✟😘❥الבـ﴿❤️﴾ـلـٰ୭وٰ୭❥😍مالي فديته😂"
ws[184] = "منو هاي"
rs[184] = "هَـ (⊙﹏⊙) ــاآي😝الراقصه مال الكروب💃😂"
ws[185] = "حاتة"
rs[185] = "وينها خلي نرقمها 😍😹"
ws[186] = "صاكة"
rs[186] = "وينها خلي اكفش شعرها 😹😍"
ws[187] = "بيباي"
rs[187] = "وين بعد وكت 🙊❤️"
ws[188] = "اشاقة"
rs[188] = "😹😍 استمر هوه غير شقاك/ج الثكيل يخبل"
ws[189] = "اشاقه"
rs[189] = "😹😍 استمر/ـي هوه غير شقاك/ج الثكيل يخبل"
ws[190] = "احبنك"
rs[190] = "😌❤️ طبعا وتموت/ين عليه هم وغصبا عليك/ـج"
ws[191] = "عشق"
rs[191] = "يمه اذوبــن 😌❤️"
ws[192] = "مرتي"
rs[192] = "يعني عفت النسوان كلها جيت على مرتي 😡"
ws[193] = "تريد مكياج"
rs[193] = "هيج انتي جكمه 😹😍 تردين مكياج \n يوجد ☟تٌَحَـتْ☟ المكياج الخادع \n (͡° ͜ʖ ͡°) اما قمر ساطع \n او نوع من انواع الضفادع 😂🐸"
ws[194] = "بالة"
rs[194] = "😹☝🏿️ موحلوات عليك هم ماشتريلك"
ws[195] = "باله"
rs[195] = "😹☝🏿️ موحلوات عليك هم ماشتريلك"
ws[196] = "مول"
rs[196] = "😹☝🏿️يريد يقطني ماشتريلك لوتموت"
ws[197] = "ملابس"
rs[197] = "🌚☝🏿️ تريدهن من المول لو من باله ؟"
ws[198] = "سيارة"
rs[198] = "😹☝🏿️ تريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[199] = "سياره"
rs[199] = "😹☝🏿️ ت ريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[200] = "سياره"
rs[200] = "😹☝🏿️ ت ريد/ين سياره هوه انته/ي بايسكل كل مترين تضرب دقله 😹"
ws[201] = "شيك"
rs[201] = "هوه اني لو عندي شيك اصير بوت 😹 الله وكيلك نص ملفاتي بلدين 😹😹"
ws[202] = "كاش"
rs[202] = "هوه اني لو عندي كاش اصير بوت 😹 الله وكيلك نص ملفاتي بلدين 😹😹"
ws[203] = "فلوس"
rs[203] = "كبدي شتريد/ين فلوسك/ج كاش لو شيك 🤔 ؟"
ws[204] = "وردة"
rs[204] = "🙈الي يرميني بورده ارمي بورده هيه والمزهريه #ياخي_الكرم_واجب 😹"
ws[205] = "اهووو"
rs[205] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[206] = "اهوو"
rs[206] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[207] = "اهو"
rs[207] = "😹 ليش ولك/ج خطيه هذا/ه 😿 لاتكول اهوو"
ws[208] = "انجبي"
rs[208] = "☹️☝️ 🏿 هــاااااي عليها مو"
ws[209] = "زبالة"
rs[209] = "لاتغلط 😤🔫 لو الا ازرف بيتكم"
ws[210] = "زباله"
rs[210] = "لاتغلط 😤🔫 لو الا ازرف بيتكم"
ws[211] = "زاحفة"
rs[211] = "ماخرب الشباب الطيبه غيرجن 😹 متكليلي شنووو علاججن"
ws[212] = "زاحفه"
rs[212] = "ماخرب الشباب الطيبه غيرجن 😹 متكليلي شنووو علاججن"
ws[213] = "اخوج"
rs[213] = "🌝😹 هووووه اني جيت للكروب داخلص منه شسوي/ن بي انته/ي"
ws[214] = "اخوك"
rs[214] = "🌝😹 هووووه اني جيت للكروب داخلص منه شسوي/ن بي انته/ي"
ws[215] = "اختج"
rs[215] = "😹☝🏿️حظرو سجاجينكم 🔪جابو سيره الخوات راح تصير عركه"
ws[216] = "اختك"
rs[216] = "😹☝🏿️حظرو سجاجينكم 🔪جابو سيره الخوات راح تصير عركه"
ws[217] = "امج"
rs[217] = "🤑 عــ👵🏻ــؤف الحجيه بحالها"
ws[218] = "امك"
rs[218] = "🤑 عــ👵🏻ــؤف الحجيه بحالها"
ws[219] = "ابوج"
rs[219] = "عـــ👴🏽ـوف/ي لحجي 🤑 بحــاله"
ws[220] = "ابوك"
rs[220] = "عـــ👴🏽ـوف/ي لحجي 🤑 بحــاله"
rs[221] = "احوالكم"
rs[221] = "احنه تمام احجيلنه انته/ي شلوونك/ج 😌"
ws[222] = "بخير"
rs[222] = "😌🐾 ياااااااارب الى الأفضل"
ws[223] = "ضوجة"
rs[223] = "انطيك شسمه 😒 حتى تفكك الضوجه 🤑🤑"
ws[224] = "زين"
rs[224] = "دوؤؤؤمــــ😌🐾ــــــك"
ws[225] = "زينه"
rs[225] = "دوؤؤؤمــــ😌🐾ــــــج"
ws[226] = "زينة"
rs[226] = "دوؤؤؤمــــ😌🐾ــــــج"
ws[227] = "😂😂😂😂😂😂😂"
rs[227] = "ضحكني وياك بس تكركر 🙄😹"
ws[228] = "😂😂😂😂😂"
rs[228] = "اي ولله سالفه اضحج 😿😹"
ws[229] = "مح"
rs[229] = "هاي ليش تبوسني بااع الحدايق حتكفر 😹💋"
ws[230] = "كفو"
rs[230] = "ميكول كفو اله الكفو تاج مخي🐲 🌝💋"
ws[231] = "اها"
rs[231] = "يب قابل اغشك شسالفة ضلع 😐🌝🎧"
ws[232] = "اه"
rs[232] = "اوف ستحمل بس واحد بعد😞😹"
ws[233] = "اريد بوت"
rs[233] = " تعال هنا🌝👄 @iqMaestroBot "
ws[234] = "اغير جو"
rs[234] = "😂 تغير جو لو تسحف 🐍 عل بنات"
ws[235] = "منو المطور"
rs[235] = "@iqMaestroBot نـﮧ✥ـٍعٰٓـ๋͜م تفضل🕷❤️ "
ws[236] = "غني"
rs[236] = "اي مو كدامك مغني قديم 😒🎋 هوه ﴿↜ انـِۨـۛـِۨـۛـِۨيـُِـٌِہۧۥۛ ֆᵛ͢ᵎᵖ ⌯﴾❥ ربي كامز و تكلي غنيلي 🙄😒🕷 آإرۈحُـ✯ـہ✟ 😴أنــ💤ــااااام😴 اشرف تالي وكت يردوني اغني 😒☹️🚶"
ws[237] = "وين المطور"
rs[237] = "@iqMaestroBot"
ws[238] = "الدنيه شنو"
rs[238] = "كحبه تضحك بس للكواويد يخوي كفو منك ع راسي🙂💜"
ws[239] = "يا فيصل"
rs[239] = "تخليني🐸😹"
ws[240] = "شنو اسم البوت"
rs[240] = "صكاركم المايسترووو✌ "
ws[241] = "افلش"
rs[241] = "حته ارجعك بمك حبي🌝💋"
ws[242] = "منحرف"
rs[242] = "وينه خلي اصادق اخته وكسر عينه😔😹"
ws[243] = "واكف"
rs[243] = "بنلخرا وين واكف😐"
ws[244] = "اريد اكبل"
rs[244] = "شـًٍـًٍوــًٍـًٍفـًٍــًٍـًٍلـًٍلًٍي وياك اختهة حديقه ودايح رسمي 🙇🏿💜😹"
ws[245] = "بنيه"
rs[245] = "وينه خلي تجيني واتس نتونس🌝💜"
ws[246] = "لتزحف"
rs[246] = "دعوفه زاحف ع خالتك خلي يستفاد😕😹🙊"
ws[247] = "هم يجي يوم تعوفني"
rs[247] = "لأ يخوي تشهههد الدنيه احبگ؟موت احپگ يلحپيپ💜🍃"
ws[248] = "هينه بمكاني"
rs[248] = "طيز مطيزه عير مفرزه عير يفتر وره الطيز دبه دهن دبه كريز ابن العاهره ابن الكايمه ابن التشيله وهيه نايمه ابن ام البلاوي امك تشيل حته الخصاوي اخت التبلع ابن الترضع ابن التمص وماتشبع عير يطب وعير يطلع ادري طِيِّﺰ لو مقلع بس انت اصلك ماتشبع"
ws[249] = "اكسر عينه هسه"
rs[249] = "ابن الهايمة ابن الكايمة ابن التمصة وهية نايمة ابن العاهرة السكسية ابن الشرموطة التكعد ع العير وتسوي موطة امك ترجع ع العير بدون مرايات وشايفة العير اكثر من المطهرجي وماخذة وية العير صورة ولاعبة علية جقة شبر اليوم انيجك نيجت القرد واخليك مشمور بالبرد انيجك نيجت الحمار شرط بالليل مو بالنهار انيجك نيجة البعير وانطيك عير ستيل فوتة للاخير واطلع من طيزك خنزير "
ws[250] = "كافي حب"
rs[250] = "صار تاج راسي شوكت متريد انيجهم حاظر اني🙊❤️"
ws[251] = "تنح"
rs[251] = "من يصير عندك عود اتنح دي فرخي😸🤘🏿"
ws[252] = "جوني"
rs[252] = "#تجراسنه وحامي اعراضنه ويحب مايا وف يوميه اضرب عليهم 😞💋"
ws[253] = "اكل خرا"
rs[253] = "خرا ليترس حلكك/ج ياخرا يابنلخرا خختفووو ابلع😸🙊💋"
ws[254] = "الدنيه للتهواك شتمطر"
rs[254] = "كساسه كساسه مطرت عليه بعير شكبر راسه وشكرا😞❤️💋"
ws[256] = "مايسترو"
rs[256] = "هااا حبيبي شرايد😍🙊"
ws[257] = "اسامه"
rs[257] = "فديتة فدي 😘😘هذا الصنعني⚙🛠 من البنطرون للبدي 👚هذا مطور مال اني"
ws[258] = "تبادل"
rs[258] = "مااتبادل يلا انجب 💦"
ws[259] = "اوف"
rs[259] = "تعال نيشني بلكت ترتاااح 😒😒"
ws[260] = "يلة" -- msg
rs[260] = "اصبر رااااح توووووصل ااااااااااخ"
ws[261] = "معزوفة"
rs[261] = "طم طم طح طح روح للكاع"
ws[262] = "احبج"
rs[262] = "مبين عليك زاحف نوعية فاخر"
ws[263] = "شتكول عل بوتات الجديدة"
rs[263] = "طيط بطورين ههه"
ws[264] = "منو اقوه بوت"
rs[264] = "اني طبعن دي دي لحد يوصل"
ws[265] = "شكاعد تسوي هسة"
rs[265] = "والله لازم البطل والجكارة وصك بيهن"
ws[266] = "شتكول عل زواحف"
rs[266] = "والله عمي بس الزواحف يكبلون شايفلك شريف كبل ماكو"
ws[267] = "تحبني"
rs[267] = " اموووووووووت ع رب البيهن مجال🐸💔 "
ws[268] = "عزوز"
rs[268] = "فديتة فدي 😘😘هذا الصنعني⚙🛠 من البنطرون للبدي 👚هذا مطور مال اني"
ws[269] = "كسمك"
rs[269] = " مال امك لوردي شايفه🌝👄 "
ws[270] = "معتز"
rs[270] = "فديتة فدي 😘😘هذا الصنعني⚙🛠 من البنطرون للبدي 👚هذا مطور مال اني"
ws[271] = "ام حسين"
rs[271] = "هاي حبيبت سيف ليندك بيه اشكه؟"
ws[272] = "تعالي خاص"
rs[272] = "اهوو ضل ضل ساحف كبر طمك😔😹❤️"
ws[273] = "💔"
rs[273] = "تعال/ـي اشكيلي اهمومك/ـج ليش ضايج/ـه 🙁😭💔"
ws[274] = "طبعاا"
rs[274] = "#تجراسي والله تحتاج شي؟☹️💜😹"
ws[275] = "غنيلي"
rs[275] = "لا تظربني لا تظرب 💃💃 كسرت الخيزارانه💃🎋 صارلي سنه وست اشهر💃💃 من ظربتك وجعانه🤒😹 اه اه"
ws[276] = "مكوم"
rs[276] = "ستادي حكه بيهم كلهم فروخ وكحاب بس يستشرفون وداعتك😞🤘🏿"
ws[277] = "اكلك"
rs[277] = "ليش ما تنلصم احسن اكيد ماعدك سالفة براسهة خير"
ws[278] = "بوس الاعضاء"
rs[278] = "الولد وخرو لا ازوووع يلاااا البنااات بالسرة تحضرن اممممممممممممممممواح"
ws[279] = "شكو ماكو"
rs[279] = "غيرك براسي ماكو 💨😽🚬️"
ws[280] = "تا حسك اجذب"
rs[280] = "ششايفني كواد 🌚😂️"
ws[281] = "شخبار صديقتك"
rs[281] = "والله 🌚💔 تركتهة ️"
ws[282] = "ليش تركتهه"
rs[282] = "برب زنجرت 😂💔 رب ما بقة براسهة️"
ws[283] = "ابو حسين"
rs[283] = "هاذ اكبر زاحف 🐍 شفتة بحياتي 😂✌🏿️"
ws[284] = "شنو رائيك"
rs[284] = "بمنو️"
ws[285] = "منو تحب اكثر اني لو عزوز"
rs[285] = "😕 دي ثنينكم احب الجكارة والنركيلة 😂✋🏿"
ws[286] ="معزوفه"
rs[286] ="طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم 💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃طممممممم طححححححححححححح للكاااااااااااااااااااااااااااااااااع هز هز هز هز هز هز هز هز هز هز هز هز هز هز روح روح روح 💃💃💃💃💃💃💃💃💃 اركص اركص للكاع طم طم طححححححححححح طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم 💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃💃طممممممم طححححححححححححح للكاااااااااااااااااااااااااااااااااع هز هز هز هز هز هز هز هز هز هز هز هز هز هز روح روح روح 💃💃💃💃💃💃💃💃💃 اركص اركص للكاع طم طم طححححححححححح طم طح طح طح طم طم طم طررررن طررررن بيق بيق 😂😂 شعر شعر رؤؤح للكاع طم طم طح طح طم طم .طررررن طررررن ....💃💃💃💃💃💃💃💃💃 ...طح طح طم طم"
ws[287] = "كاظم"
rs[287] = "وردة 🌹 مال الله ضاغطهم 😌✋🏿"
ws[288] = "تا حسك ساحف"
rs[288] = "اي والله 😁 اسحف علة ابوية اريد فلوس 🐼💔"
ws[289] = "تسلم"
rs[289] = "ادلل حبي 😘🌹"
ws[290] = "😂" -- msg
rs[290] = "دوم الضحكة فوديت هالصماغ 😉"
ws[291] = "😐"
rs[291] = "لمن يصفن المطي 😹😼"
ws[292] = "😡"
rs[292] = "ابرد 🚒"
ws[293] = "💋"
rs[293] = "ااااح يمه فديته هسة مال اخذ حلق منه ❤️😻"
ws[294] = "🚶"
rs[294] = "وين رايح خليك ويانه بتونس ☹️💔"
ws[295] = "🙊" --
rs[295] = "صاير/ه خجول/ه القرد/ه 🐸😹"
ws[296] = "😑"
rs[296] = "عدل وجهك الاعوج 😑"
ws[297] = "👍"
rs[297] = "اوك بس وين 🌚"
ws[298] = "🐸"
rs[298] = "طيط 😹😐"
ws[299] = "😋"
rs[299] = "بالعافيه وليدي ببطنك/ـج وببطن الخلفوك/ـج🌚💋"
ws[300] = "😉"
rs[300] = "لا تغمز بعد 😒 وممنوع الخاص لتفكر اصلا 🌚🎈"
ws[301] = "😡"
rs[301] = "اهدء لتفقد الاعصاب وتسوي مشكله كافي مشاكل 😐👌"
ws[302] = "😚"
rs[302] = "ممح فديت الحلق 💋"
ws[303] = "😝"
rs[303] = "ضم/ي لسانك/ج لا اكصو 🌚🎈"
ws[304] = "🤒"
rs[304] = "اليوم اضربك ابره 💉😹"
ws[305] = "😕"
rs[305] = "عدل حلكك مطي 😒 فضحتنه 🤕"
ws[306] = "مح"
rs[306] = "فديت عشل عشل 😻😻"
ws[307] = "كرار"
rs[307] = " كرار باعص ليث ورسول المنصوري 🐸✋🏿"
ws[308] = "احجي انكليزي"
rs[308] = "شوف يطلب من الحافي انعال 🤔 هواني عربي اشخبط شخبط 😹😹😹"
ws[309] = "احجي عربي"
rs[309] = "لك بابا العربي ميردله شي بس اقرا انكليزي 😻😹😹"
ws[310] = "عزوز"
rs[310] = "فديتة فدي 😘😘هذا الصنعني⚙🛠 من البنطرون للبدي 👚هذا مطور مال اني"
ws[311] = "ببكن"
rs[311] = "كضوووو راح يزحف 🙀😹"
ws[312] = "شهد"
rs[312] = "😍ااخ الله هاي خالتنا😍 وضلعتنا الصاكه😍"
ws[313] = "زهراء"
rs[313] = "صاكة😍تموووت 😍عسل الكروب ومحبوبة الكلوب😍 "
ws[314] = "داطلي" -- msg
rs[314] = " هل تقصد داطلي النبي متوفر لدى علي حسن فرعنا الوحيد احذر التقليد😂✋" -- rep
ws[315] = "داطلي النبي" -- msg
rs[315] = " علي حسن عرفتك رحمه لبوك لا تشاقه😂✋" -- rep
ws[316] = "🤐"
rs[316] = "عفيه لو هيج تخيط حلكك لو لا 😹😹"
ws[317] = "دعاء" -- msg
rs[317] = "هاي الضلعة هاي😻عسل لگروب😻❤️ومحبوبة الگلوب😎🌹" -- reply
-- the main function
function run( msg, matches )
-- just a local variables that i used in my algorithm
local i = 0; local w = false
-- the main part that get the message that the user send and check if it equals to one of the words in the ws table :)
-- this section loops through all the words table and assign { k } to the word index and { v } to the word itself
for k,v in pairs(ws) do
-- change the message text to uppercase and the { v } value that toke form the { ws } table and than compare it in a specific pattern
if ( string.find(string.upper(msg.text), "^" .. string.upper(v) .. "$") ) then
-- assign the { i } to the index of the reply and the { w } to true ( we will use it later )
i = k; w = true;
end
end
-- check if { w } is not false and { i } not equals to 0
if ( (w ~= false) and (i ~= 0) ) then
-- get the receiver :3
R = get_receiver(msg)
-- send him the proper message from the index that { i } assigned to
--send_large_msg ( R , rs[i] );
--send_reply(msg.id, rs[i])
reply_msg(msg.id, rs[i], ok_cb, false )
end
-- don't edit this section
if ( msg.text == "about" ) then
if ( msg.from.username == "MaEsTrO_0" ) then
R = get_receiver(msg)
send_large_msg ( R , "Made by @MaEsTrO_0" );
end
end
end
return {
patterns = {
"(.*)"
},
run = run
}
end
| gpl-2.0 |
Vermeille/kong | kong/plugins/runscope/handler.lua | 6 | 2213 | local runscope_serializer = require "kong.plugins.log-serializers.runscope"
local BasePlugin = require "kong.plugins.base_plugin"
local log = require "kong.plugins.runscope.log"
local ngx_log = ngx.log
local ngx_log_ERR = ngx.ERR
local string_find = string.find
local req_read_body = ngx.req.read_body
local req_get_headers = ngx.req.get_headers
local req_get_body_data = ngx.req.get_body_data
local req_get_post_args = ngx.req.get_post_args
local pcall = pcall
local RunscopeLogHandler = BasePlugin:extend()
function RunscopeLogHandler:new()
RunscopeLogHandler.super.new(self, "runscope")
end
function RunscopeLogHandler:access(conf)
RunscopeLogHandler.super.access(self)
local req_body, res_body = "", ""
local req_post_args = {}
if conf.log_body then
req_read_body()
req_body = req_get_body_data()
local headers = req_get_headers()
local content_type = headers["content-type"]
if content_type and string_find(content_type:lower(), "application/x-www-form-urlencoded", nil, true) then
local status, res = pcall(req_get_post_args)
if not status then
if res == "requesty body in temp file not supported" then
ngx_log(ngx_log_ERR, "[runscope] cannot read request body from temporary file. Try increasing the client_body_buffer_size directive.")
else
ngx_log(ngx_log_ERR, res)
end
else
req_post_args = res
end
end
end
-- keep in memory the bodies for this request
ngx.ctx.runscope = {
req_body = req_body,
res_body = res_body,
req_post_args = req_post_args
}
end
function RunscopeLogHandler:body_filter(conf)
RunscopeLogHandler.super.body_filter(self)
if conf.log_body then
local chunk = ngx.arg[1]
local runscope_data = ngx.ctx.runscope or {res_body = ""} -- minimize the number of calls to ngx.ctx while fallbacking on default value
runscope_data.res_body = runscope_data.res_body..chunk
ngx.ctx.runscope = runscope_data
end
end
function RunscopeLogHandler:log(conf)
RunscopeLogHandler.super.log(self)
local message = runscope_serializer.serialize(ngx)
log.execute(conf, message)
end
RunscopeLogHandler.PRIORITY = 1
return RunscopeLogHandler
| apache-2.0 |
Schaka/gladdy | Modules/Clicks.lua | 1 | 8361 | local tinsert = table.insert
local pairs = pairs
local tonumber = tonumber
local InCombatLockdown = InCombatLockdown
local GetBindingKey = GetBindingKey
local ClearOverrideBindings = ClearOverrideBindings
local SetOverrideBindingClick = SetOverrideBindingClick
local MACRO, TARGET, FOCUS, ADDON_DISABLED = MACRO, TARGET, FOCUS, ADDON_DISABLED
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local attributes = {
{name = "Target", button = "1", modifier = "", action = "target", spell = ""},
{name = "Focus", button = "2", modifier = "", action = "focus", spell = ""},
}
for i = 3, 10 do
tinsert(attributes, {name = L["Action #%d"]:format(i), button = "", modifier = "", action = "disabled", spell = ""})
end
local Clicks = Gladdy:NewModule("Clicks", nil, {
attributes = attributes,
})
LibStub("AceTimer-3.0"):Embed(Clicks)
BINDING_HEADER_GLADDY = "Gladdy"
BINDING_NAME_GLADDYBUTTON1_LEFT = L["Left Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_LEFT = L["Left Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_LEFT = L["Left Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_LEFT = L["Left Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_LEFT = L["Left Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_RIGHT = L["Right Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_RIGHT = L["Right Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_RIGHT = L["Right Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_RIGHT = L["Right Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_RIGHT = L["Right Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_MIDDLE = L["Middle Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_MIDDLE = L["Middle Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_MIDDLE = L["Middle Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_MIDDLE = L["Middle Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_MIDDLE = L["Middle Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_BUTTON4 = L["Button4 Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_BUTTON4 = L["Button4 Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_BUTTON4 = L["Button4 Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_BUTTON4 = L["Button4 Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_BUTTON4 = L["Button4 Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_BUTTON5 = L["Button5 Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_BUTTON5 = L["Button5 Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_BUTTON5 = L["Button5 Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_BUTTON5 = L["Button5 Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_BUTTON5 = L["Button5 Click Enemy 5"]
BINDING_NAME_GLADDYTRINKET1 = L["Trinket Used Enemy 1"]
BINDING_NAME_GLADDYTRINKET2 = L["Trinket Used Enemy 2"]
BINDING_NAME_GLADDYTRINKET3 = L["Trinket Used Enemy 3"]
BINDING_NAME_GLADDYTRINKET4 = L["Trinket Used Enemy 4"]
BINDING_NAME_GLADDYTRINKET5 = L["Trinket Used Enemy 5"]
function Clicks:Initialise()
self:RegisterMessage("JOINED_ARENA")
end
function Clicks:Reset()
self:CancelAllTimers()
end
function Clicks:ResetUnit(unit)
local button = Gladdy.buttons[unit]
if (not button) then return end
for k, v in pairs(Gladdy.db.attributes) do
button.secure:SetAttribute(v.modifier .. "macrotext" .. v.button, "")
end
end
function Clicks:JOINED_ARENA()
for k, v in pairs(Gladdy.buttons) do
local left = GetBindingKey(("GLADDYBUTTON%d_LEFT"):format(v.id))
local right = GetBindingKey(("GLADDYBUTTON%d_RIGHT"):format(v.id))
local middle = GetBindingKey(("GLADDYBUTTON%d_MIDDLE"):format(v.id))
local button4 = GetBindingKey(("GLADDYBUTTON%d_BUTTON4"):format(v.id))
local button5 = GetBindingKey(("GLADDYBUTTON%d_BUTTON5"):format(v.id))
local key = GetBindingKey("GLADDYTRINKET" .. v.id)
ClearOverrideBindings(v.trinketButton)
ClearOverrideBindings(v.secure)
if (left) then
SetOverrideBindingClick(v.secure, false, left, v.secure:GetName(), "LeftButton")
end
if (right) then
SetOverrideBindingClick(v.secure, false, right, v.secure:GetName(), "RightButton")
end
if (middle) then
SetOverrideBindingClick(v.secure, false, middle, v.secure:GetName(), "MiddleButton")
end
if (button4) then
SetOverrideBindingClick(v.secure, false, button4, v.secure:GetName(), "Button4")
end
if (button5) then
SetOverrideBindingClick(v.secure, false, button5, v.secure:GetName(), "Button5")
end
if (key) then
SetOverrideBindingClick(v.trinketButton, true, key, v.trinketButton:GetName(), "LeftButton")
end
end
self:ScheduleRepeatingTimer("CheckAttributes", .1, self)
end
function Clicks:CheckAttributes()
for k, v in pairs(Gladdy.buttons) do
if (v.guid ~= "") then
if (not v.click and not InCombatLockdown()) then
self:SetupAttributes(k)
v.click = true
end
local healthBar = Gladdy.modules.Healthbar.frames[k]
if (v.click) then
healthBar.nameText:SetText(v.name)
v:SetAlpha(1)
else
healthBar.nameText:SetFormattedText("**%s**", v.name)
v:SetAlpha(.66)
end
end
end
end
function Clicks:SetupAttributes(unit)
local button = Gladdy.buttons[unit]
if (not button) then return end
for k, v in pairs(Gladdy.db.attributes) do
self:SetupAttribute(button, v.button, v.modifier, v.action, v.spell)
end
end
function Clicks:SetupAttribute(button, key, mod, action, spell)
local attr = mod .. "macrotext" .. key
local text = ""
if (action == "macro") then
text = spell:gsub("*name*", button.name)
elseif (action ~= "disabled") then
text = "/targetexact " .. button.name
if (action == "focus") then
text = text .. "\n/focus\n/targetlasttarget"
elseif (action == "spell") then
text = text .. "\n/cast " .. spell .. "\n/targetlasttarget"
end
end
button.secure:SetAttribute(attr, text)
end
local buttons = {["1"] = L["Left button"], ["2"] = L["Right button"], ["3"] = L["Middle button"], ["4"] = L["Button 4"], ["5"] = L["Button 5"]}
local modifiers = {[""] = L["None"], ["ctrl-"] = L["CTRL"], ["shift-"] = L["SHIFT"], ["alt-"] = L["ALT"]}
local clickValues = {["macro"] = MACRO, ["target"] = TARGET, ["focus"] = FOCUS, ["spell"] = L["Cast Spell"], ["disabled"] = ADDON_DISABLED}
local function SetupAttributeOption(i)
return {
type = "group",
name = Gladdy.dbi.profile.attributes[i].name,
desc = Gladdy.dbi.profile.attributes[i].name,
order = i + 1,
get = function(info)
return Gladdy.dbi.profile.attributes[tonumber(info[#info - 1])][info[#info]]
end,
set = function(info, value)
Gladdy.dbi.profile.attributes[tonumber(info[#info - 1])][info[#info]] = value
if (info[#info] == "name") then
Gladdy.options.args.Clicks.args[info[#info - 1]].name = value
end
Gladdy:UpdateFrame()
end,
args = {
name = {
type = "input",
name = L["Name"],
desc = L["Select the name of the click option"],
order = 1,
},
button = {
type = "select",
name = L["Button"],
desc = L["Select which mouse button to use"],
order = 2,
values = buttons,
},
modifier = {
type = "select",
name = L["Modifier"],
desc = L["Select which modifier to use"],
order = 3,
values = modifiers,
},
action = {
type = "select",
name = L["Action"],
desc = L["Select what action this mouse button does"],
order = 4,
values = clickValues,
},
spell = {
type = "input",
name = L["Spell name / Macro text"],
desc = L["Use *name* as unit's name. Like a '/rofl *name*'"],
order = 5,
multiline = true,
},
},
}
end
function Clicks:GetOptions()
local options = {}
for i = 1, 10 do
options[tostring(i)] = SetupAttributeOption(i)
end
return options
end | mit |
pablo93/TrinityCore | Data/Interface/FrameXML/SkillFrame.lua | 1 | 15630 | SKILLS_TO_DISPLAY = 12;
SKILLFRAME_SKILL_HEIGHT = 15;
function SkillFrame_OnShow (self)
SkillFrame_UpdateSkills(self);
end
function SkillFrame_OnLoad (self)
self:RegisterEvent("SKILL_LINES_CHANGED");
self:RegisterEvent("CHARACTER_POINTS_CHANGED");
SkillListScrollFrameScrollBar:SetValue(0);
SetSelectedSkill(0);
SkillFrame.statusBarClickedID = 0;
SkillFrame.showSkillDetails = nil;
SkillFrame_UpdateSkills(self);
end
function SkillFrame_OnEvent(self, event, ...)
if ( SkillFrame:IsVisible() ) then
SkillFrame_UpdateSkills(self);
end
end
function SkillFrame_SetStatusBar(statusBarID, skillIndex, numSkills, adjustedSkillPoints)
-- Get info
local skillName, header, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType = GetSkillLineInfo(skillIndex);
local skillRankStart = skillRank;
skillRank = skillRank + numTempPoints;
-- Skill bar objects
local statusBar = getglobal("SkillRankFrame"..statusBarID);
local statusBarLabel = "SkillRankFrame"..statusBarID;
local statusBarSkillRank = getglobal("SkillRankFrame"..statusBarID.."SkillRank");
local statusBarName = getglobal("SkillRankFrame"..statusBarID.."SkillName");
local statusBarBorder = getglobal("SkillRankFrame"..statusBarID.."Border");
local statusBarBackground = getglobal("SkillRankFrame"..statusBarID.."Background");
local statusBarFillBar = getglobal("SkillRankFrame"..statusBarID.."FillBar");
statusBarFillBar:Hide();
-- Header objects
local skillRankFrameBorderTexture = getglobal("SkillRankFrame"..statusBarID.."Border");
local skillTypeLabelText = getglobal("SkillTypeLabel"..statusBarID);
-- Frame width vars
local skillRankFrameWidth = 0;
-- Hide or show skill bar
if ( skillName == "" ) then
statusBar:Hide();
skillTypeLabelText:Hide();
return;
end
-- Is header
if ( header ) then
skillTypeLabelText:Show();
skillTypeLabelText:SetText(skillName);
skillTypeLabelText.skillIndex = skillIndex;
skillRankFrameBorderTexture:Hide();
statusBar:Hide();
local normalTexture = getglobal("SkillTypeLabel"..statusBarID.."NormalTexture");
if ( isExpanded ) then
skillTypeLabelText:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up");
else
skillTypeLabelText:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up");
end
skillTypeLabelText.isExpanded = isExpanded;
return;
else
skillTypeLabelText:Hide();
skillRankFrameBorderTexture:Show();
statusBar:Show();
end
-- Set skillbar info
statusBar.skillIndex = skillIndex;
statusBarName:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
statusBarSkillRank:SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
statusBarSkillRank:ClearAllPoints();
statusBarSkillRank:SetPoint("LEFT", "SkillRankFrame"..statusBarID.."SkillName", "RIGHT", 13, 0);
statusBarSkillRank:SetJustifyH("LEFT");
-- Anchor the text to the left by default
statusBarName:ClearAllPoints();
statusBarName:SetPoint("LEFT", statusBar, "LEFT", 6, 1);
-- Lock border color if skill is selected
if (skillIndex == GetSelectedSkill()) then
statusBarBorder:LockHighlight();
else
statusBarBorder:UnlockHighlight();
end
-- Set bar color depending on skill cost
if (skillCostType == 1) then
statusBar:SetStatusBarColor(0.0, 0.75, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.0, 0.5, 0.0, 0.5);
statusBarFillBar:SetVertexColor(0.0, 1.0, 0.0, 0.5);
elseif (skillCostType == 2) then
statusBar:SetStatusBarColor(0.75, 0.75, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.75, 0.75, 0.0, 0.5);
statusBarFillBar:SetVertexColor(1.0, 1.0, 0.0, 0.5);
elseif (skillCostType == 3) then
statusBar:SetStatusBarColor(0.75, 0.0, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.75, 0.0, 0.0, 0.5);
statusBarFillBar:SetVertexColor(1.0, 0.0, 0.0, 0.5);
else
statusBar:SetStatusBarColor(0.5, 0.5, 0.5, 0.5);
statusBarBackground:SetVertexColor(0.5, 0.5, 0.5, 0.5);
statusBarFillBar:SetVertexColor(1.0, 1.0, 1.0, 0.5);
end
-- Default width
skillRankFrameWidth = 256;
statusBarName:SetText(skillName);
-- Show and hide skill up arrows
if ( stepCost ) then
-- If is a learnable skill
-- Set cost, text, and color
statusBar:SetMinMaxValues(0, 1);
statusBar:SetValue(0);
statusBar:SetStatusBarColor(0.25, 0.25, 0.25);
statusBarBackground:SetVertexColor(0.75, 0.75, 0.75, 0.5);
statusBarName:SetFormattedText(LEARN_SKILL_TEMPLATE,skillName);
statusBarName:ClearAllPoints();
statusBarName:SetPoint("LEFT", statusBar, "LEFT", 15, 1);
statusBarSkillRank:SetText("");
-- If skill is too high level
if ( UnitLevel("player") < minLevel ) then
statusBar:SetValue(0);
statusBarSkillRank:SetFormattedText(LEVEL_GAINED,skillLevel);
statusBarSkillRank:ClearAllPoints();
statusBarSkillRank:SetPoint("RIGHT", "SkillDetailStatusBar", "RIGHT",-13, 0);
statusBarSkillRank:SetJustifyH("RIGHT");
statusBarName:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
statusBarSkillRank:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
return;
end
elseif ( rankCost or (numTempPoints > 0) ) then
-- If is a skill that can be trained up
if ( not rankCost ) then
rankCost = 0;
end
statusBarName:SetText(skillName);
-- Setwidth value
skillRankFrameWidth = 215;
else
-- Normal skill
statusBarName:SetText(skillName);
statusBar:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
statusBarBackground:SetVertexColor(0.0, 0.0, 0.75, 0.5);
end
if ( skillMaxRank == 1 ) then
-- If max rank in a skill is 1 assume that its a proficiency
statusBar:SetMinMaxValues(0, 1);
statusBar:SetValue(1);
statusBar:SetStatusBarColor(0.5, 0.5, 0.5);
statusBarSkillRank:SetText("");
statusBarBackground:SetVertexColor(1.0, 1.0, 1.0, 0.5);
elseif ( skillMaxRank > 0 ) then
statusBar:SetMinMaxValues(0, skillMaxRank);
statusBar:SetValue(skillRankStart);
if (numTempPoints > 0) then
local fillBarWidth = (skillRank / skillMaxRank) * statusBar:GetWidth();
statusBarFillBar:SetPoint("TOPRIGHT", statusBarLabel, "TOPLEFT", fillBarWidth, 0);
statusBarFillBar:Show();
else
statusBarFillBar:Hide();
end
if ( skillModifier == 0 ) then
statusBarSkillRank:SetText(skillRank.."/"..skillMaxRank);
else
local color = RED_FONT_COLOR_CODE;
if ( skillModifier > 0 ) then
color = GREEN_FONT_COLOR_CODE.."+"
end
statusBarSkillRank:SetText(skillRank.." ("..color..skillModifier..FONT_COLOR_CODE_CLOSE..")/"..skillMaxRank);
end
end
end
function SkillDetailFrame_SetStatusBar(skillIndex, adjustedSkillPoints)
-- Get info
local skillName, header, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType, skillDescription = GetSkillLineInfo(skillIndex);
local skillRankStart = skillRank;
skillRank = skillRank + numTempPoints;
-- Skill bar objects
local statusBar = getglobal("SkillDetailStatusBar");
local statusBarBackground = getglobal("SkillDetailStatusBarBackground");
local statusBarSkillRank = getglobal("SkillDetailStatusBarSkillRank");
local statusBarName = getglobal("SkillDetailStatusBarSkillName");
local statusBarUnlearnButton = getglobal("SkillDetailStatusBarUnlearnButton");
local statusBarLeftArrow = getglobal("SkillDetailStatusBarLeftArrow");
local statusBarRightArrow = getglobal("SkillDetailStatusBarRightArrow");
local statusBarLearnSkillButton = getglobal("SkillDetailStatusBarLearnSkillButton");
local statusBarFillBar = getglobal("SkillDetailStatusBarFillBar");
-- Frame width vars
local skillRankFrameWidth = 0;
-- Hide or show skill bar
if ( not skillName or skillName == "" ) then
statusBar:Hide();
SkillDetailDescriptionText:Hide();
return;
else
statusBar:Show();
SkillDetailDescriptionText:Show();
end
-- Hide or show abandon button
if ( isAbandonable ) then
statusBarUnlearnButton:Show();
statusBarUnlearnButton.skillName = skillName;
statusBarUnlearnButton.index = index;
else
statusBarUnlearnButton:Hide();
end
-- Set skillbar info
statusBar.skillIndex = skillIndex;
statusBarName:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
statusBarSkillRank:SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
statusBarSkillRank:ClearAllPoints();
statusBarSkillRank:SetPoint("LEFT", "SkillDetailStatusBarSkillName", "RIGHT", 13, 0);
statusBarSkillRank:SetJustifyH("LEFT");
-- Hide the learn skill button by default
statusBarLearnSkillButton:Hide();
-- Anchor the text to the left by default
statusBarName:ClearAllPoints();
statusBarName:SetPoint("LEFT", statusBar, "LEFT", 6, 1);
-- Set bar color depending on skill cost
local skillType = "";
if (skillCostType == 1) then
statusBar:SetStatusBarColor(0.0, 0.75, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.0, 0.75, 0.0, 0.5);
statusBarFillBar:SetVertexColor(0.0, 1.0, 0.0, 0.5);
elseif (skillCostType == 2) then
statusBar:SetStatusBarColor(0.75, 0.75, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.75, 0.75, 0.0, 0.5);
statusBarFillBar:SetVertexColor(1.0, 1.0, 0.0, 0.5);
elseif (skillCostType == 3) then
statusBar:SetStatusBarColor(0.75, 0.0, 0.0, 0.5);
statusBarBackground:SetVertexColor(0.75, 0.0, 0.0, 0.5);
statusBarFillBar:SetVertexColor(1.0, 0.0, 0.0, 0.5);
-- skillType = "Tertiary Skill:";
end
-- Set skill description text
SkillDetailDescriptionText:SetFormattedText(SKILL_DESCRIPTION,skillType,skillDescription);
-- Default width
skillRankFrameWidth = 256;
-- Show and hide skill up arrows
if ( stepCost ) then
-- If is a learnable skill
-- Color red or green depending on if its affordable or not
local color = RED_FONT_COLOR_CODE;
if ( adjustedSkillPoints >= stepCost ) then
color = GREEN_FONT_COLOR_CODE;
end
-- Set cost, text, and color
statusBar:SetMinMaxValues(0, 1);
statusBar:SetValue(1);
statusBar:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
statusBarName:SetFormattedText(LEARN_SKILL_TEMPLATE,skillName);
statusBarName:ClearAllPoints();
statusBarName:SetPoint("CENTER", statusBar, "CENTER", 0, 1);
statusBarSkillRank:SetText("");
statusBarFillBar:Hide();
statusBarLearnSkillButton:Show();
statusBarLeftArrow:Hide();
statusBarRightArrow:Hide();
-- Set skill learnable cost text
if ( stepCost == 1 ) then
SkillDetailCostText:SetFormattedText(SKILL_LEARNING_COST_SINGULAR,color,stepCost);
else
SkillDetailCostText:SetFormattedText(SKILL_LEARNING_COST,color,stepCost);
end
SkillDetailCostText:Show();
-- If skill is too high level
if ( UnitLevel("player") < minLevel ) then
statusBar:SetValue(0);
statusBarSkillRank:SetFormattedText(LEVEL_GAINED,skillLevel);
statusBarSkillRank:ClearAllPoints();
statusBarSkillRank:SetPoint("RIGHT", "SkillDetailStatusBar", "RIGHT",-13, 0);
statusBarSkillRank:SetJustifyH("RIGHT");
statusBarName:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
statusBarSkillRank:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
statusBarLeftArrow:Hide();
statusBarRightArrow:Hide();
return;
end
elseif ( rankCost or (numTempPoints > 0) ) then
-- If is a skill that can be trained up
if ( not rankCost ) then
rankCost = 0;
end
statusBarLeftArrow:Show();
statusBarRightArrow:Show();
-- Color red or green depending on if its affordable or not
local color = RED_FONT_COLOR_CODE;
if ( adjustedSkillPoints >= rankCost ) then
color = GREEN_FONT_COLOR_CODE;
end
-- Set skill increment cost text
if ( skillRank == skillMaxRank ) then
color = "|cff888888";
end
if ( rankCost == 1 ) then
SkillDetailCostText:SetFormattedText(SKILL_INCREMENT_COST_SINGULAR,color,rankCost);
else
SkillDetailCostText:SetFormattedText(SKILL_INCREMENT_COST,color,rankCost);
end
SkillDetailCostText:Show();
if ( numTempPoints > 0 ) then
statusBarLeftArrow:Enable();
else
statusBarLeftArrow:Disable();
end
if ( (adjustedSkillPoints >= rankCost) and (rankCost ~= 0) and (skillRank ~= skillMaxRank) ) then
statusBarRightArrow:Enable();
else
statusBarRightArrow:Disable();
end
statusBarName:SetText(skillName);
-- Setwidth value
skillRankFrameWidth = 215;
else
-- Normal skill
statusBarName:SetText(skillName);
statusBar:SetStatusBarColor(0.0, 0.0, 1.0, 0.5);
statusBarBackground:SetVertexColor(0.0, 0.0, 0.75, 0.5);
statusBarLeftArrow:Hide();
statusBarRightArrow:Hide();
SkillDetailCostText:Hide();
end
if ( SkillDetailCostText:IsShown() ) then
SkillDetailDescriptionText:SetPoint("TOP", "SkillDetailCostText", "BOTTOM", 0, -10 );
else
SkillDetailDescriptionText:SetPoint("TOP", "SkillDetailCostText", "TOP", 0, 0 );
end
if ( skillMaxRank == 1 ) then
-- If max rank in a skill is 1 assume that its a proficiency
statusBar:SetMinMaxValues(0, 1);
statusBar:SetValue(1);
statusBar:SetStatusBarColor(0.5, 0.5, 0.5);
statusBarSkillRank:SetText("");
statusBarBackground:SetVertexColor(1.0, 1.0, 1.0, 0.5);
statusBarLeftArrow:Hide();
statusBarRightArrow:Hide();
statusBarFillBar:Hide();
elseif ( skillMaxRank > 0 ) then
statusBar:SetMinMaxValues(0, skillMaxRank);
statusBar:SetValue(skillRankStart);
if (numTempPoints > 0) then
local fillBarWidth = (skillRank / skillMaxRank) * statusBar:GetWidth();
statusBarFillBar:SetPoint("TOPRIGHT", "SkillDetailStatusBar", "TOPLEFT", fillBarWidth, 0);
statusBarFillBar:Show();
else
statusBarFillBar:Hide();
end
if ( skillModifier == 0 ) then
statusBarSkillRank:SetText(skillRank.."/"..skillMaxRank);
else
local color = RED_FONT_COLOR_CODE;
if ( skillModifier > 0 ) then
color = GREEN_FONT_COLOR_CODE.."+"
end
statusBarSkillRank:SetText(skillRank.." ("..color..skillModifier..FONT_COLOR_CODE_CLOSE..")/"..skillMaxRank);
end
end
end
function SkillFrame_UpdateSkills()
local numSkills = GetNumSkillLines();
local adjustedSkillPoints = GetAdjustedSkillPoints();
local offset = FauxScrollFrame_GetOffset(SkillListScrollFrame) + 1;
local index = 1;
for i=offset, offset + SKILLS_TO_DISPLAY - 1 do
if ( i <= numSkills ) then
SkillFrame_SetStatusBar(index, i, numSkills, adjustedSkillPoints);
else
break;
end
index = index + 1;
end
-- Update the expand/collapse all button
SkillFrameCollapseAllButton.isExpanded = 1;
SkillFrameCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up");
for i=1, numSkills do
local temp, header, isExpanded = GetSkillLineInfo(i);
if ( header ) then
-- If one header is not expanded then set isExpanded to false and break
if ( not isExpanded ) then
SkillFrameCollapseAllButton.isExpanded = nil;
SkillFrameCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up");
break;
end
end
end
-- Hide unused bars
for i=index, SKILLS_TO_DISPLAY do
getglobal("SkillRankFrame"..i):Hide();
getglobal("SkillTypeLabel"..i):Hide();
end
local talentPoints, currSkillPoints = UnitCharacterPoints("player");
-- Update skill points
SkillFrame.UpdatedSkillPoints = GetAdjustedSkillPoints();
-- Update scrollFrame
FauxScrollFrame_Update(SkillListScrollFrame, numSkills, SKILLS_TO_DISPLAY, SKILLFRAME_SKILL_HEIGHT );
SkillDetailFrame_SetStatusBar(GetSelectedSkill(),adjustedSkillPoints)
end
function SkillBar_OnClick (self)
SkillFrame.statusBarClickedID = self:GetParent():GetID() + FauxScrollFrame_GetOffset(SkillListScrollFrame);
SetSelectedSkill(SkillFrame.statusBarClickedID);
SkillFrame.showSkillDetails = 1
SkillFrame_UpdateSkills();
end
| gpl-2.0 |
SirNate0/Urho3D | Source/ThirdParty/toluapp/src/bin/lua/module.lua | 44 | 1479 | -- tolua: module class
-- Written by Waldemar Celes
-- TeCGraf/PUC-Rio
-- Jul 1998
-- $Id: $
-- This code is free software; you can redistribute it and/or modify it.
-- The software provided hereunder is on an "as is" basis, and
-- the author has no obligation to provide maintenance, support, updates,
-- enhancements, or modifications.
-- Module class
-- Represents module.
-- The following fields are stored:
-- {i} = list of objects in the module.
classModule = {
classtype = 'module'
}
classModule.__index = classModule
setmetatable(classModule,classContainer)
-- register module
function classModule:register (pre)
pre = pre or ''
push(self)
output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
local i=1
while self[i] do
self[i]:register(pre..' ')
i = i+1
end
output(pre..'tolua_endmodule(tolua_S);')
pop()
end
-- Print method
function classModule:print (ident,close)
print(ident.."Module{")
print(ident.." name = '"..self.name.."';")
local i=1
while self[i] do
self[i]:print(ident.." ",",")
i = i+1
end
print(ident.."}"..close)
end
-- Internal constructor
function _Module (t)
setmetatable(t,classModule)
append(t)
return t
end
-- Constructor
-- Expects two string representing the module name and body.
function Module (n,b)
local t = _Module(_Container{name=n})
push(t)
t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
pop()
return t
end
| mit |
mortezamosavy999/monster | plugins/plugins.lua | 325 | 6164 | do
-- Returns the key (index) in the config.enabled_plugins table
local function plugin_enabled( name )
for k,v in pairs(_config.enabled_plugins) do
if name == v then
return k
end
end
-- If not found
return false
end
-- Returns true if file exists in plugins folder
local function plugin_exists( name )
for k,v in pairs(plugins_names()) do
if name..'.lua' == v then
return true
end
end
return false
end
local function list_all_plugins(only_enabled)
local text = ''
local nsum = 0
for k, v in pairs( plugins_names( )) do
-- ✔ enabled, ❌ disabled
local status = '❌'
nsum = nsum+1
nact = 0
-- Check if is enabled
for k2, v2 in pairs(_config.enabled_plugins) do
if v == v2..'.lua' then
status = '✔'
end
nact = nact+1
end
if not only_enabled or status == '✔' then
-- get the name
v = string.match (v, "(.*)%.lua")
text = text..nsum..'. '..v..' '..status..'\n'
end
end
local text = text..'\nThere are '..nsum..' plugins installed.\n'..nact..' plugins enabled and '..nsum-nact..' disabled'
return text
end
local function list_plugins(only_enabled)
local text = ''
local nsum = 0
for k, v in pairs( plugins_names( )) do
-- ✔ enabled, ❌ disabled
local status = '❌'
nsum = nsum+1
nact = 0
-- Check if is enabled
for k2, v2 in pairs(_config.enabled_plugins) do
if v == v2..'.lua' then
status = '✔'
end
nact = nact+1
end
if not only_enabled or status == '✔' then
-- get the name
v = string.match (v, "(.*)%.lua")
text = text..v..' '..status..'\n'
end
end
local text = text..'\n'..nact..' plugins enabled from '..nsum..' plugins installed.'
return text
end
local function reload_plugins( )
plugins = {}
load_plugins()
return list_plugins(true)
end
local function enable_plugin( plugin_name )
print('checking if '..plugin_name..' exists')
-- Check if plugin is enabled
if plugin_enabled(plugin_name) then
return 'Plugin '..plugin_name..' is enabled'
end
-- Checks if plugin exists
if plugin_exists(plugin_name) then
-- Add to the config table
table.insert(_config.enabled_plugins, plugin_name)
print(plugin_name..' added to _config table')
save_config()
-- Reload the plugins
return reload_plugins( )
else
return 'Plugin '..plugin_name..' does not exists'
end
end
local function disable_plugin( name, chat )
-- Check if plugins exists
if not plugin_exists(name) then
return 'Plugin '..name..' does not exists'
end
local k = plugin_enabled(name)
-- Check if plugin is enabled
if not k then
return 'Plugin '..name..' not enabled'
end
-- Disable and reload
table.remove(_config.enabled_plugins, k)
save_config( )
return reload_plugins(true)
end
local function disable_plugin_on_chat(receiver, plugin)
if not plugin_exists(plugin) then
return "Plugin doesn't exists"
end
if not _config.disabled_plugin_on_chat then
_config.disabled_plugin_on_chat = {}
end
if not _config.disabled_plugin_on_chat[receiver] then
_config.disabled_plugin_on_chat[receiver] = {}
end
_config.disabled_plugin_on_chat[receiver][plugin] = true
save_config()
return 'Plugin '..plugin..' disabled on this chat'
end
local function reenable_plugin_on_chat(receiver, plugin)
if not _config.disabled_plugin_on_chat then
return 'There aren\'t any disabled plugins'
end
if not _config.disabled_plugin_on_chat[receiver] then
return 'There aren\'t any disabled plugins for this chat'
end
if not _config.disabled_plugin_on_chat[receiver][plugin] then
return 'This plugin is not disabled'
end
_config.disabled_plugin_on_chat[receiver][plugin] = false
save_config()
return 'Plugin '..plugin..' is enabled again'
end
local function run(msg, matches)
-- Show the available plugins
if matches[1] == '!plugins' and is_sudo(msg) then --after changed to moderator mode, set only sudo
return list_all_plugins()
end
-- Re-enable a plugin for this chat
if matches[1] == 'enable' and matches[3] == 'chat' then
local receiver = get_receiver(msg)
local plugin = matches[2]
print("enable "..plugin..' on this chat')
return reenable_plugin_on_chat(receiver, plugin)
end
-- Enable a plugin
if matches[1] == 'enable' and is_sudo(msg) then --after changed to moderator mode, set only sudo
local plugin_name = matches[2]
print("enable: "..matches[2])
return enable_plugin(plugin_name)
end
-- Disable a plugin on a chat
if matches[1] == 'disable' and matches[3] == 'chat' then
local plugin = matches[2]
local receiver = get_receiver(msg)
print("disable "..plugin..' on this chat')
return disable_plugin_on_chat(receiver, plugin)
end
-- Disable a plugin
if matches[1] == 'disable' and is_sudo(msg) then --after changed to moderator mode, set only sudo
if matches[2] == 'plugins' then
return 'This plugin can\'t be disabled'
end
print("disable: "..matches[2])
return disable_plugin(matches[2])
end
-- Reload all the plugins!
if matches[1] == 'reload' and is_sudo(msg) then --after changed to moderator mode, set only sudo
return reload_plugins(true)
end
end
return {
description = "Plugin to manage other plugins. Enable, disable or reload.",
usage = {
moderator = {
"!plugins disable [plugin] chat : disable plugin only this chat.",
"!plugins enable [plugin] chat : enable plugin only this chat.",
},
sudo = {
"!plugins : list all plugins.",
"!plugins enable [plugin] : enable plugin.",
"!plugins disable [plugin] : disable plugin.",
"!plugins reload : reloads all plugins." },
},
patterns = {
"^!plugins$",
"^!plugins? (enable) ([%w_%.%-]+)$",
"^!plugins? (disable) ([%w_%.%-]+)$",
"^!plugins? (enable) ([%w_%.%-]+) (chat)",
"^!plugins? (disable) ([%w_%.%-]+) (chat)",
"^!plugins? (reload)$" },
run = run,
moderated = true, -- set to moderator mode
--privileged = true
}
end | gpl-2.0 |
vnm-interactive/Cinder-KinectSDK | premake5.lua | 2 | 2397 | -- https://github.com/premake/premake-core/wiki
local action = _ACTION or ""
solution "OpenDepthSensor"
location (action)
configurations { "Debug", "Release" }
language "C++"
configuration "vs*"
platforms {"x64"}
defines {
"_CRT_SECURE_NO_WARNINGS",
"_CRT_SECURE_NO_DEPRECATE",
}
cppdialect "C++11"
disablewarnings {
"4244",
"4305",
"4996",
}
staticruntime "On"
configuration "x64"
libdirs {
"lib/msw/x64",
}
targetdir ("lib/msw/x64")
configuration "macosx"
platforms {"x64"}
cppdialect "gnu++11"
sysincludedirs {
"include",
"/usr/local/include/libusb-1.0",
"../../include",
"3rdparty",
"3rdparty/librealsense/include",
"3rdparty/openni2/include",
}
libdirs {
"lib/macosx",
}
targetdir ("lib/macosx")
flags {
"MultiProcessorCompile"
}
configuration "Debug"
defines { "DEBUG" }
symbols "On"
targetsuffix "-d"
configuration "Release"
defines { "NDEBUG" }
optimize "On"
project "OpenDepthSensor"
kind "StaticLib"
includedirs {
"include",
"../../include",
"3rdparty",
"3rdparty/ImiSDK",
"3rdparty/librealsense/include",
"3rdparty/v1/sdk/inc",
"3rdparty/v2/sdk/inc",
"3rdparty/openni2/include",
"3rdparty/k4a",
}
files {
"include/*",
"src/*",
"3rdparty/openni2/**",
"3rdparty/librealsense/include/**",
"3rdparty/librealsense/src/*",
"3rdparty/k4a/*",
}
configuration "vs*"
defines {
"RS_USE_WMF_BACKEND",
}
files {
"3rdparty/v1/**",
"3rdparty/v2/**",
}
configuration "macosx"
defines {
"RS_USE_LIBUVC_BACKEND",
}
files {
"3rdparty/librealsense/src/libuvc/*",
}
| mit |
xuejian1354/barrier_breaker | feeds/routing/luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua | 18 | 2336 | --[[
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
--]]
local sys = require("luci.sys")
local bmx6json = require("luci.model.bmx6json")
m = Map("bmx6", "bmx6")
-- tunOut
local tunnelsOut = m:section(TypedSection,"tunOut",translate("Networks to fetch"),translate("Gateways announcements to fetch"))
tunnelsOut.addremove = true
tunnelsOut.anonymous = true
tunnelsOut:option(Value,"tunOut","Name")
tunnelsOut:option(Value,"network", translate("Network to fetch"))
local tunoptions = bmx6json.getOptions("tunOut")
local _,o
for _,o in ipairs(tunoptions) do
if o.name ~= nil and o.name ~= "network" then
help = bmx6json.getHtmlHelp(o)
value = tunnelsOut:option(Value,o.name,o.name,help)
value.optional = true
end
end
-- tunOut
local tunnelsIn = m:section(TypedSection,"tunIn",translate("Networks to offer"),translate("Gateways to announce in the network"))
tunnelsIn.addremove = true
tunnelsIn.anonymous = true
tunnelsIn:option(Value,"tunIn","Name")
tunnelsIn:option(Value,"network", translate("Network to offer"))
local tunInoptions = bmx6json.getOptions("tunIn")
local _,o
for _,o in ipairs(tunInoptions) do
if o.name ~= nil and o.name ~= "network" then
help = bmx6json.getHtmlHelp(o)
value = tunnelsIn:option(Value,o.name,o.name,help)
value.optional = true
end
end
function m.on_commit(self,map)
--Not working. If test returns error the changes are still commited
local msg = bmx6json.testandreload()
if msg ~= nil then
m.message = msg
end
end
return m
| gpl-2.0 |
nickhen/muforth | mu/target/PIC18/device/chipdefs.lua | 1 | 17832 | -- This file is part of muFORTH: http://muforth.nimblemachines.com/
-- Copyright (c) 2002-2015 David Frech. (Read the LICENSE for details.)
-- Equates for several PIC18 variants, "scraped" from Microchip datasheets.
-- From here we generate muFORTH code!
-- Be careful of pasted in endashes and ligatures!
-- To convert en- and em-dashes to normal (double) dashes, do this (in Vim):
-- :set encoding=utf-8
-- :%s/\%u2013/--/g ( en-dash)
-- :%s/\%u2014/--/g ( em-dash)
-- and for common ligatures, do these:
-- :%s/\%ufb00/ff/g
-- :%s/\%ufb01/fi/g
-- :%s/\%ufb02/fl/g
-- :%s/\%ufb03/ffi/g
-- :%s/\%ufb04/ffl/g
-- Also beware copyright and trademark characters.
-- :%s/\%u2122//g ( tm)
-- 1xK50 chip defs
-- NOTE: Had to change SSPMASK to SSPMSK, to match the reg bits string.
pic_1xk50_reg_addrs = [[
FFFh TOSU FD7h TMR0H FAFh SPBRG F87h --(2) F5Fh UEIR
FFEh TOSH FD6h TMR0L FAEh RCREG F86h --(2) F5Eh UFRMH
FFDh TOSL FD5h T0CON FADh TXREG F85h --(2) F5Dh UFRML
FFCh STKPTR FD4h --(2) FACh TXSTA F84h --(2) F5Ch UADDR
FFBh PCLATU FD3h OSCCON FABh RCSTA F83h --(2) F5Bh UEIE
FFAh PCLATH FD2h OSCCON2 FAAh -- F82h PORTC F5Ah UEP7
FF9h PCL FD1h WDTCON FA9h EEADR F81h PORTB F59h UEP6
FF8h TBLPTRU FD0h RCON FA8h EEDATA F80h PORTA F58h UEP5
FF7h TBLPTRH FCFh TMR1H FA7h EECON2(1) F7Fh ANSELH F57h UEP4
FF6h TBLPTRL FCEh TMR1L FA6h EECON1 F7Eh ANSEL F56h UEP3
FF5h TABLAT FCDh T1CON FA5h --(2) F7Dh --(2) F55h UEP2
FF4h PRODH FCCh TMR2 FA4h --(2) F7Ch --(2) F54h UEP1
FF3h PRODL FCBh PR2 FA3h --(2) F7Bh --(2) F53h UEP0
FF2h INTCON FCAh T2CON FA2h IPR2 F7Ah IOCB
FF1h INTCON2 FC9h SSPBUF FA1h PIR2 F79h IOCA
FF0h INTCON3 FC8h SSPADD FA0h PIE2 F78h WPUB
FEFh INDF0(1) FC7h SSPSTAT F9Fh IPR1 F77h WPUA
FEEh POSTINC0(1) FC6h SSPCON1 F9Eh PIR1 F76h SLRCON
FEDh POSTDEC0(1) FC5h SSPCON2 F9Dh PIE1 F75h --(2)
FECh PREINC0(1) FC4h ADRESH F9Ch --(2) F74h --(2)
FEBh PLUSW0(1) FC3h ADRESL F9Bh OSCTUNE F73h --(2)
FEAh FSR0H FC2h ADCON0 F9Ah --(2) F72h --(2)
FE9h FSR0L FC1h ADCON1 F99h --(2) F71h --(2)
FE8h WREG FC0h ADCON2 F98h --(2) F70h --(2)
FE7h INDF1(1) FBFh CCPR1H F97h --(2) F6Fh SSPMSK
FE6h POSTINC1(1) FBEh CCPR1L F96h --(2) F6Eh --(2)
FE5h POSTDEC1(1) FBDh CCP1CON F95h --(2) F6Dh CM1CON0
FE4h PREINC1(1) FBCh REFCON2 F94h TRISC F6Ch CM2CON1
FE3h PLUSW1(1) FBBh REFCON1 F93h TRISB F6Bh CM2CON0
FE2h FSR1H FBAh REFCON0 F92h TRISA F6Ah --(2)
FE1h FSR1L FB9h PSTRCON F91h --(2) F69h SRCON1
FE0h BSR FB8h BAUDCON F90h --(2) F68h SRCON0
FDFh INDF2(1) FB7h PWM1CON F8Fh --(2) F67h --(2)
FDEh POSTINC2(1) FB6h ECCP1AS F8Eh --(2) F66h --(2)
FDDh POSTDEC2(1) FB5h --(2) F8Dh --(2) F65h --(2)
FDCh PREINC2(1) FB4h --(2) F8Ch --(2) F64h UCON
FDBh PLUSW2(1) FB3h TMR3H F8Bh LATC F63h USTAT
FDAh FSR2H FB2h TMR3L F8Ah LATB F62h UIR
FD9h FSR2L FB1h T3CON F89h LATA F61h UCFG
FD8h STATUS FB0h SPBRGH F88h --(2) F60h UIE
]]
pic_1xk50_reg_bits = [[
TOSU -- -- -- Top-of-Stack Upper Byte (TOS<20:16>) ---0 0000 285, 30
TOSH Top-of-Stack, High Byte (TOS<15:8>) 0000 0000 285, 30
TOSL Top-of-Stack, Low Byte (TOS<7:0>) 0000 0000 285, 30
STKPTR STKFUL STKUNF -- SP4 SP3 SP2 SP1 SP0 00-0 0000 285, 31
PCLATU -- -- -- Holding Register for PC<20:16> ---0 0000 285, 30
PCLATH Holding Register for PC<15:8> 0000 0000 285, 30
PCL PC, Low Byte (PC<7:0>) 0000 0000 285, 30
TBLPTRU -- -- -- Program Memory Table Pointer Upper Byte (TBLPTR<20:16>) ---0 0000 285, 54
TBLPTRH Program Memory Table Pointer, High Byte (TBLPTR<15:8>) 0000 0000 285, 54
TBLPTRL Program Memory Table Pointer, Low Byte (TBLPTR<7:0>) 0000 0000 285, 54
TABLAT Program Memory Table Latch 0000 0000 285, 54
PRODH Product Register, High Byte xxxx xxxx 285, 65
PRODL Product Register, Low Byte xxxx xxxx 285, 65
INTCON GIE/GIEH PEIE/GIEL TMR0IE INT0IE RABIE TMR0IF INT0IF RABIF 0000 000x 285, 70
INTCON2 RABPU INTEDG0 INTEDG1 INTEDG2 -- TMR0IP -- RABIP 1111 -1-1 285, 71
INTCON3 INT2IP INT1IP -- INT2IE INT1IE -- INT2IF INT1IF 11-0 0-00 285, 72
INDF0 Uses contents of FSR0 to address data memory -- value of FSR0 not changed (not a physical register) N/A 285, 47
POSTINC0 Uses contents of FSR0 to address data memory -- value of FSR0 post-incremented (not a physical register) N/A 285, 47
POSTDEC0 Uses contents of FSR0 to address data memory -- value of FSR0 post-decremented (not a physical register) N/A 285, 47
PREINC0 Uses contents of FSR0 to address data memory -- value of FSR0 pre-incremented (not a physical register) N/A 285, 47
PLUSW0 Uses contents of FSR0 to address data memory -- value of FSR0 pre-incremented (not a physical register) -- value of FSR0 offset by W N/A 285, 47
FSR0H -- -- -- -- Indirect Data Memory Address Pointer 0, High Byte ---- 0000 285, 47
FSR0L Indirect Data Memory Address Pointer 0, Low Byte xxxx xxxx 285, 47
WREG Working Register xxxx xxxx 285
INDF1 Uses contents of FSR1 to address data memory -- value of FSR1 not changed (not a physical register) N/A 285, 47
POSTINC1 Uses contents of FSR1 to address data memory -- value of FSR1 post-incremented (not a physical register) N/A 285, 47
POSTDEC1 Uses contents of FSR1 to address data memory -- value of FSR1 post-decremented (not a physical register) N/A 285, 47
PREINC1 Uses contents of FSR1 to address data memory -- value of FSR1 pre-incremented (not a physical register) N/A 285, 47
PLUSW1 Uses contents of FSR1 to address data memory -- value of FSR1 pre-incremented (not a physical register) -- value of FSR1 offset by W N/A 285, 47
FSR1H -- -- -- -- Indirect Data Memory Address Pointer 1, High Byte ---- 0000 286, 47
FSR1L Indirect Data Memory Address Pointer 1, Low Byte xxxx xxxx 286, 47
BSR -- -- -- -- Bank Select Register ---- 0000 286, 35
INDF2 Uses contents of FSR2 to address data memory -- value of FSR2 not changed (not a physical register) N/A 286, 47
POSTINC2 Uses contents of FSR2 to address data memory -- value of FSR2 post-incremented (not a physical register) N/A 286, 47
POSTDEC2 Uses contents of FSR2 to address data memory -- value of FSR2 post-decremented (not a physical register) N/A 286, 47
PREINC2 Uses contents of FSR2 to address data memory -- value of FSR2 pre-incremented (not a physical register) N/A 286, 47
PLUSW2 Uses contents of FSR2 to address data memory -- value of FSR2 pre-incremented (not a physical register) -- value of FSR2 offset by W N/A 286, 47
FSR2H -- -- -- -- Indirect Data Memory Address Pointer 2, High Byte ---- 0000 286, 47
FSR2L Indirect Data Memory Address Pointer 2, Low Byte xxxx xxxx 286, 47
STATUS -- -- -- N OV Z DC C ---x xxxx 286, 45
TMR0H Timer0 Register, High Byte 0000 0000 286, 103
TMR0L Timer0 Register, Low Byte xxxx xxxx 286, 103
T0CON TMR0ON T08BIT T0CS T0SE PSA T0PS2 T0PS1 T0PS0 1111 1111 286, 101
OSCCON IDLEN IRCF2 IRCF1 IRCF0 OSTS IOSF SCS1 SCS0 0011 qq00 286, 20
OSCCON2 -- -- -- -- -- PRI_SD HFIOFL LFIOFS ---- -10x 286, 21
WDTCON -- -- -- -- -- -- -- SWDTEN --- ---0 286, 303
RCON IPEN SBOREN(1) -- RI TO PD POR BOR 0q-1 11q0 277, 284, 79
TMR1H Timer1 Register, High Byte xxxx xxxx 286, 110
TMR1L Timer1 Register, Low Bytes xxxx xxxx 286, 110
T1CON RD16 T1RUN T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON 0000 0000 286, 105
TMR2 Timer2 Register 0000 0000 286, 112
PR2 Timer2 Period Register 1111 1111 286, 112
T2CON -- T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 286, 111
SSPBUF SSP Receive Buffer/Transmit Register xxxx xxxx 286, 143, 144
SSPADD SSP Address Register in I2C Slave Mode. SSP Baud Rate Reload Register in I2C Master Mode. 0000 0000 286, 144
SSPSTAT SMP CKE D/A P S R/W UA BF 0000 0000 286, 137, 146
SSPCON1 WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 286, 137, 146
SSPCON2 GCEN ACKSTAT ACKDT ACKEN RCEN PEN RSEN SEN 0000 0000 286, 147
ADRESH A/D Result Register, High Byte xxxx xxxx 287, 221
ADRESL A/D Result Register, Low Byte xxxx xxxx 287, 221
ADCON0 -- -- CHS3 CHS2 CHS1 CHS0 GO/DONE ADON --00 0000 287, 215
ADCON1 -- -- -- -- PVCFG1 PVCFG0 NVCFG1 NVCFG0 ---- 0000 287, 216
ADCON2 ADFM -- ACQT2 ACQT1 ACQT0 ADCS2 ADCS1 ADCS0 0-00 0000 287, 217
CCPR1H Capture/Compare/PWM Register 1, High Byte xxxx xxxx 287, 138
CCPR1L Capture/Compare/PWM Register 1, Low Byte xxxx xxxx 287, 138
CCP1CON P1M1 P1M0 DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 0000 0000 287, 117
REFCON2 -- -- -- DAC1R4 DAC1R3 DAC1R2 DAC1R1 DAC1R0 ---0 0000 287, 248
REFCON1 D1EN D1LPS DAC1OE --- D1PSS1 D1PSS0 -- D1NSS 000- 00-0 287, 248
REFCON0 FVR1EN FVR1ST FVR1S1 FVR1S0 -- -- -- -- 0001 00-- 287, 247
PSTRCON -- -- -- STRSYNC STRD STRC STRB STRA ---0 0001 287, 134
BAUDCON ABDOVF RCIDL DTRXP CKTXP BRG16 -- WUE ABDEN 0100 0-00 287, 192
PWM1CON PRSEN PDC6 PDC5 PDC4 PDC3 PDC2 PDC1 PDC0 0000 0000 287, 133
ECCP1AS ECCPASE ECCPAS2 ECCPAS1 ECCPAS0 PSSAC1 PSSAC0 PSSBD1 PSSBD0 0000 0000 287, 129
TMR3H Timer3 Register, High Byte xxxx xxxx 287, 115
TMR3L Timer3 Register, Low Byte xxxx xxxx 287, 115
T3CON RD16 -- T3CKPS1 T3CKPS0 T3CCP1 T3SYNC TMR3CS TMR3ON 0-00 0000 287, 113
SPBRGH EUSART Baud Rate Generator Register, High Byte 0000 0000 287, 181
SPBRG EUSART Baud Rate Generator Register, Low Byte 0000 0000 287, 181
RCREG EUSART Receive Register 0000 0000 287, 182
TXREG EUSART Transmit Register 0000 0000 287, 181
TXSTA CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 0000 0010 287, 190
RCSTA SPEN RX9 SREN CREN ADDEN FERR OERR RX9D 0000 000x 287, 191
EEADR EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 287, 52, 61
EEDATA EEPROM Data Register 0000 0000 287, 52, 61
EECON2 EEPROM Control Register 2 (not a physical register) 0000 0000 287, 52, 61
EECON1 EEPGD CFGS -- FREE WRERR WREN WR RD xx-0 x000 287, 53, 61
IPR2 OSCFIP C1IP C2IP EEIP BCLIP USBIP TMR3IP -- 1111 111- 288, 78
PIR2 OSCFIF C1IF C2IF EEIF BCLIF USBIF TMR3IF -- 0000 000- 288, 74
PIE2 OSCFIE C1IE C2IE EEIE BCLIE USBIE TMR3IE -- 0000 000- 288, 76
IPR1 -- ADIP RCIP TXIP SSPIP CCP1IP TMR2IP TMR1IP -111 1111 288, 77
PIR1 -- ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF -000 0000 288, 73
PIE1 -- ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE -000 0000 288, 75
OSCTUNE INTSRC SPLLEN TUN5 TUN4 TUN3 TUN2 TUN1 TUN0 0000 0000 22, 288
TRISC TRISC7 TRISC6 TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 1111 1111 288, 94
TRISB TRISB7 TRISB6 TRISB5 TRISB4 -- -- -- -- 1111 ---- 288, 89
TRISA -- -- TRISA5 TRISA4 -- -- -- -- --11 ---- 288, 83
LATC LATC7 LATC6 LATC5 LATC4 LATC3 LATC2 LATC1 LATC0 xxxx xxxx 288, 94
LATB LATB7 LATB6 LATB5 LATB4 -- -- -- -- xxxx ---- 288, 89
LATA -- -- LATA5 LATA4 -- -- -- -- --xx ---- 288, 83
PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 xxxx xxxx 288, 94
PORTB RB7 RB6 RB5 RB4 -- -- -- -- xxxx ---- 288, 89
PORTA -- -- RA5 RA4 RA3(2) -- RA1(3) RA0(3) --xx x-xx 288, 83
ANSELH -- -- -- -- ANS11 ANS10 ANS9 ANS8 ---- 1111 288, 99
ANSEL ANS7 ANS6 ANS5 ANS4 ANS3 -- -- -- 1111 1--- 288, 98
IOCB IOCB7 IOCB6 IOCB5 IOCB4 -- -- -- -- 0000 ---- 288, 89
IOCA -- -- IOCA5 IOCA4 IOCA3 -- IOCA1 IOCA0 --00 0-00 288, 83
WPUB WPUB7 WPUB6 WPUB5 WPUB4 -- -- -- -- 1111 ---- 288, 89
WPUA -- -- WPUA5 WPUA4 WPUA3 -- -- -- --11 1--- 285, 89
SLRCON -- -- -- -- -- SLRC SLRB SLRA ---- -111 288, 100
SSPMSK MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0 1111 1111 288, 154
CM1CON0 C1ON C1OUT C1OE C1POL C1SP C1R C1CH1 C1CH0 0000 1000 288, 229
CM2CON1 MC1OUT MC2OUT C1RSEL C2RSEL C1HYS C2HYS C1SYNC C2SYNC 0000 0000 288, 230
CM2CON0 C2ON C2OUT C2OE C2POL C2SP C2R C2CH1 C2CH0 0000 1000 288, 230
SRCON1 SRSPE SRSCKE SRSC2E SRSC1E SRRPE SRRCKE SRRC2E SRRC1E 0000 0000 288, 243
SRCON0 SRLEN SRCLK2 SRCLK1 SRCLK0 SRQEN SRNQEN SRPS SRPR 0000 0000 288, 242
UCON -- PPBRST SE0 PKTDIS USBEN RESUME SUSPND -- -0x0 000- 288, 252
USTAT -- ENDP3 ENDP2 ENDP1 ENDP0 DIR PPBI -- -xxx xxx- 289, 256
UIR -- SOFIF STALLIF IDLEIF TRNIF ACTVIF UERRIF URSTIF -000 0000 289, 266
UCFG UTEYE -- -- UPUEN -- FSEN PPB1 PPB0 0--0 -000 289, 254
UIE -- SOFIE STALLIE IDLEIE TRNIE ACTVIE UERRIE URSTIE -000 0000 289, 268
UEIR BTSEF -- -- BTOEF DFN8EF CRC16EF CRC5EF PIDEF 0--0 0000 289, 269
UFRMH -- -- -- -- -- FRM10 FRM9 FRM8 ---- -xxx 289, 252
UFRML FRM7 FRM6 FRM5 FRM4 FRM3 FRM2 FRM1 FRM0 xxxx xxxx 289, 252
UADDR -- ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 ADDR0 -000 0000 289, 258
UEIE BTSEE -- -- BTOEE DFN8EE CRC16EE CRC5EE PIDEE 0--0 0000 289, 270
UEP7 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP6 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP5 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP4 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP3 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP2 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP1 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 289, 257
UEP0 -- -- -- EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000 285, 257
]]
pic_1xk50_configs = [[
300000h CONFIG1L -- -- USBDIV CPUDIV1 CPUDIV0 -- -- -- --00 0---
300001h CONFIG1H IESO FCMEN PCLKEN PLLEN FOSC3 FOSC2 FOSC1 FOSC0 0010 0111
300002h CONFIG2L -- -- -- BORV1 BORV0 BOREN1 BOREN0 PWRTEN ---1 1111
300003h CONFIG2H -- -- -- WDTPS3 WDTPS2 WDTPS1 WDTPS0 WDTEN ---1 1111
300005h CONFIG3H MCLRE -- -- -- HFOFST -- -- -- 1--- 1---
300006h CONFIG4L BKBUG(2) ENHCPU -- -- BBSIZ LVP -- STVREN -0-- 01-1
300008h CONFIG5L -- -- -- -- -- -- CP1 CP0 ---- --11
300009h CONFIG5H CPD CPB -- -- -- -- -- -- 11-- ----
30000Ah CONFIG6L -- -- -- -- -- -- WRT1 WRT0 ---- --11
30000Bh CONFIG6H WRTD WRTB WRTC -- -- -- -- -- 111- ----
30000Ch CONFIG7L -- -- -- -- -- -- EBTR1 EBTR0 ---- --11
30000Dh CONFIG7H -- EBTRB -- -- -- -- -- -- -1-- ----
3FFFFEh DEVID1(1) DEV2 DEV1 DEV0 REV4 REV3 REV2 REV1 REV0 qqqq qqqq(1)
3FFFFFh DEVID2(1) DEV10 DEV9 DEV8 DEV7 DEV6 DEV5 DEV4 DEV3 0000 1100
]]
dofile 'target/HC08/device/string.lua'
-- S08
-- UNUSED currently for PIC18
function show_vectors(v)
vt = {}
name_max = 0 -- width of name field
for addr, desc, name in v:gmatch("(0x%x+):0?x?%x+ ([%w ]-) ([%w%-]+)%s-\n") do
if desc ~= "Reserved" then
table.insert(vt, 1, { addr=addr, desc=desc, name=name })
end
if #name > name_max then name_max = #name end
--print (addr, desc, name)
end
--print (name_max)
for _,vec in ipairs(vt) do
-- print(string.format("#%02d %05x vec %s ( %s)",
-- 0x10000-vec.addr, vec.addr, vec.name..(" "):rep(name_max-#vec.name), vec.desc))
print(string.format("%05x vector %s ( %s)",
vec.addr, vec.name..(" "):rep(name_max-#vec.name), vec.desc))
end
print()
end
function show_regs(reg_addrs, reg_bits, configs)
local reg2addr = {}
-- Some lines have five reg/addr pairs; some have four
-- FFFh TOSU FD7h TMR0H FAFh SPBRG F87h --(2) F5Fh UEIR
-- FD8h STATUS FB0h SPBRGH F88h --(2) F60h UIE
local function read_addrs(l)
if l:match "^%s*$" then return end -- skip whitespace-only lines
local firstpair = "(%x+)h ([%w_-]+)"
local pair = " " .. firstpair
local a1, r1, a2, r2, a3, r3, a4, r4, a5, r5 =
l:match(firstpair .. pair:rep(4))
if a1 then
-- print(a1, r1, a2, r2, a3, r3, a4, r4, a5, r5)
reg2addr[r1] = a1
reg2addr[r2] = a2
reg2addr[r3] = a3
reg2addr[r4] = a4
reg2addr[r5] = a5
else
a1, r1, a2, r2, a3, r3, a4, r4, a5, r5 =
l:match(firstpair .. (pair):rep(3))
if a1 then
-- print(a1, r1, a2, r2, a3, r3, a4, r4)
reg2addr[r1] = a1
reg2addr[r2] = a2
reg2addr[r3] = a3
reg2addr[r4] = a4
else
print "Something went wrong reading the reg addresses"
end
end
end
local function addr(reg)
return "0x" .. reg2addr[reg]
end
-- Example of register definitions with 8 bit names following:
-- EEADR EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 287, 52, 61
-- EECON1 EEPGD CFGS -- FREE WRERR WREN WR RD xx-0 x000 287, 53, 61
-- Examples that don't have 8 bit names:
-- EEDATA EEPROM Data Register 0000 0000 287, 52, 61
-- EECON2 EEPROM Control Register 2 (not a physical register) 0000 0000 287, 52, 61
local function show_reg(l)
if l:match "^%s*$" then return end -- skip whitespace-only lines
local pat = "([%w_]+)" .. (" ([%u%d/_-]+)"):rep(8)
local reg, b7, b6, b5, b4, b3, b2, b1, b0 = l:match(pat)
if reg then
print (string.format("%04x reg %-8s | "..("%-7s "):rep(8),
addr(reg), reg, b7, b6, b5, b4, b3, b2, b1, b0))
return
end
reg, desc = l:match "([%w_]+) (.+)"
print (string.format("%04x reg %-8s | %s", addr(reg), reg, desc))
end
-- 300000h CONFIG1L -- -- USBDIV CPUDIV1 CPUDIV0 -- -- -- --00 0---
local function show_config(l)
if l:match "^%s*$" then return end -- skip whitespace-only lines
local pat = "(%x+)h ([%w_]+)" .. (" ([%u%d/_-]+)"):rep(8)
local addr, reg, b7, b6, b5, b4, b3, b2, b1, b0 = l:match(pat)
if addr then
print (string.format("%06x reg %-8s | "..("%-7s "):rep(8),
"0x"..addr, reg, b7, b6, b5, b4, b3, b2, b1, b0))
return
end
print("Failed to match config: ", l)
end
local function drop_footnotes(s)
s = s:gsub("%(%d+%)", "")
return s
end
for l in reg_addrs:lines() do
read_addrs(drop_footnotes(l))
end
for l in reg_bits:lines() do
show_reg(drop_footnotes(l))
end
print()
for l in configs:lines() do
show_config(drop_footnotes(l))
end
end
function show_heading(s)
print (string.format(
"( Equates for PIC18F%s. Extracted from the datasheet using Lua!)", s))
print()
end
function show_part(name, reg_addrs, reg_bits, configs)
show_heading(name)
show_regs(reg_addrs, reg_bits, configs)
end
show_part("1xK50", pic_1xk50_reg_addrs, pic_1xk50_reg_bits, pic_1xk50_configs)
| bsd-3-clause |
xponen/Zero-K | units/corak.lua | 1 | 6375 | unitDef = {
unitname = [[corak]],
name = [[Bandit]],
description = [[Medium-Light Raider Bot]],
acceleration = 0.5,
brakeRate = 0.4,
buildCostEnergy = 75,
buildCostMetal = 75,
buildPic = [[CORAK.png]],
buildTime = 75,
canAttack = true,
canGuard = true,
canMove = true,
canPatrol = true,
category = [[LAND]],
collisionVolumeOffsets = [[0 0 0]],
collisionVolumeScales = [[24 29 24]],
collisionVolumeType = [[cylY]],
corpse = [[DEAD]],
customParams = {
description_bp = [[Robô agressor]],
description_es = [[Robot de invasión]],
description_fr = [[Robot Pilleur]],
description_it = [[Robot d'invasione]],
description_de = [[Mittel-leichter Raider Roboter]],
description_pl = [[Lekki bot]],
helptext = [[The Bandit outranges and is somewhat tougher than the Glaive, but still not something that you hurl against entrenched forces. Counter with riot units and LLTs.]],
helptext_bp = [[O AK é um rob? agressor. ? um pouco mais forte que seu equivalente de Nova, mas ainda algo que voç? n?o envia contra forças entrincheiradas. Defenda-se dele com unidades dispersadoras e torres de laser leve.]],
helptext_es = [[Como unidad de invasión, el Bandit sacrifica poder de fuego en favor de supervivencia. es un poco mas resistente de su euivalente Nova, pero como quiera no es para lanzarlo en contra de enemigos atrincherados. Se contrastan con unidades de alboroto y llt.]],
helptext_fr = [[Le Bandit est plus puissant que sa contre partie ennemie, le Glaive. Il n'est cependant pas tr?s puissant et ne passera pas contre quelques d?fenses: LLT ou ?meutiers. ]],
helptext_it = [[Come unita d'invasione, il Bandit sacrifica potenza di fuoco per sopravvivenza. ? pi? resistente del suo equivalente Nova, ma comnque non ? da mandare contro nemici ben difesi. Si contrastano con unita da rissa ed llt.]],
helptext_de = [[Als Raider opfert der Bandit die rohe Feuerkraft der Überlebensfähigkeit. Er ist etwas stärker als der Glaive, aber immer noch nicht stark genug, um gegen größere Kräfte zu bestehen. Mit Rioteinheiten und LLT entgegenwirken.]],
helptext_pl = [[Bandit jest szybkim i lekkim botem - jest troche wytrzymalszy niz jego odpowiednik Glaive. Nie jest jednak na tyle mocny, by mozna go bylo uzywac przeciwko obwarowanym przeciwnikom. Przegrywa w bezposrednim starciu z jednostkami wsparcia i wiezyczkami.]],
modelradius = [[12]],
},
explodeAs = [[SMALL_UNITEX]],
footprintX = 2,
footprintZ = 2,
iconType = [[walkerraider]],
idleAutoHeal = 5,
idleTime = 1800,
leaveTracks = true,
maxDamage = 250,
maxSlope = 36,
maxVelocity = 3,
maxWaterDepth = 22,
minCloakDistance = 75,
movementClass = [[KBOT2]],
noChaseCategory = [[TERRAFORM FIXEDWING SUB]],
objectName = [[mbot.s3o]],
script = [[corak.lua]],
seismicSignature = 4,
selfDestructAs = [[SMALL_UNITEX]],
sfxtypes = {
explosiongenerators = {
[[custom:BEAMWEAPON_MUZZLE_RED]],
},
},
sightDistance = 500,
trackOffset = 0,
trackStrength = 8,
trackStretch = 1,
trackType = [[ComTrack]],
trackWidth = 18,
turnRate = 2500,
upright = true,
weapons = {
{
def = [[LASER]],
badTargetCategory = [[FIXEDWING]],
onlyTargetCategory = [[FIXEDWING LAND SINK TURRET SHIP SWIM FLOAT GUNSHIP HOVER]],
},
},
weaponDefs = {
LASER = {
name = [[Laser Blaster]],
areaOfEffect = 8,
beamWeapon = true,
coreThickness = 0.5,
craterBoost = 0,
craterMult = 0,
damage = {
default = 9.77,
planes = 9.77,
subs = 0.61,
},
duration = 0.02,
explosionGenerator = [[custom:BEAMWEAPON_HIT_RED]],
fireStarter = 50,
heightMod = 1,
impactOnly = true,
impulseBoost = 0,
impulseFactor = 0.4,
interceptedByShieldType = 1,
noSelfDamage = true,
range = 245,
reloadtime = 0.1,
rgbColor = [[1 0 0]],
soundHit = [[weapon/laser/lasercannon_hit]],
soundStart = [[weapon/laser/small_laser_fire2]],
soundTrigger = true,
targetMoveError = 0.15,
thickness = 2.55,
tolerance = 10000,
turret = true,
weaponType = [[LaserCannon]],
weaponVelocity = 880,
},
},
featureDefs = {
DEAD = {
description = [[Wreckage - Bandit]],
blocking = false,
damage = 250,
energy = 0,
featureDead = [[DEAD2]],
footprintX = 2,
footprintZ = 2,
metal = 30,
object = [[mbot_d.s3o]],
reclaimable = true,
reclaimTime = 30,
},
DEAD2 = {
description = [[Debris - Bandit]],
blocking = false,
damage = 250,
energy = 0,
featureDead = [[HEAP]],
footprintX = 2,
footprintZ = 2,
metal = 30,
object = [[debris2x2b.s3o]],
reclaimable = true,
reclaimTime = 30,
},
HEAP = {
description = [[Debris - Bandit]],
blocking = false,
damage = 250,
energy = 0,
footprintX = 2,
footprintZ = 2,
metal = 15,
object = [[debris2x2b.s3o]],
reclaimable = true,
reclaimTime = 15,
},
},
}
return lowerkeys({ corak = unitDef })
| gpl-2.0 |
rogerpueyo/luci | applications/luci-app-mwan3/luasrc/model/cbi/mwan/notify.lua | 7 | 1813 | -- Copyright 2014 Aedan Renner <chipdankly@gmail.com>
-- Copyright 2018 Florian Eckert <fe@dev.tdt.de>
-- Licensed to the public under the GNU General Public License v2.
local fs = require "nixio.fs"
local ut = require "luci.util"
local script = "/etc/mwan3.user"
local m, f, t
m = SimpleForm("luci", translate("MWAN - Notification"))
f = m:section(SimpleSection, nil,
translate("This section allows you to modify the content of \"/etc/mwan3.user\".<br />" ..
"The file is also preserved during sysupgrade.<br />" ..
"<br />" ..
"Notes:<br />" ..
"This file is interpreted as a shell script.<br />" ..
"The first line of the script must be "#!/bin/sh" without quotes.<br />" ..
"Lines beginning with # are comments and are not executed.<br />" ..
"Put your custom mwan3 action here, they will<br />" ..
"be executed with each netifd hotplug interface event<br />" ..
"on interfaces for which mwan3 is enabled.<br />" ..
"<br />" ..
"There are three main environment variables that are passed to this script.<br />" ..
"<br />" ..
"$ACTION <br />" ..
"* \"ifup\" Is called by netifd and mwan3track <br />" ..
"* \"ifdown\" Is called by netifd and mwan3track <br />" ..
"* \"connected\" Is only called by mwan3track if tracking was successful <br />" ..
"* \"disconnected\" Is only called by mwan3track if tracking has failed <br />" ..
"$INTERFACE Name of the interface which went up or down (e.g. \"wan\" or \"wwan\")<br />" ..
"$DEVICE Physical device name which interface went up or down (e.g. \"eth0\" or \"wwan0\")<br />" ..
"<br />"))
t = f:option(TextValue, "lines")
t.rmempty = true
t.rows = 20
function t.cfgvalue()
return fs.readfile(script)
end
function t.write(self, section, data)
return fs.writefile(script, ut.trim(data:gsub("\r\n", "\n")) .. "\n")
end
return m
| apache-2.0 |
Zephruz/citadelshock | gamemode/core/cl_chatcommands.lua | 1 | 1246 | --[[-----------------------------------
CHAT COMMANDS
- Chat command registration
- Also adds a console command
--------------------------------------]]
CitadelShock.CMDS = {}
function CitadelShock:RegisterCommand(cmd, func, desc)
self.CMDS[cmd] = {func = func, desc = (desc or false)}
concommand.Add(cmd, func)
end
hook.Add("OnPlayerChat", "CIS.Hook.Menu.OnPlayerChat",
function( p, cmd, to, dead )
if (p == LocalPlayer()) then
for k,v in pairs(CitadelShock.CMDS) do
if ("!" .. k == cmd) then v.func() return true end
end
end
end)
-- [[COMMANDS]]
CitadelShock:RegisterCommand("leavegame",
function() LocalPlayer():LeaveLobby() end,
"Leaves your current game")
CitadelShock:RegisterCommand("ready",
function()
local ply = LocalPlayer()
local rs = ply:GetReady()
ply:SetReady((!rs && true || rs && false))
end,
"Sets your ready status to ready/not ready")
CitadelShock:RegisterCommand("unspectate",
function()
local ply = LocalPlayer()
local specGame = ply:GetSpectatedGame()
if (specGame == -1) then return false end
local lobby = CitadelShock.Lobby:FindByID(specGame)
if !(lobby) then return false end
lobby:UnSpectate()
end,
"Stops you from spectating") | mit |
xponen/Zero-K | units/armsolar.lua | 1 | 3932 | unitDef = {
unitname = [[armsolar]],
name = [[Solar Collector]],
description = [[Produces Energy (2)]],
acceleration = 0,
activateWhenBuilt = true,
brakeRate = 0,
buildAngle = 4096,
buildCostEnergy = 70,
buildCostMetal = 70,
builder = false,
buildingGroundDecalDecaySpeed = 30,
buildingGroundDecalSizeX = 4,
buildingGroundDecalSizeY = 4,
buildingGroundDecalType = [[arm_solar_ground.dds]],
buildPic = [[ARMSOLAR.png]],
buildTime = 70,
category = [[SINK UNARMED STUPIDTARGET]],
corpse = [[DEAD]],
customParams = {
description_de = [[Erzeugt Energie (2)]],
description_pl = [[Produkuje Energię (2)]],
helptext = [[Solar collectors are the least cost-efficient of the energy structures, but they are also the most reliable and sturdy. When attacked, solars will curl up into armored form for 8 seconds, which reduces incoming damage to a quarter and offers excellent protection against raiders.]],
helptext_de = [[Solaranlagen sind von den Energiestrukturen die mit der geringsten Kosteneffizienz, aber sie sind auch die verlässlichsten und stabilsten unter ihnen. Sobald sie angegriffen werden ziehen sie sich in eine gepanzerte Form fur 8 Sekunden zurück, die als exzellenter Schutz gegen Raider fungiert.]],
helptext_pl = [[Choc panele sloneczne to najmniej efektywne sposrod elektrowni, sa jednak tanie, wytrzymale i niezawodne. Swietna ochrone zapewnia im mozliwosc zamkniecia sie, co sprawia, ze otrzymuja tylko cwierc obrazen. Zaatakowane, automatycznie zamykaja sie na 8 sekund.]],
pylonrange = 100,
aimposoffset = [[0 16 0]],
midposoffset = [[0 0 0]],
},
damageModifier = 0.25,
energyMake = 0,
energyUse = -2,
explodeAs = [[SMALL_BUILDINGEX]],
footprintX = 5,
footprintZ = 5,
iconType = [[energy_med]],
idleAutoHeal = 5,
idleTime = 1800,
mass = 104,
maxDamage = 500,
maxSlope = 18,
maxVelocity = 0,
maxWaterDepth = 0,
minCloakDistance = 150,
noAutoFire = false,
objectName = [[arm_solar.s3o]],
onoffable = true,
script = [[armsolar.lua]],
seismicSignature = 4,
selfDestructAs = [[SMALL_BUILDINGEX]],
side = [[ARM]],
sightDistance = 273,
turnRate = 0,
useBuildingGroundDecal = true,
workerTime = 0,
yardMap = [[ooooooooooooooooooooooooo]],
featureDefs = {
DEAD = {
description = [[Wreckage - Solar Collector]],
blocking = true,
damage = 500,
energy = 0,
featureDead = [[HEAP]],
footprintX = 5,
footprintZ = 5,
metal = 28,
object = [[arm_solar_dead.s3o]],
reclaimable = true,
reclaimTime = 28,
},
HEAP = {
description = [[Debris - Solar Collector]],
blocking = false,
damage = 500,
energy = 0,
footprintX = 5,
footprintZ = 5,
metal = 14,
object = [[debris4x4a.s3o]],
reclaimable = true,
reclaimTime = 14,
},
},
}
return lowerkeys({ armsolar = unitDef })
| gpl-2.0 |
Danteoriginal/pvpgn-lua | lua/include/file.lua | 7 | 1528 | --[[
Copyright (C) 2014 HarpyWar (harpywar@gmail.com)
This file is a part of the PvPGN Project http://pvpgn.pro
Licensed under the same terms as Lua itself.
]]--
-- Read file line by line
-- callback 2 is optional
-- You can process line with function callback1(line, callback2)
function file_load(filename, callback1, callback2)
local file = io.open(filename, "r")
if file then
for line in file:lines() do
if callback2 then
callback1(line, callback2)
else
callback1(line)
end
end
file.close(file)
TRACE("File read " .. filename)
else
ERROR("Could not open file " .. filename)
return false
end
return true
end
-- (callback) for "file_load" to load file with each line format like "key = value"
function file_load_dictionary_callback(line, callback)
if string:empty(line) then return 0 end
local idx = 0
local a, b
for v in string.split(line, "=") do
if idx == 0 then
a = string:trim(v)
else
b = string:trim(v)
end
idx = idx + 1
end
if not string:empty(b) and not string:empty(a) then
callback(a, b)
end
end
-- Save raw text "data" into a filename
function file_save(data, filename)
local file = io.open(filename, "w")
file:write(data)
file:close()
end
-- Save file using callback
function file_save2(filename, callback)
local file = io.open(filename, "w")
callback(file)
file:close()
end
-- Check file for exist
function file_exists(filename)
local f=io.open(filename, "r")
if f~=nil then io.close(f) return true else return false end
end
| gpl-2.0 |
Vermeille/kong | kong/kong.lua | 2 | 4908 | -- Kong, the biggest ape in town
--
-- /\ ____
-- <> ( oo )
-- <>_| ^^ |_
-- <> @ \
-- /~~\ . . _ |
-- /~~~~\ | |
-- /~~~~~~\/ _| |
-- |[][][]/ / [m]
-- |[][][[m]
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[][][]|
-- |[|--|]|
-- |[| |]|
-- ========
-- ==========
-- |[[ ]]|
-- ==========
require("kong.core.globalpatches")()
local core = require "kong.core.handler"
local Serf = require "kong.serf"
local utils = require "kong.tools.utils"
local Events = require "kong.core.events"
local singletons = require "kong.singletons"
local DAOFactory = require "kong.dao.factory"
local plugins_iterator = require "kong.core.plugins_iterator"
local ipairs = ipairs
local function attach_hooks(events, hooks)
for k, v in pairs(hooks) do
events:subscribe(k, v)
end
end
local function load_plugins(kong_conf, dao, events)
local in_db_plugins, sorted_plugins = {}, {}
ngx.log(ngx.DEBUG, "Discovering used plugins")
local rows, err_t = dao.plugins:find_all()
if not rows then return nil, tostring(err_t) end
for _, row in ipairs(rows) do in_db_plugins[row.name] = true end
-- check all plugins in DB are enabled/installed
for plugin in pairs(in_db_plugins) do
if not kong_conf.plugins[plugin] then
return nil, plugin.." plugin is in use but not enabled"
end
end
-- load installed plugins
for plugin in pairs(kong_conf.plugins) do
local ok, handler = utils.load_module_if_exists("kong.plugins."..plugin..".handler")
if not ok then
return nil, plugin.." plugin is enabled but not installed;\n"..handler
end
local ok, schema = utils.load_module_if_exists("kong.plugins."..plugin..".schema")
if not ok then
return nil, "no configuration schema found for plugin: "..plugin
end
ngx.log(ngx.DEBUG, "Loading plugin: "..plugin)
sorted_plugins[#sorted_plugins+1] = {
name = plugin,
handler = handler(),
schema = schema
}
-- Attaching hooks
local ok, hooks = utils.load_module_if_exists("kong.plugins."..plugin..".hooks")
if ok then
attach_hooks(events, hooks)
end
end
-- sort plugins by order of execution
table.sort(sorted_plugins, function(a, b)
local priority_a = a.handler.PRIORITY or 0
local priority_b = b.handler.PRIORITY or 0
return priority_a > priority_b
end)
-- add reports plugin if not disabled
if kong_conf.anonymous_reports then
local reports = require "kong.core.reports"
reports.toggle(true)
sorted_plugins[#sorted_plugins+1] = {
name = "reports",
handler = reports
}
end
return sorted_plugins
end
-- Kong public context handlers.
-- @section kong_handlers
local Kong = {}
function Kong.init()
local pl_path = require "pl.path"
local conf_loader = require "kong.conf_loader"
-- retrieve kong_config
local conf_path = pl_path.join(ngx.config.prefix(), "kong.conf")
local config = assert(conf_loader(conf_path))
local events = Events() -- retrieve node plugins
local dao = DAOFactory(config, events) -- instanciate long-lived DAO
assert(dao:run_migrations()) -- migrating in case embedded in custom nginx
-- populate singletons
singletons.loaded_plugins = assert(load_plugins(config, dao, events))
singletons.serf = Serf.new(config, dao)
singletons.dao = dao
singletons.events = events
singletons.configuration = config
attach_hooks(events, require "kong.core.hooks")
end
function Kong.init_worker()
-- special math.randomseed from kong.core.globalpatches
-- not taking any argument. Must be called only once
-- and in the init_worker phase, to avoid duplicated
-- seeds.
math.randomseed()
core.init_worker.before()
singletons.dao:init() -- Executes any initialization by the DB
for _, plugin in ipairs(singletons.loaded_plugins) do
plugin.handler:init_worker()
end
end
function Kong.ssl_certificate()
core.certificate.before()
for plugin, plugin_conf in plugins_iterator(singletons.loaded_plugins, true) do
plugin.handler:certificate(plugin_conf)
end
end
function Kong.access()
core.access.before()
for plugin, plugin_conf in plugins_iterator(singletons.loaded_plugins, true) do
plugin.handler:access(plugin_conf)
end
core.access.after()
end
function Kong.header_filter()
core.header_filter.before()
for plugin, plugin_conf in plugins_iterator(singletons.loaded_plugins) do
plugin.handler:header_filter(plugin_conf)
end
core.header_filter.after()
end
function Kong.body_filter()
for plugin, plugin_conf in plugins_iterator(singletons.loaded_plugins) do
plugin.handler:body_filter(plugin_conf)
end
core.body_filter.after()
end
function Kong.log()
for plugin, plugin_conf in plugins_iterator(singletons.loaded_plugins) do
plugin.handler:log(plugin_conf)
end
core.log.after()
end
return Kong
| apache-2.0 |
Elanis/SciFi-Pack-Addon-Gamemode | gamemodes/scifipack/entities/entities/gmod_cameraprop.lua | 3 | 4393 |
AddCSLuaFile()
if ( CLIENT ) then
CreateConVar( "cl_drawcameras", "1", 0, "Should the cameras be visible?" )
end
ENT.Type = "anim"
ENT.Spawnable = false
ENT.RenderGroup = RENDERGROUP_BOTH
local CAMERA_MODEL = Model( "models/dav0r/camera.mdl" )
function ENT:SetupDataTables()
self:NetworkVar( "Int", 0, "Key" );
self:NetworkVar( "Bool", 0, "On" );
self:NetworkVar( "Vector", 0, "vecTrack" );
self:NetworkVar( "Entity", 0, "entTrack" );
self:NetworkVar( "Entity", 1, "Player" );
end
--[[---------------------------------------------------------
Name: Initialize
-----------------------------------------------------------]]
function ENT:Initialize()
if ( SERVER ) then
self:SetModel( CAMERA_MODEL )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:DrawShadow( false )
-- Don't collide with the player
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
local phys = self:GetPhysicsObject()
if ( phys:IsValid() ) then
phys:Sleep()
end
end
end
function ENT:SetTracking( Ent, LPos )
if ( Ent:IsValid() ) then
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_BBOX )
else
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
end
self:NextThink( CurTime() )
self:SetvecTrack( LPos );
self:SetentTrack( Ent );
end
function ENT:SetLocked( locked )
if ( locked == 1 ) then
self.PhysgunDisabled = true
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_BBOX )
self:SetCollisionGroup( COLLISION_GROUP_WORLD )
else
self.PhysgunDisabled = false
end
self.locked = locked
end
--[[---------------------------------------------------------
Name: OnTakeDamage
-----------------------------------------------------------]]
function ENT:OnTakeDamage( dmginfo )
if ( self.locked ) then return end
self:TakePhysicsDamage( dmginfo )
end
local function Toggle( player )
local toggle = self:GetToggle()
if ( player.UsingCamera && player.UsingCamera == self.Entity ) then
player:SetViewEntity( player )
player.UsingCamera = nil
self.UsingPlayer = nil
else
player:SetViewEntity( self.Entity )
player.UsingCamera = self.Entity
self.UsingPlayer = player
end
end
function ENT:OnRemove()
if ( IsValid( self.UsingPlayer ) ) then
self.UsingPlayer:SetViewEntity( self.UsingPlayer )
end
end
if ( SERVER ) then
numpad.Register( "Camera_On", function ( pl, ent )
if ( !IsValid( ent ) ) then return false end
pl:SetViewEntity( ent )
pl.UsingCamera = ent
ent.UsingPlayer = pl
end )
numpad.Register( "Camera_Toggle", function ( pl, ent, idx, buttoned )
-- The camera was deleted or something - return false to remove this entry
if ( !IsValid( ent ) ) then return false end
if ( !IsValid( pl ) ) then return false end
-- Something else changed players view entity
if ( pl.UsingCamera && pl.UsingCamera == ent && pl:GetViewEntity() != ent ) then
pl.UsingCamera = nil
ent.UsingPlayer = nil
end
if ( pl.UsingCamera && pl.UsingCamera == ent ) then
pl:SetViewEntity( pl )
pl.UsingCamera = nil
ent.UsingPlayer = nil
else
pl:SetViewEntity( ent )
pl.UsingCamera = ent
ent.UsingPlayer = pl
end
end )
numpad.Register( "Camera_Off", function( pl, ent )
if ( !IsValid( ent ) ) then return false end
if ( pl.UsingCamera && pl.UsingCamera == ent ) then
pl:SetViewEntity( pl )
pl.UsingCamera = nil
ent.UsingPlayer = nil
end
end )
end
function ENT:Think()
if ( CLIENT ) then
self:TrackEntity( self:GetentTrack(), self:GetvecTrack() )
end
end
function ENT:TrackEntity( ent, lpos )
if ( !ent || !ent:IsValid() ) then return end
local WPos = ent:LocalToWorld( lpos )
if ( ent:IsPlayer() ) then
WPos = WPos + Vector( 0, 0, 54 )
end
local CamPos = self:GetPos()
local Ang = WPos - CamPos
Ang = Ang:Angle()
self:SetAngles(Ang)
end
function ENT:CanTool( ply, trace, mode )
if ( self:GetMoveType() == MOVETYPE_NONE ) then return false end
return true
end
function ENT:Draw()
if ( GetConVarNumber( "cl_drawcameras" ) == 0 ) then return end
-- Don't draw the camera if we're taking pics
local ply = LocalPlayer()
local wep = ply:GetActiveWeapon()
if ( wep:IsValid() ) then
if ( wep:GetClass() == "gmod_camera" ) then return end
end
self:DrawModel()
end | gpl-2.0 |
alexandergall/snabbswitch | lib/luajit/testsuite/test/lib/bit.lua | 6 | 2716 | local bit = require"bit"
local byte, ipairs, tostring, pcall = string.byte, ipairs, tostring, pcall
local vb = {
0, 1, -1, 2, -2, 0x12345678, 0x87654321,
0x33333333, 0x77777777, 0x55aa55aa, 0xaa55aa55,
0x7fffffff, 0x80000000, 0xffffffff
}
local function cksum(name, s, r)
local z = 0
for i=1,#s do z = (z + byte(s, i)*i) % 2147483629 end
if z ~= r then
error("bit."..name.." test failed (got "..z..", expected "..r..")", 0)
end
end
local function check_unop(name, r)
local f = bit[name]
local s = ""
if pcall(f) or pcall(f, "z") or pcall(f, true) then
error("bit."..name.." fails to detect argument errors", 0)
end
for _,x in ipairs(vb) do s = s..","..tostring(f(x)) end
cksum(name, s, r)
end
local function check_binop(name, r)
local f = bit[name]
local s = ""
if pcall(f) or pcall(f, "z") or pcall(f, true) then
error("bit."..name.." fails to detect argument errors", 0)
end
for _,x in ipairs(vb) do
for _2,y in ipairs(vb) do s = s..","..tostring(f(x, y)) --[[io.write(_, " ", _2, " ", x, " ", y, " ", f(x, y), "\n")]] end
end
cksum(name, s, r)
end
local function check_binop_range(name, r, yb, ye)
local f = bit[name]
local s = ""
if pcall(f) or pcall(f, "z") or pcall(f, true) or pcall(f, 1, true) then
error("bit."..name.." fails to detect argument errors", 0)
end
for _,x in ipairs(vb) do
for y=yb,ye do s = s..","..tostring(f(x, y)) end
end
cksum(name, s, r)
end
local function check_shift(name, r)
check_binop_range(name, r, 0, 31)
end
do --- Minimal sanity checks.
assert(0x7fffffff == 2147483647, "broken hex literals")
assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals")
assert(tostring(-1) == "-1", "broken tostring()")
assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")
end
do --- Basic argument processing.
assert(bit.tobit(1) == 1)
assert(bit.band(1) == 1)
assert(bit.bxor(1,2) == 3)
assert(bit.bor(1,2,4,8,16,32,64,128) == 255)
end
do --- unop test vectors
check_unop("tobit", 277312)
check_unop("bnot", 287870)
check_unop("bswap", 307611)
end
do --- binop test vectors
check_binop("band", 41206764)
check_binop("bor", 51253663)
check_binop("bxor", 79322427)
end
do --- shift test vectors
check_shift("lshift", 325260344)
check_shift("rshift", 139061800)
check_shift("arshift", 111364720)
check_shift("rol", 302401155)
check_shift("ror", 302316761)
end
do --- tohex test vectors
check_binop_range("tohex", 47880306, -8, 8)
end
do --- Don't propagate TOBIT narrowing across two conversions.
local tobit = bit.tobit
local k = 0x8000000000003
for i=1,100 do assert(tobit(k % (2^32)) == 3) end
end
| apache-2.0 |
Ali021s/Ali021 | libs/fakeredis.lua | 650 | 40405 | local unpack = table.unpack or unpack
--- Bit operations
local ok,bit
if _VERSION == "Lua 5.3" then
bit = (load [[ return {
band = function(x, y) return x & y end,
bor = function(x, y) return x | y end,
bxor = function(x, y) return x ~ y end,
bnot = function(x) return ~x end,
rshift = function(x, n) return x >> n end,
lshift = function(x, n) return x << n end,
} ]])()
else
ok,bit = pcall(require,"bit")
if not ok then bit = bit32 end
end
assert(type(bit) == "table", "module for bitops not found")
--- default sleep
local default_sleep
do
local ok, mod = pcall(require, "socket")
if ok and type(mod) == "table" then
default_sleep = mod.sleep
else
default_sleep = function(n)
local t0 = os.clock()
while true do
local delta = os.clock() - t0
if (delta < 0) or (delta > n) then break end
end
end
end
end
--- Helpers
local xdefv = function(ktype)
if ktype == "list" then
return {head = 0, tail = 0}
elseif ktype == "zset" then
return {
list = {},
set = {},
}
else return {} end
end
local xgetr = function(self, k, ktype)
if self.data[k] then
assert(
(self.data[k].ktype == ktype),
"ERR Operation against a key holding the wrong kind of value"
)
assert(self.data[k].value)
return self.data[k].value
else return xdefv(ktype) end
end
local xgetw = function(self, k, ktype)
if self.data[k] and self.data[k].value then
assert(
(self.data[k].ktype == ktype),
"ERR Operation against a key holding the wrong kind of value"
)
else
self.data[k] = {ktype = ktype, value = xdefv(ktype)}
end
return self.data[k].value
end
local empty = function(self, k)
local v, t = self.data[k].value, self.data[k].ktype
if t == nil then
return true
elseif t == "string" then
return not v[1]
elseif (t == "hash") or (t == "set") then
for _,_ in pairs(v) do return false end
return true
elseif t == "list" then
return v.head == v.tail
elseif t == "zset" then
if #v.list == 0 then
for _,_ in pairs(v.set) do error("incoherent") end
return true
else
for _,_ in pairs(v.set) do return(false) end
error("incoherent")
end
else error("unsupported") end
end
local cleanup = function(self, k)
if empty(self, k) then self.data[k] = nil end
end
local is_integer = function(x)
return (type(x) == "number") and (math.floor(x) == x)
end
local overflows = function(n)
return (n > 2^53-1) or (n < -2^53+1)
end
local is_bounded_integer = function(x)
return (is_integer(x) and (not overflows(x)))
end
local is_finite_number = function(x)
return (type(x) == "number") and (x > -math.huge) and (x < math.huge)
end
local toint = function(x)
if type(x) == "string" then x = tonumber(x) end
return is_bounded_integer(x) and x or nil
end
local tofloat = function(x)
if type(x) == "number" then return x end
if type(x) ~= "string" then return nil end
local r = tonumber(x)
if r then return r end
if x == "inf" or x == "+inf" then
return math.huge
elseif x == "-inf" then
return -math.huge
else return nil end
end
local tostr = function(x)
if is_bounded_integer(x) then
return string.format("%d", x)
else return tostring(x) end
end
local char_bitcount = function(x)
assert(
(type(x) == "number") and
(math.floor(x) == x) and
(x >= 0) and (x < 256)
)
local n = 0
while x ~= 0 do
x = bit.band(x, x-1)
n = n+1
end
return n
end
local chkarg = function(x)
if type(x) == "number" then x = tostr(x) end
assert(type(x) == "string")
return x
end
local chkargs = function(n, ...)
local arg = {...}
assert(#arg == n)
for i=1,n do arg[i] = chkarg(arg[i]) end
return unpack(arg)
end
local getargs = function(...)
local arg = {...}
local n = #arg; assert(n > 0)
for i=1,n do arg[i] = chkarg(arg[i]) end
return arg
end
local getargs_as_map = function(...)
local arg, r = getargs(...), {}
assert(#arg%2 == 0)
for i=1,#arg,2 do r[arg[i]] = arg[i+1] end
return r
end
local chkargs_wrap = function(f, n)
assert( (type(f) == "function") and (type(n) == "number") )
return function(self, ...) return f(self, chkargs(n, ...)) end
end
local lset_to_list = function(s)
local r = {}
for v,_ in pairs(s) do r[#r+1] = v end
return r
end
local nkeys = function(x)
local r = 0
for _,_ in pairs(x) do r = r + 1 end
return r
end
--- Commands
-- keys
local del = function(self, ...)
local arg = getargs(...)
local r = 0
for i=1,#arg do
if self.data[arg[i]] then r = r + 1 end
self.data[arg[i]] = nil
end
return r
end
local exists = function(self, k)
return not not self.data[k]
end
local keys = function(self, pattern)
assert(type(pattern) == "string")
-- We want to convert the Redis pattern to a Lua pattern.
-- Start by escaping dashes *outside* character classes.
-- We also need to escape percents here.
local t, p, n = {}, 1, #pattern
local p1, p2
while true do
p1, p2 = pattern:find("%[.+%]", p)
if p1 then
if p1 > p then
t[#t+1] = {true, pattern:sub(p, p1-1)}
end
t[#t+1] = {false, pattern:sub(p1, p2)}
p = p2+1
if p > n then break end
else
t[#t+1] = {true, pattern:sub(p, n)}
break
end
end
for i=1,#t do
if t[i][1] then
t[i] = t[i][2]:gsub("[%%%-]", "%%%0")
else t[i] = t[i][2]:gsub("%%", "%%%%") end
end
-- Remaining Lua magic chars are: '^$().[]*+?' ; escape them except '*?[]'
-- Then convert '\' to '%', '*' to '.*' and '?' to '.'. Leave '[]' as is.
-- Wrap in '^$' to enforce bounds.
local lp = "^" .. table.concat(t):gsub("[%^%$%(%)%.%+]", "%%%0")
:gsub("\\", "%%"):gsub("%*", ".*"):gsub("%?", ".") .. "$"
local r = {}
for k,_ in pairs(self.data) do
if k:match(lp) then r[#r+1] = k end
end
return r
end
local _type = function(self, k)
return self.data[k] and self.data[k].ktype or "none"
end
local randomkey = function(self)
local ks = lset_to_list(self.data)
local n = #ks
if n > 0 then
return ks[math.random(1, n)]
else return nil end
end
local rename = function(self, k, k2)
assert((k ~= k2) and self.data[k])
self.data[k2] = self.data[k]
self.data[k] = nil
return true
end
local renamenx = function(self, k, k2)
if self.data[k2] then
return false
else
return rename(self, k, k2)
end
end
-- strings
local getrange, incrby, set
local append = function(self, k, v)
local x = xgetw(self, k, "string")
x[1] = (x[1] or "") .. v
return #x[1]
end
local bitcount = function(self, k, i1, i2)
k = chkarg(k)
local s
if i1 or i2 then
assert(i1 and i2, "ERR syntax error")
s = getrange(self, k, i1, i2)
else
s = xgetr(self, k, "string")[1] or ""
end
local r, bytes = 0,{s:byte(1, -1)}
for i=1,#bytes do
r = r + char_bitcount(bytes[i])
end
return r
end
local bitop = function(self, op, k, ...)
assert(type(op) == "string")
op = op:lower()
assert(
(op == "and") or
(op == "or") or
(op == "xor") or
(op == "not"),
"ERR syntax error"
)
k = chkarg(k)
local arg = {...}
local good_arity = (op == "not") and (#arg == 1) or (#arg > 0)
assert(good_arity, "ERR wrong number of arguments for 'bitop' command")
local l, vals = 0, {}
local s
for i=1,#arg do
s = xgetr(self, arg[i], "string")[1] or ""
if #s > l then l = #s end
vals[i] = s
end
if l == 0 then
del(self, k)
return 0
end
local vector_mt = {__index=function() return 0 end}
for i=1,#vals do
vals[i] = setmetatable({vals[i]:byte(1, -1)}, vector_mt)
end
local r = {}
if op == "not" then
assert(#vals[1] == l)
for i=1,l do
r[i] = bit.band(bit.bnot(vals[1][i]), 0xff)
end
else
local _op = bit["b" .. op]
for i=1,l do
local t = {}
for j=1,#vals do t[j] = vals[j][i] end
r[i] = _op(unpack(t))
end
end
set(self, k, string.char(unpack(r)))
return l
end
local decr = function(self, k)
return incrby(self, k, -1)
end
local decrby = function(self, k, n)
n = toint(n)
assert(n, "ERR value is not an integer or out of range")
return incrby(self, k, -n)
end
local get = function(self, k)
local x = xgetr(self, k, "string")
return x[1]
end
local getbit = function(self, k, offset)
k = chkarg(k)
offset = toint(offset)
assert(
(offset >= 0),
"ERR bit offset is not an integer or out of range"
)
local bitpos = offset % 8 -- starts at 0
local bytepos = (offset - bitpos) / 8 -- starts at 0
local s = xgetr(self, k, "string")[1] or ""
if bytepos >= #s then return 0 end
local char = s:sub(bytepos+1, bytepos+1):byte()
return bit.band(bit.rshift(char, 7-bitpos), 1)
end
getrange = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x = xgetr(self, k, "string")
x = x[1] or ""
if i1 >= 0 then i1 = i1 + 1 end
if i2 >= 0 then i2 = i2 + 1 end
return x:sub(i1, i2)
end
local getset = function(self, k, v)
local r = get(self, k)
set(self, k, v)
return r
end
local incr = function(self, k)
return incrby(self, k, 1)
end
incrby = function(self, k, n)
k, n = chkarg(k), toint(n)
assert(n, "ERR value is not an integer or out of range")
local x = xgetw(self, k, "string")
local i = toint(x[1] or 0)
assert(i, "ERR value is not an integer or out of range")
i = i+n
assert(
(not overflows(i)),
"ERR increment or decrement would overflow"
)
x[1] = tostr(i)
return i
end
local incrbyfloat = function(self, k, n)
k, n = chkarg(k), tofloat(n)
assert(n, "ERR value is not a valid float")
local x = xgetw(self, k, "string")
local i = tofloat(x[1] or 0)
assert(i, "ERR value is not a valid float")
i = i+n
assert(
is_finite_number(i),
"ERR increment would produce NaN or Infinity"
)
x[1] = tostr(i)
return i
end
local mget = function(self, ...)
local arg, r = getargs(...), {}
for i=1,#arg do r[i] = get(self, arg[i]) end
return r
end
local mset = function(self, ...)
local argmap = getargs_as_map(...)
for k,v in pairs(argmap) do set(self, k, v) end
return true
end
local msetnx = function(self, ...)
local argmap = getargs_as_map(...)
for k,_ in pairs(argmap) do
if self.data[k] then return false end
end
for k,v in pairs(argmap) do set(self, k, v) end
return true
end
set = function(self, k, v)
self.data[k] = {ktype = "string", value = {v}}
return true
end
local setbit = function(self, k, offset, b)
k = chkarg(k)
offset, b = toint(offset), toint(b)
assert(
(offset >= 0),
"ERR bit offset is not an integer or out of range"
)
assert(
(b == 0) or (b == 1),
"ERR bit is not an integer or out of range"
)
local bitpos = offset % 8 -- starts at 0
local bytepos = (offset - bitpos) / 8 -- starts at 0
local s = xgetr(self, k, "string")[1] or ""
local pad = {s}
for i=2,bytepos+2-#s do pad[i] = "\0" end
s = table.concat(pad)
assert(#s >= bytepos+1)
local before = s:sub(1, bytepos)
local char = s:sub(bytepos+1, bytepos+1):byte()
local after = s:sub(bytepos+2, -1)
local old = bit.band(bit.rshift(char, 7-bitpos), 1)
if b == 1 then
char = bit.bor(bit.lshift(1, 7-bitpos), char)
else
char = bit.band(bit.bnot(bit.lshift(1, 7-bitpos)), char)
end
local r = before .. string.char(char) .. after
set(self, k, r)
return old
end
local setnx = function(self, k, v)
if self.data[k] then
return false
else
return set(self, k, v)
end
end
local setrange = function(self, k, i, s)
local k, s = chkargs(2, k, s)
i = toint(i)
assert(i and (i >= 0))
local x = xgetw(self, k, "string")
local y = x[1] or ""
local ly, ls = #y, #s
if i > ly then -- zero padding
local t = {}
for i=1, i-ly do t[i] = "\0" end
y = y .. table.concat(t) .. s
else
y = y:sub(1, i) .. s .. y:sub(i+ls+1, ly)
end
x[1] = y
return #y
end
local strlen = function(self, k)
local x = xgetr(self, k, "string")
return x[1] and #x[1] or 0
end
-- hashes
local hdel = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local r = 0
local x = xgetw(self, k, "hash")
for i=1,#arg do
if x[arg[i]] then r = r + 1 end
x[arg[i]] = nil
end
cleanup(self, k)
return r
end
local hget
local hexists = function(self, k, k2)
return not not hget(self, k, k2)
end
hget = function(self, k, k2)
local x = xgetr(self, k, "hash")
return x[k2]
end
local hgetall = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _k,v in pairs(x) do r[_k] = v end
return r
end
local hincrby = function(self, k, k2, n)
k, k2, n = chkarg(k), chkarg(k2), toint(n)
assert(n, "ERR value is not an integer or out of range")
assert(type(n) == "number")
local x = xgetw(self, k, "hash")
local i = toint(x[k2] or 0)
assert(i, "ERR value is not an integer or out of range")
i = i+n
assert(
(not overflows(i)),
"ERR increment or decrement would overflow"
)
x[k2] = tostr(i)
return i
end
local hincrbyfloat = function(self, k, k2, n)
k, k2, n = chkarg(k), chkarg(k2), tofloat(n)
assert(n, "ERR value is not a valid float")
local x = xgetw(self, k, "hash")
local i = tofloat(x[k2] or 0)
assert(i, "ERR value is not a valid float")
i = i+n
assert(
is_finite_number(i),
"ERR increment would produce NaN or Infinity"
)
x[k2] = tostr(i)
return i
end
local hkeys = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _k,_ in pairs(x) do r[#r+1] = _k end
return r
end
local hlen = function(self, k)
local x = xgetr(self, k, "hash")
return nkeys(x)
end
local hmget = function(self, k, k2s)
k = chkarg(k)
assert((type(k2s) == "table"))
local r = {}
local x = xgetr(self, k, "hash")
for i=1,#k2s do r[i] = x[chkarg(k2s[i])] end
return r
end
local hmset = function(self, k, ...)
k = chkarg(k)
local arg = {...}
if type(arg[1]) == "table" then
assert(#arg == 1)
local x = xgetw(self, k, "hash")
for _k,v in pairs(arg[1]) do x[chkarg(_k)] = chkarg(v) end
else
assert(#arg % 2 == 0)
local x = xgetw(self, k, "hash")
local t = getargs(...)
for i=1,#t,2 do x[t[i]] = t[i+1] end
end
return true
end
local hset = function(self, k, k2, v)
local x = xgetw(self, k, "hash")
local r = not x[k2]
x[k2] = v
return r
end
local hsetnx = function(self, k, k2, v)
local x = xgetw(self, k, "hash")
if x[k2] == nil then
x[k2] = v
return true
else
return false
end
end
local hvals = function(self, k)
local x = xgetr(self, k, "hash")
local r = {}
for _,v in pairs(x) do r[#r+1] = v end
return r
end
-- lists (head = left, tail = right)
local _l_real_i = function(x, i)
if i < 0 then
return x.tail+i+1
else
return x.head+i+1
end
end
local _l_len = function(x)
return x.tail - x.head
end
local _block_for = function(self, timeout)
if timeout > 0 then
local sleep = self.sleep or default_sleep
if type(sleep) == "function" then
sleep(timeout)
else
error("sleep function unavailable", 0)
end
else
error("operation would block", 0)
end
end
local rpoplpush
local blpop = function(self, ...)
local arg = {...}
local timeout = toint(arg[#arg])
arg[#arg] = nil
local vs = getargs(...)
local x, l, k, v
for i=1,#vs do
k = vs[i]
x = xgetw(self, k, "list")
l = _l_len(x)
if l > 0 then
v = x[x.head+1]
if l > 1 then
x.head = x.head + 1
x[x.head] = nil
else self.data[k] = nil end
return {k, v}
else self.data[k] = nil end
end
_block_for(self, timeout)
end
local brpop = function(self, ...)
local arg = {...}
local timeout = toint(arg[#arg])
arg[#arg] = nil
local vs = getargs(...)
local x, l, k, v
for i=1,#vs do
k = vs[i]
x = xgetw(self, k, "list")
l = _l_len(x)
if l > 0 then
v = x[x.tail]
if l > 1 then
x[x.tail] = nil
x.tail = x.tail - 1
else self.data[k] = nil end
return {k, v}
else self.data[k] = nil end
end
_block_for(self, timeout)
end
local brpoplpush = function(self, k1, k2, timeout)
k1, k2 = chkargs(2, k1, k2)
timeout = toint(timeout)
if not self.data[k1] then _block_for(self, timeout) end
return rpoplpush(self, k1, k2)
end
local lindex = function(self, k, i)
k = chkarg(k)
i = assert(toint(i))
local x = xgetr(self, k, "list")
return x[_l_real_i(x, i)]
end
local linsert = function(self, k, mode, pivot, v)
mode = mode:lower()
assert((mode == "before") or (mode == "after"))
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
local p = nil
for i=x.head+1, x.tail do
if x[i] == pivot then
p = i
break
end
end
if not p then return -1 end
if mode == "after" then
for i=x.head+1, p do x[i-1] = x[i] end
x.head = x.head - 1
else
for i=x.tail, p, -1 do x[i+1] = x[i] end
x.tail = x.tail + 1
end
x[p] = v
return _l_len(x)
end
local llen = function(self, k)
local x = xgetr(self, k, "list")
return _l_len(x)
end
local lpop = function(self, k)
local x = xgetw(self, k, "list")
local l, r = _l_len(x), x[x.head+1]
if l > 1 then
x.head = x.head + 1
x[x.head] = nil
else self.data[k] = nil end
return r
end
local lpush = function(self, k, ...)
local vs = getargs(...)
local x = xgetw(self, k, "list")
for i=1,#vs do
x[x.head] = vs[i]
x.head = x.head - 1
end
return _l_len(x)
end
local lpushx = function(self, k, v)
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
x[x.head] = v
x.head = x.head - 1
return _l_len(x)
end
local lrange = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x, r = xgetr(self, k, "list"), {}
i1 = math.max(_l_real_i(x, i1), x.head+1)
i2 = math.min(_l_real_i(x, i2), x.tail)
for i=i1,i2 do r[#r+1] = x[i] end
return r
end
local _lrem_i = function(x, p)
for i=p,x.tail do
x[i] = x[i+1]
end
x.tail = x.tail - 1
end
local _lrem_l = function(x, v, s)
assert(v)
if not s then s = x.head+1 end
for i=s,x.tail do
if x[i] == v then
_lrem_i(x, i)
return i
end
end
return false
end
local _lrem_r = function(x, v, s)
assert(v)
if not s then s = x.tail end
for i=s,x.head+1,-1 do
if x[i] == v then
_lrem_i(x, i)
return i
end
end
return false
end
local lrem = function(self, k, count, v)
k, v = chkarg(k), chkarg(v)
count = assert(toint(count))
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
local n, last = 0, nil
local op = (count < 0) and _lrem_r or _lrem_l
local limited = (count ~= 0)
count = math.abs(count)
while true do
last = op(x, v, last)
if last then
n = n+1
if limited then
count = count - 1
if count == 0 then break end
end
else break end
end
return n
end
local lset = function(self, k, i, v)
k, v = chkarg(k), chkarg(v)
i = assert(toint(i))
if not self.data[k] then
error("ERR no such key")
end
local x = xgetw(self, k, "list")
local l = _l_len(x)
if i >= l or i < -l then
error("ERR index out of range")
end
x[_l_real_i(x, i)] = v
return true
end
local ltrim = function(self, k, i1, i2)
k = chkarg(k)
i1, i2 = toint(i1), toint(i2)
assert(i1 and i2)
local x = xgetw(self, k, "list")
i1, i2 = _l_real_i(x, i1), _l_real_i(x, i2)
for i=x.head+1,i1-1 do x[i] = nil end
for i=i2+1,x.tail do x[i] = nil end
x.head = math.max(i1-1, x.head)
x.tail = math.min(i2, x.tail)
assert(
(x[x.head] == nil) and
(x[x.tail+1] == nil)
)
cleanup(self, k)
return true
end
local rpop = function(self, k)
local x = xgetw(self, k, "list")
local l, r = _l_len(x), x[x.tail]
if l > 1 then
x[x.tail] = nil
x.tail = x.tail - 1
else self.data[k] = nil end
return r
end
rpoplpush = function(self, k1, k2)
local v = rpop(self, k1)
if not v then return nil end
lpush(self, k2, v)
return v
end
local rpush = function(self, k, ...)
local vs = getargs(...)
local x = xgetw(self, k, "list")
for i=1,#vs do
x.tail = x.tail + 1
x[x.tail] = vs[i]
end
return _l_len(x)
end
local rpushx = function(self, k, v)
if not self.data[k] then return 0 end
local x = xgetw(self, k, "list")
x.tail = x.tail + 1
x[x.tail] = v
return _l_len(x)
end
-- sets
local sadd = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "set"), 0
for i=1,#arg do
if not x[arg[i]] then
x[arg[i]] = true
r = r + 1
end
end
return r
end
local scard = function(self, k)
local x = xgetr(self, k, "set")
return nkeys(x)
end
local _sdiff = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x = xgetr(self, k, "set")
local r = {}
for v,_ in pairs(x) do r[v] = true end
for i=1,#arg do
x = xgetr(self, arg[i], "set")
for v,_ in pairs(x) do r[v] = nil end
end
return r
end
local sdiff = function(self, k, ...)
return lset_to_list(_sdiff(self, k, ...))
end
local sdiffstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sdiff(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
local _sinter = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x = xgetr(self, k, "set")
local r = {}
local y
for v,_ in pairs(x) do
r[v] = true
for i=1,#arg do
y = xgetr(self, arg[i], "set")
if not y[v] then r[v] = nil; break end
end
end
return r
end
local sinter = function(self, k, ...)
return lset_to_list(_sinter(self, k, ...))
end
local sinterstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sinter(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
local sismember = function(self, k, v)
local x = xgetr(self, k, "set")
return not not x[v]
end
local smembers = function(self, k)
local x = xgetr(self, k, "set")
return lset_to_list(x)
end
local smove = function(self, k, k2, v)
local x = xgetr(self, k, "set")
if x[v] then
local y = xgetw(self, k2, "set")
x[v] = nil
y[v] = true
return true
else return false end
end
local spop = function(self, k)
local x, r = xgetw(self, k, "set"), nil
local l = lset_to_list(x)
local n = #l
if n > 0 then
r = l[math.random(1, n)]
x[r] = nil
end
cleanup(self, k)
return r
end
local srandmember = function(self, k, count)
k = chkarg(k)
local x = xgetr(self, k, "set")
local l = lset_to_list(x)
local n = #l
if not count then
if n > 0 then
return l[math.random(1, n)]
else return nil end
end
count = toint(count)
if (count == 0) or (n == 0) then return {} end
if count >= n then return l end
local r = {}
if count > 0 then -- distinct elements
for i=0,count-1 do
r[#r+1] = table.remove(l, math.random(1, n-i))
end
else -- allow repetition
for i=1,-count do
r[#r+1] = l[math.random(1, n)]
end
end
return r
end
local srem = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "set"), 0
for i=1,#arg do
if x[arg[i]] then
x[arg[i]] = nil
r = r + 1
end
end
cleanup(self, k)
return r
end
local _sunion = function(self, ...)
local arg = getargs(...)
local r = {}
local x
for i=1,#arg do
x = xgetr(self, arg[i], "set")
for v,_ in pairs(x) do r[v] = true end
end
return r
end
local sunion = function(self, k, ...)
return lset_to_list(_sunion(self, k, ...))
end
local sunionstore = function(self, k2, k, ...)
k2 = chkarg(k2)
local x = _sunion(self, k, ...)
self.data[k2] = {ktype = "set", value = x}
return nkeys(x)
end
-- zsets
local _z_p_mt = {
__eq = function(a, b)
if a.v == b.v then
assert(a.s == b.s)
return true
else return false end
end,
__lt = function(a, b)
if a.s == b.s then
return (a.v < b.v)
else
return (a.s < b.s)
end
end,
}
local _z_pair = function(s, v)
assert(
(type(s) == "number") and
(type(v) == "string")
)
local r = {s = s, v = v}
return setmetatable(r, _z_p_mt)
end
local _z_pairs = function(...)
local arg = {...}
assert((#arg > 0) and (#arg % 2 == 0))
local ps = {}
for i=1,#arg,2 do
ps[#ps+1] = _z_pair(
assert(tofloat(arg[i])),
chkarg(arg[i+1])
)
end
return ps
end
local _z_insert = function(x, ix, p)
assert(
(type(x) == "table") and
(type(ix) == "number") and
(type(p) == "table")
)
local l = x.list
table.insert(l, ix, p)
for i=ix+1,#l do
x.set[l[i].v] = x.set[l[i].v] + 1
end
x.set[p.v] = ix
end
local _z_remove = function(x, v)
if not x.set[v] then return false end
local l, ix = x.list, x.set[v]
assert(l[ix].v == v)
table.remove(l, ix)
for i=ix,#l do
x.set[l[i].v] = x.set[l[i].v] - 1
end
x.set[v] = nil
return true
end
local _z_remove_range = function(x, i1, i2)
local l = x.list
i2 = i2 or i1
assert(
(i1 > 0) and
(i2 >= i1) and
(i2 <= #l)
)
local ix, n = i1, i2-i1+1
for i=1,n do
x.set[l[ix].v] = nil
table.remove(l, ix)
end
for i=ix,#l do
x.set[l[i].v] = x.set[l[i].v] - n
end
return n
end
local _z_update = function(x, p)
local l = x.list
local found = _z_remove(x, p.v)
local ix = nil
for i=1,#l do
if l[i] > p then
ix = i; break
end
end
if not ix then ix = #l+1 end
_z_insert(x, ix, p)
return found
end
local _z_coherence = function(x)
local l, s = x.list, x.set
local found, n = {}, 0
for val,pos in pairs(s) do
if found[pos] then return false end
found[pos] = true
n = n + 1
if not (l[pos] and (l[pos].v == val)) then
return false
end
end
if #l ~= n then return false end
for i=1, n-1 do
if l[i].s > l[i+1].s then return false end
end
return true
end
local _z_normrange = function(l, i1, i2)
i1, i2 = assert(toint(i1)), assert(toint(i2))
if i1 < 0 then i1 = #l+i1 end
if i2 < 0 then i2 = #l+i2 end
i1, i2 = math.max(i1+1, 1), i2+1
if (i2 < i1) or (i1 > #l) then return nil end
i2 = math.min(i2, #l)
return i1, i2
end
local _zrbs_opts = function(...)
local arg = {...}
if #arg == 0 then return {} end
local ix, opts = 1, {}
while type(arg[ix]) == "string" do
if arg[ix] == "withscores" then
opts.withscores = true
ix = ix + 1
elseif arg[ix] == "limit" then
opts.limit = {
offset = assert(toint(arg[ix+1])),
count = assert(toint(arg[ix+2])),
}
ix = ix + 3
else error("input") end
end
if type(arg[ix]) == "table" then
local _o = arg[ix]
opts.withscores = opts.withscores or _o.withscores
if _o.limit then
opts.limit = {
offset = assert(toint(_o.limit.offset or _o.limit[1])),
count = assert(toint(_o.limit.count or _o.limit[2])),
}
end
ix = ix + 1
end
assert(arg[ix] == nil)
if opts.limit then
assert(
(opts.limit.count >= 0) and
(opts.limit.offset >= 0)
)
end
return opts
end
local _z_store_params = function(dest, numkeys, ...)
dest = chkarg(dest)
numkeys = assert(toint(numkeys))
assert(numkeys > 0)
local arg = {...}
assert(#arg >= numkeys)
local ks = {}
for i=1, numkeys do ks[i] = chkarg(arg[i]) end
local ix, opts = numkeys+1,{}
while type(arg[ix]) == "string" do
if arg[ix] == "weights" then
opts.weights = {}
ix = ix + 1
for i=1, numkeys do
opts.weights[i] = assert(toint(arg[ix]))
ix = ix + 1
end
elseif arg[ix] == "aggregate" then
opts.aggregate = assert(chkarg(arg[ix+1]))
ix = ix + 2
else error("input") end
end
if type(arg[ix]) == "table" then
local _o = arg[ix]
opts.weights = opts.weights or _o.weights
opts.aggregate = opts.aggregate or _o.aggregate
ix = ix + 1
end
assert(arg[ix] == nil)
if opts.aggregate then
assert(
(opts.aggregate == "sum") or
(opts.aggregate == "min") or
(opts.aggregate == "max")
)
else opts.aggregate = "sum" end
if opts.weights then
assert(#opts.weights == numkeys)
for i=1,#opts.weights do
assert(type(opts.weights[i]) == "number")
end
else
opts.weights = {}
for i=1, numkeys do opts.weights[i] = 1 end
end
opts.keys = ks
opts.dest = dest
return opts
end
local _zrbs_limits = function(x, s1, s2, descending)
local s1_incl, s2_incl = true, true
if s1:sub(1, 1) == "(" then
s1, s1_incl = s1:sub(2, -1), false
end
s1 = assert(tofloat(s1))
if s2:sub(1, 1) == "(" then
s2, s2_incl = s2:sub(2, -1), false
end
s2 = assert(tofloat(s2))
if descending then
s1, s2 = s2, s1
s1_incl, s2_incl = s2_incl, s1_incl
end
if s2 < s1 then return nil end
local l = x.list
local i1, i2
local fst, lst = l[1].s, l[#l].s
if (fst > s2) or ((not s2_incl) and (fst == s2)) then return nil end
if (lst < s1) or ((not s1_incl) and (lst == s1)) then return nil end
if (fst > s1) or (s1_incl and (fst == s1)) then i1 = 1 end
if (lst < s2) or (s2_incl and (lst == s2)) then i2 = #l end
for i=1,#l do
if (i1 and i2) then break end
if (not i1) then
if l[i].s > s1 then i1 = i end
if s1_incl and l[i].s == s1 then i1 = i end
end
if (not i2) then
if l[i].s > s2 then i2 = i-1 end
if (not s2_incl) and l[i].s == s2 then i2 = i-1 end
end
end
assert(i1 and i2)
if descending then
return #l-i2, #l-i1
else
return i1-1, i2-1
end
end
local dbg_zcoherence = function(self, k)
local x = xgetr(self, k, "zset")
return _z_coherence(x)
end
local zadd = function(self, k, ...)
k = chkarg(k)
local ps = _z_pairs(...)
local x = xgetw(self, k, "zset")
local n = 0
for i=1,#ps do
if not _z_update(x, ps[i]) then n = n+1 end
end
return n
end
local zcard = function(self, k)
local x = xgetr(self, k, "zset")
return #x.list
end
local zcount = function(self, k, s1, s2)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, false)
if not (i1 and i2) then return 0 end
assert(i2 >= i1)
return i2 - i1 + 1
end
local zincrby = function(self, k, n, v)
k,v = chkargs(2, k, v)
n = assert(tofloat(n))
local x = xgetw(self, k, "zset")
local p = x.list[x.set[v]]
local s = p and (p.s + n) or n
_z_update(x, _z_pair(s, v))
return s
end
local zinterstore = function(self, ...)
local params = _z_store_params(...)
local x = xdefv("zset")
local aggregate
if params.aggregate == "sum" then
aggregate = function(x, y) return x+y end
elseif params.aggregate == "min" then
aggregate = math.min
elseif params.aggregate == "max" then
aggregate = math.max
else error() end
local y = xgetr(self, params.keys[1], "zset")
local p1, p2
for j=1,#y.list do
p1 = _z_pair(y.list[j].s, y.list[j].v)
_z_update(x, p1)
end
for i=2,#params.keys do
y = xgetr(self, params.keys[i], "zset")
local to_remove, to_update = {}, {}
for j=1,#x.list do
p1 = x.list[j]
if y.set[p1.v] then
p2 = _z_pair(
aggregate(
p1.s,
params.weights[i] * y.list[y.set[p1.v]].s
),
p1.v
)
to_update[#to_update+1] = p2
else
to_remove[#to_remove+1] = p1.v
end
end
for j=1,#to_remove do _z_remove(x, to_remove[j]) end
for j=1,#to_update do _z_update(x, to_update[j]) end
end
local r = #x.list
if r > 0 then
self.data[params.dest] = {ktype = "zset", value = x}
end
return r
end
local _zranger = function(descending)
return function(self, k, i1, i2, opts)
k = chkarg(k)
local withscores = false
if type(opts) == "table" then
withscores = opts.withscores
elseif type(opts) == "string" then
assert(opts:lower() == "withscores")
withscores = true
else assert(opts == nil) end
local x = xgetr(self, k, "zset")
local l = x.list
i1, i2 = _z_normrange(l, i1, i2)
if not i1 then return {} end
local inc = 1
if descending then
i1 = #l - i1 + 1
i2 = #l - i2 + 1
inc = -1
end
local r = {}
if withscores then
for i=i1, i2, inc do r[#r+1] = {l[i].v, l[i].s} end
else
for i=i1, i2, inc do r[#r+1] = l[i].v end
end
return r
end
end
local zrange = _zranger(false)
local zrevrange = _zranger(true)
local _zrangerbyscore = function(descending)
return function(self, k, s1, s2, ...)
k, s1, s2 = chkargs(3, k, s1, s2)
local opts = _zrbs_opts(...)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, descending)
if not (i1 and i2) then return {} end
if opts.limit then
if opts.limit.count == 0 then return {} end
i1 = i1 + opts.limit.offset
if i1 > i2 then return {} end
i2 = math.min(i2, i1+opts.limit.count-1)
end
if descending then
return zrevrange(self, k, i1, i2, opts)
else
return zrange(self, k, i1, i2, opts)
end
end
end
local zrangebyscore = _zrangerbyscore(false)
local zrevrangebyscore = _zrangerbyscore(true)
local zrank = function(self, k, v)
local x = xgetr(self, k, "zset")
local r = x.set[v]
if r then
return r-1
else return nil end
end
local zrem = function(self, k, ...)
k = chkarg(k)
local arg = getargs(...)
local x, r = xgetw(self, k, "zset"), 0
for i=1,#arg do
if _z_remove(x, arg[i]) then r = r + 1 end
end
cleanup(self, k)
return r
end
local zremrangebyrank = function(self, k, i1, i2)
k = chkarg(k)
local x = xgetw(self, k, "zset")
i1, i2 = _z_normrange(x.list, i1, i2)
if not i1 then
cleanup(self, k)
return 0
end
local n = _z_remove_range(x, i1, i2)
cleanup(self, k)
return n
end
local zremrangebyscore = function(self, k, s1, s2)
local x = xgetr(self, k, "zset")
local i1, i2 = _zrbs_limits(x, s1, s2, false)
if not (i1 and i2) then return 0 end
assert(i2 >= i1)
return zremrangebyrank(self, k, i1, i2)
end
local zrevrank = function(self, k, v)
local x = xgetr(self, k, "zset")
local r = x.set[v]
if r then
return #x.list-r
else return nil end
end
local zscore = function(self, k, v)
local x = xgetr(self, k, "zset")
local p = x.list[x.set[v]]
if p then
return p.s
else return nil end
end
local zunionstore = function(self, ...)
local params = _z_store_params(...)
local x = xdefv("zset")
local default_score, aggregate
if params.aggregate == "sum" then
default_score = 0
aggregate = function(x, y) return x+y end
elseif params.aggregate == "min" then
default_score = math.huge
aggregate = math.min
elseif params.aggregate == "max" then
default_score = -math.huge
aggregate = math.max
else error() end
local y, p1, p2
for i=1,#params.keys do
y = xgetr(self, params.keys[i], "zset")
for j=1,#y.list do
p1 = y.list[j]
p2 = _z_pair(
aggregate(
params.weights[i] * p1.s,
x.set[p1.v] and x.list[x.set[p1.v]].s or default_score
),
p1.v
)
_z_update(x, p2)
end
end
local r = #x.list
if r > 0 then
self.data[params.dest] = {ktype = "zset", value = x}
end
return r
end
-- connection
local echo = function(self, v)
return v
end
local ping = function(self)
return true
end
-- server
local flushdb = function(self)
self.data = {}
return true
end
--- Class
local methods = {
-- keys
del = del, -- (...) -> #removed
exists = chkargs_wrap(exists, 1), -- (k) -> exists?
keys = keys, -- (pattern) -> list of keys
["type"] = chkargs_wrap(_type, 1), -- (k) -> [string|list|set|zset|hash|none]
randomkey = randomkey, -- () -> [k|nil]
rename = chkargs_wrap(rename, 2), -- (k,k2) -> true
renamenx = chkargs_wrap(renamenx, 2), -- (k,k2) -> ! existed? k2
-- strings
append = chkargs_wrap(append, 2), -- (k,v) -> #new
bitcount = bitcount, -- (k,[start,end]) -> n
bitop = bitop, -- ([and|or|xor|not],k,...)
decr = chkargs_wrap(decr, 1), -- (k) -> new
decrby = decrby, -- (k,n) -> new
get = chkargs_wrap(get, 1), -- (k) -> [v|nil]
getbit = getbit, -- (k,offset) -> b
getrange = getrange, -- (k,start,end) -> string
getset = chkargs_wrap(getset, 2), -- (k,v) -> [oldv|nil]
incr = chkargs_wrap(incr, 1), -- (k) -> new
incrby = incrby, -- (k,n) -> new
incrbyfloat = incrbyfloat, -- (k,n) -> new
mget = mget, -- (k1,...) -> {v1,...}
mset = mset, -- (k1,v1,...) -> true
msetnx = msetnx, -- (k1,v1,...) -> worked? (i.e. !existed? any k)
set = chkargs_wrap(set, 2), -- (k,v) -> true
setbit = setbit, -- (k,offset,b) -> old
setnx = chkargs_wrap(setnx, 2), -- (k,v) -> worked? (i.e. !existed?)
setrange = setrange, -- (k,offset,val) -> #new
strlen = chkargs_wrap(strlen, 1), -- (k) -> [#v|0]
-- hashes
hdel = hdel, -- (k,sk1,...) -> #removed
hexists = chkargs_wrap(hexists, 2), -- (k,sk) -> exists?
hget = chkargs_wrap(hget,2), -- (k,sk) -> v
hgetall = chkargs_wrap(hgetall, 1), -- (k) -> map
hincrby = hincrby, -- (k,sk,n) -> new
hincrbyfloat = hincrbyfloat, -- (k,sk,n) -> new
hkeys = chkargs_wrap(hkeys, 1), -- (k) -> keys
hlen = chkargs_wrap(hlen, 1), -- (k) -> [#sk|0]
hmget = hmget, -- (k,{sk1,...}) -> {v1,...}
hmset = hmset, -- (k,{sk1=v1,...}) -> true
hset = chkargs_wrap(hset, 3), -- (k,sk1,v1) -> !existed?
hsetnx = chkargs_wrap(hsetnx, 3), -- (k,sk1,v1) -> worked? (i.e. !existed?)
hvals = chkargs_wrap(hvals, 1), -- (k) -> values
-- lists
blpop = blpop, -- (k1,...) -> k,v
brpop = brpop, -- (k1,...) -> k,v
brpoplpush = brpoplpush, -- (k1,k2,timeout) -> v
lindex = lindex, -- (k,i) -> v
linsert = chkargs_wrap(linsert, 4), -- (k,mode,pivot,v) -> #list (after)
llen = chkargs_wrap(llen, 1), -- (k) -> #list
lpop = chkargs_wrap(lpop, 1), -- (k) -> v
lpush = lpush, -- (k,v1,...) -> #list (after)
lpushx = chkargs_wrap(lpushx, 2), -- (k,v) -> #list (after)
lrange = lrange, -- (k,start,stop) -> list
lrem = lrem, -- (k,count,v) -> #removed
lset = lset, -- (k,i,v) -> true
ltrim = ltrim, -- (k,start,stop) -> true
rpop = chkargs_wrap(rpop, 1), -- (k) -> v
rpoplpush = chkargs_wrap(rpoplpush, 2), -- (k1,k2) -> v
rpush = rpush, -- (k,v1,...) -> #list (after)
rpushx = chkargs_wrap(rpushx, 2), -- (k,v) -> #list (after)
-- sets
sadd = sadd, -- (k,v1,...) -> #added
scard = chkargs_wrap(scard, 1), -- (k) -> [n|0]
sdiff = sdiff, -- (k1,...) -> set (of elements in k1 & not in any of ...)
sdiffstore = sdiffstore, -- (k0,k1,...) -> #set at k0
sinter = sinter, -- (k1,...) -> set
sinterstore = sinterstore, -- (k0,k1,...) -> #set at k0
sismember = chkargs_wrap(sismember, 2), -- (k,v) -> member?
smembers = chkargs_wrap(smembers, 1), -- (k) -> set
smove = chkargs_wrap(smove, 3), -- (k1,k2,v) -> moved? (i.e. !member? k1)
spop = chkargs_wrap(spop, 1), -- (k) -> [v|nil]
srandmember = srandmember, -- (k,[count]) -> v|[v1,v2,...]
srem = srem, -- (k,v1,...) -> #removed
sunion = sunion, -- (k1,...) -> set
sunionstore = sunionstore, -- (k0,k1,...) -> #set at k0
-- zsets
zadd = zadd, -- (k,score,member,[score,member,...])
zcard = chkargs_wrap(zcard, 1), -- (k) -> n
zcount = chkargs_wrap(zcount, 3), -- (k,min,max) -> count
zincrby = zincrby, -- (k,score,v) -> score
zinterstore = zinterstore, -- (k,numkeys,k1,...,[opts]) -> card
zrange = zrange, -- (k,start,stop,[opts]) -> depends on opts
zrangebyscore = zrangebyscore, -- (k,min,max,[opts]) -> depends on opts
zrank = chkargs_wrap(zrank, 2), -- (k,v) -> rank
zrem = zrem, -- (k,v1,...) -> #removed
zremrangebyrank = zremrangebyrank, -- (k,start,stop) -> #removed
zremrangebyscore = chkargs_wrap(zremrangebyscore, 3), -- (k,min,max) -> #removed
zrevrange = zrevrange, -- (k,start,stop,[opts]) -> depends on opts
zrevrangebyscore = zrevrangebyscore, -- (k,min,max,[opts]) -> depends on opts
zrevrank = chkargs_wrap(zrevrank, 2), -- (k,v) -> rank
zscore = chkargs_wrap(zscore, 2), -- (k,v) -> score
zunionstore = zunionstore, -- (k,numkeys,k1,...,[opts]) -> card
-- connection
echo = chkargs_wrap(echo, 1), -- (v) -> v
ping = ping, -- () -> true
-- server
flushall = flushdb, -- () -> true
flushdb = flushdb, -- () -> true
-- debug
dbg_zcoherence = dbg_zcoherence,
}
local new = function()
local r = {data = {}}
return setmetatable(r,{__index = methods})
end
return {
new = new,
}
| agpl-3.0 |
lambd0x/Awesome-wm-Funtoo-GreenInfinity | awesome/treetile/bintree.lua | 2 | 4052 | -- bintree.lua
-- Class representing the binary tree
local Bintree = {}
Bintree.__index = Bintree
function Bintree.new(data, left, right)
local node = {
data = data,
left = left,
right = right,
}
return setmetatable(node,Bintree)
end
function Bintree:addLeft(child)
if self ~= nil then
self.left = child
return self.left
end
end
function Bintree:addRight(child)
if self ~= nil then
self.right = child
return self.right
end
end
function Bintree:find(data)
if data == self.data then
return self
end
local output = nil
if type(self.left) == "table" then
output = self.left:find(data)
end
if type(self.right) == "table" then
output = output or self.right:find(data) or nil
end
return output
end
-- remove leaf and replace parent by sibling
function Bintree:removeLeaf(data)
local output = nil
if self.left ~= nil then
if self.left.data == data then
local newSelf = {
data = self.right.data,
left = self.right.left,
right = self.right.right
}
self.data = newSelf.data
self.left = newSelf.left
self.right = newSelf.right
return true
else
output = self.left:removeLeaf(data) or nil
end
end
if self.right ~= nil then
if self.right.data == data then
local newSelf = {
data = self.left.data,
left = self.left.left,
right = self.left.right
}
self.data = newSelf.data
self.left = newSelf.left
self.right = newSelf.right
return true
else
return output or self.right:removeLeaf(data) or nil
end
end
end
function Bintree:getSibling(data)
if data == self.data then
return nil
end
local output = nil
if type(self.left) == "table" then
if self.left.data == data then
return self.right
end
output = self.left:getSibling(data) or nil
end
if type(self.right) == "table" then
if self.right.data == data then
return self.left
end
output = output or self.right:getSibling(data) or nil
end
return output or nil
end
function Bintree:getParent(data)
local output = nil
if type(self.left) == "table" then
if self.left.data == data then
--print('L branch found')
return self
end
output = self.left:getParent(data) or nil
end
if type(self.right) == "table" then
if self.right.data == data then
--print('R branch found')
return self
end
output = output or self.right:getParent(data) or nil
end
return output or nil
end
function Bintree:swapLeaves(data1, data2)
local leaf1 = self:find(data1)
local leaf2 = self:find(data2)
local temp = nil
if leaf1 and leaf2 then
temp = leaf1.data
leaf1.data = leaf2.data
leaf2.data = temp
end
end
function Bintree.show(node, level)
if level == nil then
level = 0
end
if node ~= nil then
print(string.rep(" ", level) .. "Node[" .. node.data .. "]")
Bintree.show(node.left, level + 1)
Bintree.show(node.right, level + 1)
end
end
function Bintree.show2(node, level, d)
if level == nil then
level = 0
end
if d == nil then
d=''
end
if node ~= nil then
if type(node.data) == 'number' then
print(string.rep(" ", level) .. d.."Node[" .. node.data .. "]")
else
print(string.rep(" ", level) .. d.."Node[" .. tostring(node.data.x)..' '..tostring(node.data.y)..' '..tostring(node.data.height)..' '..tostring(node.data.width) .. "]")
end
Bintree.show2(node.left, level + 1, 'L_')
Bintree.show2(node.right, level + 1, 'R_')
end
end
return Bintree
| gpl-2.0 |
Paradokz/BadRotations | System/Libs/LibSpellRange-1.0/libs/LibStub/tests/test.lua | 86 | 2013 | debugstack = debug.traceback
strmatch = string.match
loadfile("../LibStub.lua")()
local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy
assert(lib) -- should return the library table
assert(not oldMinor) -- should not return the old minor, since it didn't exist
-- the following is to create data and then be able to check if the same data exists after the fact
function lib:MyMethod()
end
local MyMethod = lib.MyMethod
lib.MyTable = {}
local MyTable = lib.MyTable
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail
assert(not newLib) -- should not return since out of date
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail
assert(not newLib) -- should not return since out of date
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version
assert(newLib) -- library table
assert(rawequal(newLib, lib)) -- should be the same reference as the previous
assert(newOldMinor == 1) -- should return the minor version of the previous version
assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved
assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number)
assert(newLib) -- library table
assert(newOldMinor == 2) -- previous version was 2
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number)
assert(newLib)
assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string)
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string
assert(newLib)
assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string) | gpl-3.0 |
Vermeille/kong | kong/plugins/request-size-limiting/handler.lua | 6 | 1373 | -- Copyright (C) Mashape, Inc.
local BasePlugin = require "kong.plugins.base_plugin"
local responses = require "kong.tools.responses"
local strip = require("pl.stringx").strip
local tonumber = tonumber
local MB = 2^20
local RequestSizeLimitingHandler = BasePlugin:extend()
RequestSizeLimitingHandler.PRIORITY = 950
local function check_size(length, allowed_size, headers)
local allowed_bytes_size = allowed_size * MB
if length > allowed_bytes_size then
if headers.expect and strip(headers.expect:lower()) == "100-continue" then
return responses.send(417, "Request size limit exceeded")
else
return responses.send(413, "Request size limit exceeded")
end
end
end
function RequestSizeLimitingHandler:new()
RequestSizeLimitingHandler.super.new(self, "request-size-limiting")
end
function RequestSizeLimitingHandler:access(conf)
RequestSizeLimitingHandler.super.access(self)
local headers = ngx.req.get_headers()
local cl = headers["content-length"]
if cl and tonumber(cl) then
check_size(tonumber(cl), conf.allowed_payload_size, headers)
else
-- If the request body is too big, this could consume too much memory (to check)
ngx.req.read_body()
local data = ngx.req.get_body_data()
if data then
check_size(#data, conf.allowed_payload_size, headers)
end
end
end
return RequestSizeLimitingHandler
| apache-2.0 |
nwf/nodemcu-firmware | app/lua53/host/tests/coroutine.lua | 9 | 22765 | -- $Id: coroutine.lua,v 1.42 2016/11/07 13:03:20 roberto Exp $
-- See Copyright Notice in file all.lua
print "testing coroutines"
local debug = require'debug'
local f
local main, ismain = coroutine.running()
assert(type(main) == "thread" and ismain)
assert(not coroutine.resume(main))
assert(not coroutine.isyieldable())
assert(not pcall(coroutine.yield))
-- trivial errors
assert(not pcall(coroutine.resume, 0))
assert(not pcall(coroutine.status, 0))
-- tests for multiple yield/resume arguments
local function eqtab (t1, t2)
assert(#t1 == #t2)
for i = 1, #t1 do
local v = t1[i]
assert(t2[i] == v)
end
end
_G.x = nil -- declare x
function foo (a, ...)
local x, y = coroutine.running()
assert(x == f and y == false)
-- next call should not corrupt coroutine (but must fail,
-- as it attempts to resume the running coroutine)
assert(coroutine.resume(f) == false)
assert(coroutine.status(f) == "running")
local arg = {...}
assert(coroutine.isyieldable())
for i=1,#arg do
_G.x = {coroutine.yield(table.unpack(arg[i]))}
end
return table.unpack(a)
end
f = coroutine.create(foo)
assert(type(f) == "thread" and coroutine.status(f) == "suspended")
assert(string.find(tostring(f), "thread"))
local s,a,b,c,d
s,a,b,c,d = coroutine.resume(f, {1,2,3}, {}, {1}, {'a', 'b', 'c'})
assert(s and a == nil and coroutine.status(f) == "suspended")
s,a,b,c,d = coroutine.resume(f)
eqtab(_G.x, {})
assert(s and a == 1 and b == nil)
s,a,b,c,d = coroutine.resume(f, 1, 2, 3)
eqtab(_G.x, {1, 2, 3})
assert(s and a == 'a' and b == 'b' and c == 'c' and d == nil)
s,a,b,c,d = coroutine.resume(f, "xuxu")
eqtab(_G.x, {"xuxu"})
assert(s and a == 1 and b == 2 and c == 3 and d == nil)
assert(coroutine.status(f) == "dead")
s, a = coroutine.resume(f, "xuxu")
assert(not s and string.find(a, "dead") and coroutine.status(f) == "dead")
-- yields in tail calls
local function foo (i) return coroutine.yield(i) end
f = coroutine.wrap(function ()
for i=1,10 do
assert(foo(i) == _G.x)
end
return 'a'
end)
for i=1,10 do _G.x = i; assert(f(i) == i) end
_G.x = 'xuxu'; assert(f('xuxu') == 'a')
-- recursive
function pf (n, i)
coroutine.yield(n)
pf(n*i, i+1)
end
f = coroutine.wrap(pf)
local s=1
for i=1,10 do
assert(f(1, 1) == s)
s = s*i
end
-- sieve
function gen (n)
return coroutine.wrap(function ()
for i=2,n do coroutine.yield(i) end
end)
end
function filter (p, g)
return coroutine.wrap(function ()
while 1 do
local n = g()
if n == nil then return end
if math.fmod(n, p) ~= 0 then coroutine.yield(n) end
end
end)
end
local x = gen(100)
local a = {}
while 1 do
local n = x()
if n == nil then break end
table.insert(a, n)
x = filter(n, x)
end
assert(#a == 25 and a[#a] == 97)
x, a = nil
-- yielding across C boundaries
co = coroutine.wrap(function()
assert(not pcall(table.sort,{1,2,3}, coroutine.yield))
assert(coroutine.isyieldable())
coroutine.yield(20)
return 30
end)
assert(co() == 20)
assert(co() == 30)
local f = function (s, i) return coroutine.yield(i) end
local f1 = coroutine.wrap(function ()
return xpcall(pcall, function (...) return ... end,
function ()
local s = 0
for i in f, nil, 1 do pcall(function () s = s + i end) end
error({s})
end)
end)
f1()
for i = 1, 10 do assert(f1(i) == i) end
local r1, r2, v = f1(nil)
assert(r1 and not r2 and v[1] == (10 + 1)*10/2)
function f (a, b) a = coroutine.yield(a); error{a + b} end
function g(x) return x[1]*2 end
co = coroutine.wrap(function ()
coroutine.yield(xpcall(f, g, 10, 20))
end)
assert(co() == 10)
r, msg = co(100)
assert(not r and msg == 240)
-- unyieldable C call
do
local function f (c)
assert(not coroutine.isyieldable())
return c .. c
end
local co = coroutine.wrap(function (c)
assert(coroutine.isyieldable())
local s = string.gsub("a", ".", f)
return s
end)
assert(co() == "aa")
end
-- errors in coroutines
function foo ()
assert(debug.getinfo(1).currentline == debug.getinfo(foo).linedefined + 1)
assert(debug.getinfo(2).currentline == debug.getinfo(goo).linedefined)
coroutine.yield(3)
error(foo)
end
function goo() foo() end
x = coroutine.wrap(goo)
assert(x() == 3)
local a,b = pcall(x)
assert(not a and b == foo)
x = coroutine.create(goo)
a,b = coroutine.resume(x)
assert(a and b == 3)
a,b = coroutine.resume(x)
assert(not a and b == foo and coroutine.status(x) == "dead")
a,b = coroutine.resume(x)
assert(not a and string.find(b, "dead") and coroutine.status(x) == "dead")
-- co-routines x for loop
function all (a, n, k)
if k == 0 then coroutine.yield(a)
else
for i=1,n do
a[k] = i
all(a, n, k-1)
end
end
end
local a = 0
for t in coroutine.wrap(function () all({}, 5, 4) end) do
a = a+1
end
assert(a == 5^4)
-- access to locals of collected corroutines
local C = {}; setmetatable(C, {__mode = "kv"})
local x = coroutine.wrap (function ()
local a = 10
local function f () a = a+10; return a end
while true do
a = a+1
coroutine.yield(f)
end
end)
C[1] = x;
local f = x()
assert(f() == 21 and x()() == 32 and x() == f)
x = nil
collectgarbage()
assert(C[1] == nil)
assert(f() == 43 and f() == 53)
-- old bug: attempt to resume itself
function co_func (current_co)
assert(coroutine.running() == current_co)
assert(coroutine.resume(current_co) == false)
coroutine.yield(10, 20)
assert(coroutine.resume(current_co) == false)
coroutine.yield(23)
return 10
end
local co = coroutine.create(co_func)
local a,b,c = coroutine.resume(co, co)
assert(a == true and b == 10 and c == 20)
a,b = coroutine.resume(co, co)
assert(a == true and b == 23)
a,b = coroutine.resume(co, co)
assert(a == true and b == 10)
assert(coroutine.resume(co, co) == false)
assert(coroutine.resume(co, co) == false)
-- other old bug when attempting to resume itself
-- (trigger C-code assertions)
do
local A = coroutine.running()
local B = coroutine.create(function() return coroutine.resume(A) end)
local st, res = coroutine.resume(B)
assert(st == true and res == false)
A = coroutine.wrap(function() return pcall(A, 1) end)
st, res = A()
assert(not st and string.find(res, "non%-suspended"))
end
-- attempt to resume 'normal' coroutine
local co1, co2
co1 = coroutine.create(function () return co2() end)
co2 = coroutine.wrap(function ()
assert(coroutine.status(co1) == 'normal')
assert(not coroutine.resume(co1))
coroutine.yield(3)
end)
a,b = coroutine.resume(co1)
assert(a and b == 3)
assert(coroutine.status(co1) == 'dead')
-- infinite recursion of coroutines
a = function(a) coroutine.wrap(a)(a) end
assert(not pcall(a, a))
a = nil
-- access to locals of erroneous coroutines
local x = coroutine.create (function ()
local a = 10
_G.f = function () a=a+1; return a end
error('x')
end)
assert(not coroutine.resume(x))
-- overwrite previous position of local `a'
assert(not coroutine.resume(x, 1, 1, 1, 1, 1, 1, 1))
assert(_G.f() == 11)
assert(_G.f() == 12)
if not T then
(Message or print)('\n >>> testC not active: skipping yield/hook tests <<<\n')
else
print "testing yields inside hooks"
local turn
function fact (t, x)
assert(turn == t)
if x == 0 then return 1
else return x*fact(t, x-1)
end
end
local A, B = 0, 0
local x = coroutine.create(function ()
T.sethook("yield 0", "", 2)
A = fact("A", 6)
end)
local y = coroutine.create(function ()
T.sethook("yield 0", "", 3)
B = fact("B", 7)
end)
while A==0 or B==0 do -- A ~= 0 when 'x' finishes (similar for 'B','y')
if A==0 then turn = "A"; assert(T.resume(x)) end
if B==0 then turn = "B"; assert(T.resume(y)) end
end
assert(B // A == 7) -- fact(7) // fact(6)
local line = debug.getinfo(1, "l").currentline + 2 -- get line number
local function foo ()
local x = 10 --<< this line is 'line'
x = x + 10
_G.XX = x
end
-- testing yields in line hook
local co = coroutine.wrap(function ()
T.sethook("setglobal X; yield 0", "l", 0); foo(); return 10 end)
_G.XX = nil;
_G.X = nil; co(); assert(_G.X == line)
_G.X = nil; co(); assert(_G.X == line + 1)
_G.X = nil; co(); assert(_G.X == line + 2 and _G.XX == nil)
_G.X = nil; co(); assert(_G.X == line + 3 and _G.XX == 20)
assert(co() == 10)
-- testing yields in count hook
co = coroutine.wrap(function ()
T.sethook("yield 0", "", 1); foo(); return 10 end)
_G.XX = nil;
local c = 0
repeat c = c + 1; local a = co() until a == 10
assert(_G.XX == 20 and c >= 5)
co = coroutine.wrap(function ()
T.sethook("yield 0", "", 2); foo(); return 10 end)
_G.XX = nil;
local c = 0
repeat c = c + 1; local a = co() until a == 10
assert(_G.XX == 20 and c >= 5)
_G.X = nil; _G.XX = nil
do
-- testing debug library on a coroutine suspended inside a hook
-- (bug in 5.2/5.3)
c = coroutine.create(function (a, ...)
T.sethook("yield 0", "l") -- will yield on next two lines
assert(a == 10)
return ...
end)
assert(coroutine.resume(c, 1, 2, 3)) -- start coroutine
local n,v = debug.getlocal(c, 0, 1) -- check its local
assert(n == "a" and v == 1)
n,v = debug.getlocal(c, 0, -1) -- check varargs
assert(v == 2)
n,v = debug.getlocal(c, 0, -2)
assert(v == 3)
assert(debug.setlocal(c, 0, 1, 10)) -- test 'setlocal'
assert(debug.setlocal(c, 0, -2, 20))
local t = debug.getinfo(c, 0) -- test 'getinfo'
assert(t.currentline == t.linedefined + 1)
assert(not debug.getinfo(c, 1)) -- no other level
assert(coroutine.resume(c)) -- run next line
v = {coroutine.resume(c)} -- finish coroutine
assert(v[1] == true and v[2] == 2 and v[3] == 20 and v[4] == nil)
assert(not coroutine.resume(c))
end
do
-- testing debug library on last function in a suspended coroutine
-- (bug in 5.2/5.3)
local c = coroutine.create(function () T.testC("yield 1", 10, 20) end)
local a, b = coroutine.resume(c)
assert(a and b == 20)
assert(debug.getinfo(c, 0).linedefined == -1)
a, b = debug.getlocal(c, 0, 2)
assert(b == 10)
end
print "testing coroutine API"
-- reusing a thread
assert(T.testC([[
newthread # create thread
pushvalue 2 # push body
pushstring 'a a a' # push argument
xmove 0 3 2 # move values to new thread
resume -1, 1 # call it first time
pushstatus
xmove 3 0 0 # move results back to stack
setglobal X # result
setglobal Y # status
pushvalue 2 # push body (to call it again)
pushstring 'b b b'
xmove 0 3 2
resume -1, 1 # call it again
pushstatus
xmove 3 0 0
return 1 # return result
]], function (...) return ... end) == 'b b b')
assert(X == 'a a a' and Y == 'OK')
-- resuming running coroutine
C = coroutine.create(function ()
return T.testC([[
pushnum 10;
pushnum 20;
resume -3 2;
pushstatus
gettop;
return 3]], C)
end)
local a, b, c, d = coroutine.resume(C)
assert(a == true and string.find(b, "non%-suspended") and
c == "ERRRUN" and d == 4)
a, b, c, d = T.testC([[
rawgeti R 1 # get main thread
pushnum 10;
pushnum 20;
resume -3 2;
pushstatus
gettop;
return 4]])
assert(a == coroutine.running() and string.find(b, "non%-suspended") and
c == "ERRRUN" and d == 4)
-- using a main thread as a coroutine
local state = T.newstate()
T.loadlib(state)
assert(T.doremote(state, [[
coroutine = require'coroutine';
X = function (x) coroutine.yield(x, 'BB'); return 'CC' end;
return 'ok']]))
t = table.pack(T.testC(state, [[
rawgeti R 1 # get main thread
pushstring 'XX'
getglobal X # get function for body
pushstring AA # arg
resume 1 1 # 'resume' shadows previous stack!
gettop
setglobal T # top
setglobal B # second yielded value
setglobal A # fist yielded value
rawgeti R 1 # get main thread
pushnum 5 # arg (noise)
resume 1 1 # after coroutine ends, previous stack is back
pushstatus
return *
]]))
assert(t.n == 4 and t[2] == 'XX' and t[3] == 'CC' and t[4] == 'OK')
assert(T.doremote(state, "return T") == '2')
assert(T.doremote(state, "return A") == 'AA')
assert(T.doremote(state, "return B") == 'BB')
T.closestate(state)
print'+'
end
-- leaving a pending coroutine open
_X = coroutine.wrap(function ()
local a = 10
local x = function () a = a+1 end
coroutine.yield()
end)
_X()
if not _soft then
-- bug (stack overflow)
local j = 2^9
local lim = 1000000 -- (C stack limit; assume 32-bit machine)
local t = {lim - 10, lim - 5, lim - 1, lim, lim + 1}
for i = 1, #t do
local j = t[i]
co = coroutine.create(function()
local t = {}
for i = 1, j do t[i] = i end
return table.unpack(t)
end)
local r, msg = coroutine.resume(co)
assert(not r)
end
co = nil
end
assert(coroutine.running() == main)
print"+"
print"testing yields inside metamethods"
local mt = {
__eq = function(a,b) coroutine.yield(nil, "eq"); return a.x == b.x end,
__lt = function(a,b) coroutine.yield(nil, "lt"); return a.x < b.x end,
__le = function(a,b) coroutine.yield(nil, "le"); return a - b <= 0 end,
__add = function(a,b) coroutine.yield(nil, "add"); return a.x + b.x end,
__sub = function(a,b) coroutine.yield(nil, "sub"); return a.x - b.x end,
__mod = function(a,b) coroutine.yield(nil, "mod"); return a.x % b.x end,
__unm = function(a,b) coroutine.yield(nil, "unm"); return -a.x end,
__bnot = function(a,b) coroutine.yield(nil, "bnot"); return ~a.x end,
__shl = function(a,b) coroutine.yield(nil, "shl"); return a.x << b.x end,
__shr = function(a,b) coroutine.yield(nil, "shr"); return a.x >> b.x end,
__band = function(a,b)
a = type(a) == "table" and a.x or a
b = type(b) == "table" and b.x or b
coroutine.yield(nil, "band")
return a & b
end,
__bor = function(a,b) coroutine.yield(nil, "bor"); return a.x | b.x end,
__bxor = function(a,b) coroutine.yield(nil, "bxor"); return a.x ~ b.x end,
__concat = function(a,b)
coroutine.yield(nil, "concat");
a = type(a) == "table" and a.x or a
b = type(b) == "table" and b.x or b
return a .. b
end,
__index = function (t,k) coroutine.yield(nil, "idx"); return t.k[k] end,
__newindex = function (t,k,v) coroutine.yield(nil, "nidx"); t.k[k] = v end,
}
local function new (x)
return setmetatable({x = x, k = {}}, mt)
end
local a = new(10)
local b = new(12)
local c = new"hello"
local function run (f, t)
local i = 1
local c = coroutine.wrap(f)
while true do
local res, stat = c()
if res then assert(t[i] == nil); return res, t end
assert(stat == t[i])
i = i + 1
end
end
assert(run(function () if (a>=b) then return '>=' else return '<' end end,
{"le", "sub"}) == "<")
-- '<=' using '<'
mt.__le = nil
assert(run(function () if (a<=b) then return '<=' else return '>' end end,
{"lt"}) == "<=")
assert(run(function () if (a==b) then return '==' else return '~=' end end,
{"eq"}) == "~=")
assert(run(function () return a & b + a end, {"add", "band"}) == 2)
assert(run(function () return a % b end, {"mod"}) == 10)
assert(run(function () return ~a & b end, {"bnot", "band"}) == ~10 & 12)
assert(run(function () return a | b end, {"bor"}) == 10 | 12)
assert(run(function () return a ~ b end, {"bxor"}) == 10 ~ 12)
assert(run(function () return a << b end, {"shl"}) == 10 << 12)
assert(run(function () return a >> b end, {"shr"}) == 10 >> 12)
assert(run(function () return a..b end, {"concat"}) == "1012")
assert(run(function() return a .. b .. c .. a end,
{"concat", "concat", "concat"}) == "1012hello10")
assert(run(function() return "a" .. "b" .. a .. "c" .. c .. b .. "x" end,
{"concat", "concat", "concat"}) == "ab10chello12x")
do -- a few more tests for comparsion operators
local mt1 = {
__le = function (a,b)
coroutine.yield(10)
return
(type(a) == "table" and a.x or a) <= (type(b) == "table" and b.x or b)
end,
__lt = function (a,b)
coroutine.yield(10)
return
(type(a) == "table" and a.x or a) < (type(b) == "table" and b.x or b)
end,
}
local mt2 = { __lt = mt1.__lt } -- no __le
local function run (f)
local co = coroutine.wrap(f)
local res
repeat
res = co()
until res ~= 10
return res
end
local function test ()
local a1 = setmetatable({x=1}, mt1)
local a2 = setmetatable({x=2}, mt2)
assert(a1 < a2)
assert(a1 <= a2)
assert(1 < a2)
assert(1 <= a2)
assert(2 > a1)
assert(2 >= a2)
return true
end
run(test)
end
assert(run(function ()
a.BB = print
return a.BB
end, {"nidx", "idx"}) == print)
-- getuptable & setuptable
do local _ENV = _ENV
f = function () AAA = BBB + 1; return AAA end
end
g = new(10); g.k.BBB = 10;
debug.setupvalue(f, 1, g)
assert(run(f, {"idx", "nidx", "idx"}) == 11)
assert(g.k.AAA == 11)
print"+"
print"testing yields inside 'for' iterators"
local f = function (s, i)
if i%2 == 0 then coroutine.yield(nil, "for") end
if i < s then return i + 1 end
end
assert(run(function ()
local s = 0
for i in f, 4, 0 do s = s + i end
return s
end, {"for", "for", "for"}) == 10)
-- tests for coroutine API
if T==nil then
(Message or print)('\n >>> testC not active: skipping coroutine API tests <<<\n')
return
end
print('testing coroutine API')
local function apico (...)
local x = {...}
return coroutine.wrap(function ()
return T.testC(table.unpack(x))
end)
end
local a = {apico(
[[
pushstring errorcode
pcallk 1 0 2;
invalid command (should not arrive here)
]],
[[return *]],
"stackmark",
error
)()}
assert(#a == 4 and
a[3] == "stackmark" and
a[4] == "errorcode" and
_G.status == "ERRRUN" and
_G.ctx == 2) -- 'ctx' to pcallk
local co = apico(
"pushvalue 2; pushnum 10; pcallk 1 2 3; invalid command;",
coroutine.yield,
"getglobal status; getglobal ctx; pushvalue 2; pushstring a; pcallk 1 0 4; invalid command",
"getglobal status; getglobal ctx; return *")
assert(co() == 10)
assert(co(20, 30) == 'a')
a = {co()}
assert(#a == 10 and
a[2] == coroutine.yield and
a[5] == 20 and a[6] == 30 and
a[7] == "YIELD" and a[8] == 3 and
a[9] == "YIELD" and a[10] == 4)
assert(not pcall(co)) -- coroutine is dead now
f = T.makeCfunc("pushnum 3; pushnum 5; yield 1;")
co = coroutine.wrap(function ()
assert(f() == 23); assert(f() == 23); return 10
end)
assert(co(23,16) == 5)
assert(co(23,16) == 5)
assert(co(23,16) == 10)
-- testing coroutines with C bodies
f = T.makeCfunc([[
pushnum 102
yieldk 1 U2
cannot be here!
]],
[[ # continuation
pushvalue U3 # accessing upvalues inside a continuation
pushvalue U4
return *
]], 23, "huu")
x = coroutine.wrap(f)
assert(x() == 102)
eqtab({x()}, {23, "huu"})
f = T.makeCfunc[[pushstring 'a'; pushnum 102; yield 2; ]]
a, b, c, d = T.testC([[newthread; pushvalue 2; xmove 0 3 1; resume 3 0;
pushstatus; xmove 3 0 0; resume 3 0; pushstatus;
return 4; ]], f)
assert(a == 'YIELD' and b == 'a' and c == 102 and d == 'OK')
-- testing chain of suspendable C calls
local count = 3 -- number of levels
f = T.makeCfunc([[
remove 1; # remove argument
pushvalue U3; # get selection function
call 0 1; # call it (result is 'f' or 'yield')
pushstring hello # single argument for selected function
pushupvalueindex 2; # index of continuation program
callk 1 -1 .; # call selected function
errorerror # should never arrive here
]],
[[
# continuation program
pushnum 34 # return value
return * # return all results
]],
function () -- selection function
count = count - 1
if count == 0 then return coroutine.yield
else return f
end
end
)
co = coroutine.wrap(function () return f(nil) end)
assert(co() == "hello") -- argument to 'yield'
a = {co()}
-- three '34's (one from each pending C call)
assert(#a == 3 and a[1] == a[2] and a[2] == a[3] and a[3] == 34)
-- testing yields with continuations
co = coroutine.wrap(function (...) return
T.testC([[ # initial function
yieldk 1 2
cannot be here!
]],
[[ # 1st continuation
yieldk 0 3
cannot be here!
]],
[[ # 2nd continuation
yieldk 0 4
cannot be here!
]],
[[ # 3th continuation
pushvalue 6 # function which is last arg. to 'testC' here
pushnum 10; pushnum 20;
pcall 2 0 0 # call should throw an error and return to next line
pop 1 # remove error message
pushvalue 6
getglobal status; getglobal ctx
pcallk 2 2 5 # call should throw an error and jump to continuation
cannot be here!
]],
[[ # 4th (and last) continuation
return *
]],
-- function called by 3th continuation
function (a,b) x=a; y=b; error("errmsg") end,
...
)
end)
local a = {co(3,4,6)}
assert(a[1] == 6 and a[2] == nil)
a = {co()}; assert(a[1] == nil and _G.status == "YIELD" and _G.ctx == 2)
a = {co()}; assert(a[1] == nil and _G.status == "YIELD" and _G.ctx == 3)
a = {co(7,8)};
-- original arguments
assert(type(a[1]) == 'string' and type(a[2]) == 'string' and
type(a[3]) == 'string' and type(a[4]) == 'string' and
type(a[5]) == 'string' and type(a[6]) == 'function')
-- arguments left from fist resume
assert(a[7] == 3 and a[8] == 4)
-- arguments to last resume
assert(a[9] == 7 and a[10] == 8)
-- error message and nothing more
assert(a[11]:find("errmsg") and #a == 11)
-- check arguments to pcallk
assert(x == "YIELD" and y == 4)
assert(not pcall(co)) -- coroutine should be dead
-- bug in nCcalls
local co = coroutine.wrap(function ()
local a = {pcall(pcall,pcall,pcall,pcall,pcall,pcall,pcall,error,"hi")}
return pcall(assert, table.unpack(a))
end)
local a = {co()}
assert(a[10] == "hi")
print'OK'
| mit |
lambd0x/Awesome-wm-Funtoo-GreenInfinity | awesome/lain/widget/contrib/tpbat/smapi.lua | 3 | 3180 |
--[[
smapi.lua
Interface with thinkpad battery information
Licensed under GNU General Public License v2
* (c) 2013, Conor Heine
--]]
local first_line = require("lain.helpers").first_line
local string = { format = string.format }
local tonumber = tonumber
local setmetatable = setmetatable
local smapi = {}
local apipath = "/sys/devices/platform/smapi"
-- Most are readable values, but some can be written to (not implemented, yet?)
local readable = {
barcoding = true,
charging_max_current = true,
charging_max_voltage = true,
chemistry = true,
current_avg = true,
current_now = true,
cycle_count = true,
design_capacity = true,
design_voltage = true,
dump = true,
first_use_date = true,
force_discharge = false,
group0_voltage = true,
group1_voltage = true,
group2_voltage = true,
group3_voltage = true,
inhibit_charge_minutes = false,
installed = true,
last_full_capacity = true,
manufacture_date = true,
manufacturer = true,
model = true,
power_avg = true,
power_now = true,
remaining_capacity = true,
remaining_charging_time = true,
remaining_percent = true,
remaining_percent_error = true,
remaining_running_time = true,
remaining_running_time_now = true,
serial = true,
start_charge_thresh = false,
state = true,
stop_charge_thresh = false,
temperature = true,
voltage = true,
}
function smapi:battery(name)
local bat = {}
bat.name = name
bat.path = apipath .. "/" .. name
function bat:get(item)
return self.path ~= nil and readable[item] and first_line(self.path .. "/" .. item) or nil
end
function bat:installed()
return self:get("installed") == "1"
end
function bat:status()
return self:get('state')
end
-- Remaining time can either be time until battery dies or time until charging completes
function bat:remaining_time()
local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time'
local mins_left = self:get(time_val)
if not mins_left:find("^%d+") then return "N/A" end
local hrs = math.floor(mins_left / 60)
local min = mins_left % 60
return string.format("%02d:%02d", hrs, min)
end
function bat:percent()
return tonumber(self:get("remaining_percent"))
end
return setmetatable(bat, {__metatable = false, __newindex = false})
end
return smapi
| gpl-2.0 |
jackywgw/ntopng_test | scripts/lua/get_host_data.lua | 2 | 3639 | --
-- (C) 2013-15 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
sendHTTPHeader('text/html; charset=iso-8859-1')
function getNetworkStats(network)
local hosts_stats,total = aggregateHostsStats(interface.getHostsInfo())
my_network = nil
for key, value in pairs(hosts_stats) do
h = hosts_stats[key]
nw_name = h["local_network_name"]
if(h["local_network_name"] == network) then
--io.write(nw_name.."\n")
if(nw_name ~= nil) then
if(my_network == nil) then
h["ip"] = nw_name
h["name"] = nw_name
my_network = h
else
my_network["num_alerts"] = my_network["num_alerts"] + h["num_alerts"]
my_network["throughput_bps"] = my_network["throughput_bps"] + h["throughput_bps"]
my_network["throughput_pps"] = my_network["throughput_pps"] + h["throughput_pps"]
my_network["last_throughput_bps"] = my_network["last_throughput_bps"] + h["last_throughput_bps"]
my_network["last_throughput_pps"] = my_network["last_throughput_pps"] + h["last_throughput_pps"]
my_network["bytes.sent"] = my_network["bytes.sent"] + h["bytes.sent"]
my_network["bytes.rcvd"] = my_network["bytes.rcvd"] + h["bytes.rcvd"]
if(my_network["seen.first"] > h["seen.first"]) then
my_network["seen.first"] = h["seen.first"]
end
if(my_network["seen.last"] < h["seen.last"]) then
my_network["seen.last"] = h["seen.last"]
end
end
end
end
end
return(my_network)
end
-- sendHTTPHeader('application/json')
interface.select(ifname)
host_info = url2hostinfo(_GET)
interface.select(ifname)
if(host_info["host"] ~= nil) then
if(string.contains(host_info["host"], "/")) then
-- This is a network
host = getNetworkStats(host_info["host"])
else
host = interface.getHostInfo(host_info["host"], host_info["vlan"])
end
else
host = interface.getAggregatedHostInfo(host_info["host"])
end
if(host == nil) then
print('{}')
else
print('{')
now = os.time()
-- Get from redis the throughput type bps or pps
throughput_type = getThroughputType()
print("\"column_since\" : \"" .. secondsToTime(now-host["seen.first"]+1) .. "\", ")
print("\"column_last\" : \"" .. secondsToTime(now-host["seen.last"]+1) .. "\", ")
print("\"column_traffic\" : \"" .. bytesToSize(host["bytes.sent"]+host["bytes.rcvd"]).. "\", ")
if((host["throughput_trend_"..throughput_type] ~= nil)
and (host["throughput_trend_"..throughput_type] > 0)) then
if(throughput_type == "pps") then
print ("\"column_thpt\" : \"" .. pktsToSize(host["throughput_bps"]).. " ")
else
print ("\"column_thpt\" : \"" .. bitsToSize(8*host["throughput_bps"]).. " ")
end
if(host["throughput_"..throughput_type] > host["last_throughput_"..throughput_type]) then
print("<i class='fa fa-arrow-up'></i>")
elseif(host["throughput_"..throughput_type] < host["last_throughput_"..throughput_type]) then
print("<i class='fa fa-arrow-down'></i>")
else
print("<i class='fa fa-minus'></i>")
end
print("\",")
else
print ("\"column_thpt\" : \"0 "..throughput_type.."\",")
end
sent2rcvd = round((host["bytes.sent"] * 100) / (host["bytes.sent"]+host["bytes.rcvd"]), 0)
print ("\"column_breakdown\" : \"<div class='progress'><div class='progress-bar progress-bar-warning' style='width: "
.. sent2rcvd .."%;'>Sent</div><div class='progress-bar progress-bar-info' style='width: " .. (100-sent2rcvd) .. "%;'>Rcvd</div></div>")
print("\" } ")
end | gpl-3.0 |
Canaan-Creative/luci | modules/admin-core/luasrc/controller/admin/servicectl.lua | 76 | 1376 | --[[
LuCI - Lua Configuration Interface
Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
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
$Id$
]]--
module("luci.controller.admin.servicectl", package.seeall)
function index()
entry({"servicectl"}, alias("servicectl", "status")).sysauth = "root"
entry({"servicectl", "status"}, call("action_status")).leaf = true
entry({"servicectl", "restart"}, call("action_restart")).leaf = true
end
function action_status()
local data = nixio.fs.readfile("/var/run/luci-reload-status")
if data then
luci.http.write("/etc/config/")
luci.http.write(data)
else
luci.http.write("finish")
end
end
function action_restart(args)
local uci = require "luci.model.uci".cursor()
if args then
local service
local services = { }
for service in args:gmatch("[%w_-]+") do
services[#services+1] = service
end
local command = uci:apply(services, true)
if nixio.fork() == 0 then
local i = nixio.open("/dev/null", "r")
local o = nixio.open("/dev/null", "w")
nixio.dup(i, nixio.stdin)
nixio.dup(o, nixio.stdout)
i:close()
o:close()
nixio.exec("/bin/sh", unpack(command))
else
luci.http.write("OK")
os.exit(0)
end
end
end
| apache-2.0 |
Jarhmander/ile | modules/lpeg-0.12/re.lua | 160 | 6286 | -- $Id: re.lua,v 1.44 2013/03/26 20:11:40 roberto Exp $
-- imported functions and modules
local tonumber, type, print, error = tonumber, type, print, error
local setmetatable = setmetatable
local m = require"lpeg"
-- 'm' will be used to parse expressions, and 'mm' will be used to
-- create expressions; that is, 're' runs on 'm', creating patterns
-- on 'mm'
local mm = m
-- pattern's metatable
local mt = getmetatable(mm.P(0))
-- No more global accesses after this point
local version = _VERSION
if version == "Lua 5.2" then _ENV = nil end
local any = m.P(1)
-- Pre-defined names
local Predef = { nl = m.P"\n" }
local mem
local fmem
local gmem
local function updatelocale ()
mm.locale(Predef)
Predef.a = Predef.alpha
Predef.c = Predef.cntrl
Predef.d = Predef.digit
Predef.g = Predef.graph
Predef.l = Predef.lower
Predef.p = Predef.punct
Predef.s = Predef.space
Predef.u = Predef.upper
Predef.w = Predef.alnum
Predef.x = Predef.xdigit
Predef.A = any - Predef.a
Predef.C = any - Predef.c
Predef.D = any - Predef.d
Predef.G = any - Predef.g
Predef.L = any - Predef.l
Predef.P = any - Predef.p
Predef.S = any - Predef.s
Predef.U = any - Predef.u
Predef.W = any - Predef.w
Predef.X = any - Predef.x
mem = {} -- restart memoization
fmem = {}
gmem = {}
local mt = {__mode = "v"}
setmetatable(mem, mt)
setmetatable(fmem, mt)
setmetatable(gmem, mt)
end
updatelocale()
local I = m.P(function (s,i) print(i, s:sub(1, i-1)); return i end)
local function getdef (id, defs)
local c = defs and defs[id]
if not c then error("undefined name: " .. id) end
return c
end
local function patt_error (s, i)
local msg = (#s < i + 20) and s:sub(i)
or s:sub(i,i+20) .. "..."
msg = ("pattern error near '%s'"):format(msg)
error(msg, 2)
end
local function mult (p, n)
local np = mm.P(true)
while n >= 1 do
if n%2 >= 1 then np = np * p end
p = p * p
n = n/2
end
return np
end
local function equalcap (s, i, c)
if type(c) ~= "string" then return nil end
local e = #c + i
if s:sub(i, e - 1) == c then return e else return nil end
end
local S = (Predef.space + "--" * (any - Predef.nl)^0)^0
local name = m.R("AZ", "az", "__") * m.R("AZ", "az", "__", "09")^0
local arrow = S * "<-"
local seq_follow = m.P"/" + ")" + "}" + ":}" + "~}" + "|}" + (name * arrow) + -1
name = m.C(name)
-- a defined name only have meaning in a given environment
local Def = name * m.Carg(1)
local num = m.C(m.R"09"^1) * S / tonumber
local String = "'" * m.C((any - "'")^0) * "'" +
'"' * m.C((any - '"')^0) * '"'
local defined = "%" * Def / function (c,Defs)
local cat = Defs and Defs[c] or Predef[c]
if not cat then error ("name '" .. c .. "' undefined") end
return cat
end
local Range = m.Cs(any * (m.P"-"/"") * (any - "]")) / mm.R
local item = defined + Range + m.C(any)
local Class =
"["
* (m.C(m.P"^"^-1)) -- optional complement symbol
* m.Cf(item * (item - "]")^0, mt.__add) /
function (c, p) return c == "^" and any - p or p end
* "]"
local function adddef (t, k, exp)
if t[k] then
error("'"..k.."' already defined as a rule")
else
t[k] = exp
end
return t
end
local function firstdef (n, r) return adddef({n}, n, r) end
local function NT (n, b)
if not b then
error("rule '"..n.."' used outside a grammar")
else return mm.V(n)
end
end
local exp = m.P{ "Exp",
Exp = S * ( m.V"Grammar"
+ m.Cf(m.V"Seq" * ("/" * S * m.V"Seq")^0, mt.__add) );
Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^0 , mt.__mul)
* (#seq_follow + patt_error);
Prefix = "&" * S * m.V"Prefix" / mt.__len
+ "!" * S * m.V"Prefix" / mt.__unm
+ m.V"Suffix";
Suffix = m.Cf(m.V"Primary" * S *
( ( m.P"+" * m.Cc(1, mt.__pow)
+ m.P"*" * m.Cc(0, mt.__pow)
+ m.P"?" * m.Cc(-1, mt.__pow)
+ "^" * ( m.Cg(num * m.Cc(mult))
+ m.Cg(m.C(m.S"+-" * m.R"09"^1) * m.Cc(mt.__pow))
)
+ "->" * S * ( m.Cg((String + num) * m.Cc(mt.__div))
+ m.P"{}" * m.Cc(nil, m.Ct)
+ m.Cg(Def / getdef * m.Cc(mt.__div))
)
+ "=>" * S * m.Cg(Def / getdef * m.Cc(m.Cmt))
) * S
)^0, function (a,b,f) return f(a,b) end );
Primary = "(" * m.V"Exp" * ")"
+ String / mm.P
+ Class
+ defined
+ "{:" * (name * ":" + m.Cc(nil)) * m.V"Exp" * ":}" /
function (n, p) return mm.Cg(p, n) end
+ "=" * name / function (n) return mm.Cmt(mm.Cb(n), equalcap) end
+ m.P"{}" / mm.Cp
+ "{~" * m.V"Exp" * "~}" / mm.Cs
+ "{|" * m.V"Exp" * "|}" / mm.Ct
+ "{" * m.V"Exp" * "}" / mm.C
+ m.P"." * m.Cc(any)
+ (name * -arrow + "<" * name * ">") * m.Cb("G") / NT;
Definition = name * arrow * m.V"Exp";
Grammar = m.Cg(m.Cc(true), "G") *
m.Cf(m.V"Definition" / firstdef * m.Cg(m.V"Definition")^0,
adddef) / mm.P
}
local pattern = S * m.Cg(m.Cc(false), "G") * exp / mm.P * (-any + patt_error)
local function compile (p, defs)
if mm.type(p) == "pattern" then return p end -- already compiled
local cp = pattern:match(p, 1, defs)
if not cp then error("incorrect pattern", 3) end
return cp
end
local function match (s, p, i)
local cp = mem[p]
if not cp then
cp = compile(p)
mem[p] = cp
end
return cp:match(s, i or 1)
end
local function find (s, p, i)
local cp = fmem[p]
if not cp then
cp = compile(p) / 0
cp = mm.P{ mm.Cp() * cp * mm.Cp() + 1 * mm.V(1) }
fmem[p] = cp
end
local i, e = cp:match(s, i or 1)
if i then return i, e - 1
else return i
end
end
local function gsub (s, p, rep)
local g = gmem[p] or {} -- ensure gmem[p] is not collected while here
gmem[p] = g
local cp = g[rep]
if not cp then
cp = compile(p)
cp = mm.Cs((cp / rep + 1)^0)
g[rep] = cp
end
return cp:match(s)
end
-- exported names
local re = {
compile = compile,
match = match,
find = find,
gsub = gsub,
updatelocale = updatelocale,
}
if version == "Lua 5.1" then _G.re = re end
return re
| mit |
alastair-robertson/awesome | lib/awful/layout/suit/fair.lua | 3 | 2639 | ---------------------------------------------------------------------------
--- Fair layouts module for awful
--
-- @author Josh Komoroske
-- @copyright 2012 Josh Komoroske
-- @release @AWESOME_VERSION@
-- @module awful.layout.suit.fair
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local math = math
local fair = {}
local function do_fair(p, orientation)
local wa = p.workarea
local cls = p.clients
-- Swap workarea dimensions, if our orientation is "east"
if orientation == 'east' then
wa.width, wa.height = wa.height, wa.width
wa.x, wa.y = wa.y, wa.x
end
if #cls > 0 then
local rows, cols
if #cls == 2 then
rows, cols = 1, 2
else
rows = math.ceil(math.sqrt(#cls))
cols = math.ceil(#cls / rows)
end
for k, c in ipairs(cls) do
k = k - 1
local g = {}
local row, col
row = k % rows
col = math.floor(k / rows)
local lrows, lcols
if k >= rows * cols - rows then
lrows = #cls - (rows * cols - rows)
lcols = cols
else
lrows = rows
lcols = cols
end
if row == lrows - 1 then
g.height = wa.height - math.ceil(wa.height / lrows) * row
g.y = wa.height - g.height
else
g.height = math.ceil(wa.height / lrows)
g.y = g.height * row
end
if col == lcols - 1 then
g.width = wa.width - math.ceil(wa.width / lcols) * col
g.x = wa.width - g.width
else
g.width = math.ceil(wa.width / lcols)
g.x = g.width * col
end
g.y = g.y + wa.y
g.x = g.x + wa.x
-- Swap window dimensions, if our orientation is "east"
if orientation == 'east' then
g.width, g.height = g.height, g.width
g.x, g.y = g.y, g.x
end
p.geometries[c] = g
end
end
end
--- Horizontal fair layout.
-- @param screen The screen to arrange.
fair.horizontal = {}
fair.horizontal.name = "fairh"
function fair.horizontal.arrange(p)
return do_fair(p, "east")
end
--- Vertical fair layout.
-- @param screen The screen to arrange.
fair.name = "fairv"
function fair.arrange(p)
return do_fair(p, "south")
end
return fair
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
| gpl-2.0 |
logzero/ValyriaTear | img/sprites/map/enemies/spider_idle.lua | 4 | 1239 | -- Sprite animation file descriptor
-- This file will describe the frames used to load the sprite animations
-- This files is following a special format compared to other animation scripts.
local ANIM_SOUTH = vt_map.MapMode.ANIM_SOUTH;
local ANIM_NORTH = vt_map.MapMode.ANIM_NORTH;
local ANIM_WEST = vt_map.MapMode.ANIM_WEST;
local ANIM_EAST = vt_map.MapMode.ANIM_EAST;
sprite_animation = {
-- The file to load the frames from
image_filename = "img/sprites/map/enemies/spider_spritesheet.png",
-- The number of rows and columns of images, will be used to compute
-- the images width and height, and also the frames number (row x col)
rows = 4,
columns = 7,
-- The frames duration in milliseconds
frames = {
[ANIM_SOUTH] = {
[0] = { id = 0, duration = 275 },
[1] = { id = 2, duration = 275 }
},
[ANIM_NORTH] = {
[0] = { id = 14, duration = 275 },
[1] = { id = 16, duration = 275 }
},
[ANIM_WEST] = {
[0] = { id = 7, duration = 275 },
[1] = { id = 9, duration = 275 }
},
[ANIM_EAST] = {
[0] = { id = 21, duration = 275 },
[1] = { id = 23, duration = 275 }
}
}
}
| gpl-2.0 |
pydsigner/naev | dat/ai/sirius.lua | 5 | 1516 | include("dat/ai/tpl/generic.lua")
include("dat/ai/personality/patrol.lua")
-- Settings
mem.armour_run = 0
mem.armour_return = 0
mem.aggressive = true
function create ()
-- Not too many credits.
ai.setcredits( rnd.rnd(ai.shipprice()/200, ai.shipprice()/50) )
-- Get refuel chance
p = ai.getPlayer()
if ai.exists(p) then
standing = ai.getstanding( p ) or -1
mem.refuel = rnd.rnd( 1000, 2000 )
if standing < 70 then
mem.refuel_no = "\"I do not have fuel to spare.\""
else
mem.refuel = mem.refuel * 0.6
end
-- Most likely no chance to refuel
mem.refuel_msg = string.format( "\"I would be able to refuel your ship for %d credits.\"", mem.refuel )
end
-- Can't be bribed
bribe_no = {
"\"Your money is of no interest to me.\""
}
mem.bribe_no = bribe_no[ rnd.rnd(1,#bribe_no) ]
mem.loiter = 2 -- This is the amount of waypoints the pilot will pass through before leaving the system
-- Finish up creation
create_post()
end
-- taunts
function taunt ( target, offense )
-- Only 50% of actually taunting.
if rnd.rnd(0,1) == 0 then
return
end
-- some taunts
if offense then
taunts = {
"The universe shall be cleansed of your presence!"
}
else
taunts = {
"Sirichana protect me!",
"You have made a grave error!",
"You do wrong in your provocations!"
}
end
ai.comm(target, taunts[ rnd.rnd(1,#taunts) ])
end
| gpl-3.0 |
emadni/launcherlord | plugins/meme.lua | 637 | 5791 | local helpers = require "OAuth.helpers"
local _file_memes = './data/memes.lua'
local _cache = {}
local function post_petition(url, arguments)
local response_body = {}
local request_constructor = {
url = url,
method = "POST",
sink = ltn12.sink.table(response_body),
headers = {},
redirect = false
}
local source = arguments
if type(arguments) == "table" then
local source = helpers.url_encode_arguments(arguments)
end
request_constructor.headers["Content-Type"] = "application/x-www-form-urlencoded"
request_constructor.headers["Content-Length"] = tostring(#source)
request_constructor.source = ltn12.source.string(source)
local ok, response_code, response_headers, response_status_line = http.request(request_constructor)
if not ok then
return nil
end
response_body = json:decode(table.concat(response_body))
return response_body
end
local function upload_memes(memes)
local base = "http://hastebin.com/"
local pet = post_petition(base .. "documents", memes)
if pet == nil then
return '', ''
end
local key = pet.key
return base .. key, base .. 'raw/' .. key
end
local function analyze_meme_list()
local function get_m(res, n)
local r = "<option.*>(.*)</option>.*"
local start = string.find(res, "<option.*>", n)
if start == nil then
return nil, nil
end
local final = string.find(res, "</option>", n) + #"</option>"
local sub = string.sub(res, start, final)
local f = string.match(sub, r)
return f, final
end
local res, code = http.request('http://apimeme.com/')
local r = "<option.*>(.*)</option>.*"
local n = 0
local f, n = get_m(res, n)
local ult = {}
while f ~= nil do
print(f)
table.insert(ult, f)
f, n = get_m(res, n)
end
return ult
end
local function get_memes()
local memes = analyze_meme_list()
return {
last_time = os.time(),
memes = memes
}
end
local function load_data()
local data = load_from_file(_file_memes)
if not next(data) or data.memes == {} or os.time() - data.last_time > 86400 then
data = get_memes()
-- Upload only if changed?
link, rawlink = upload_memes(table.concat(data.memes, '\n'))
data.link = link
data.rawlink = rawlink
serialize_to_file(data, _file_memes)
end
return data
end
local function match_n_word(list1, list2)
local n = 0
for k,v in pairs(list1) do
for k2, v2 in pairs(list2) do
if v2:find(v) then
n = n + 1
end
end
end
return n
end
local function match_meme(name)
local _memes = load_data()
local name = name:lower():split(' ')
local max = 0
local id = nil
for k,v in pairs(_memes.memes) do
local n = match_n_word(name, v:lower():split(' '))
if n > 0 and n > max then
max = n
id = v
end
end
return id
end
local function generate_meme(id, textup, textdown)
local base = "http://apimeme.com/meme"
local arguments = {
meme=id,
top=textup,
bottom=textdown
}
return base .. "?" .. helpers.url_encode_arguments(arguments)
end
local function get_all_memes_names()
local _memes = load_data()
local text = 'Last time: ' .. _memes.last_time .. '\n-----------\n'
for k, v in pairs(_memes.memes) do
text = text .. '- ' .. v .. '\n'
end
text = text .. '--------------\n' .. 'You can see the images here: http://apimeme.com/'
return text
end
local function callback_send(cb_extra, success, data)
if success == 0 then
send_msg(cb_extra.receiver, "Something wrong happened, probably that meme had been removed from server: " .. cb_extra.url, ok_cb, false)
end
end
local function run(msg, matches)
local receiver = get_receiver(msg)
if matches[1] == 'list' then
local _memes = load_data()
return 'I have ' .. #_memes.memes .. ' meme names.\nCheck this link to see all :)\n' .. _memes.link
elseif matches[1] == 'listall' then
if not is_sudo(msg) then
return "You can't list this way, use \"!meme list\""
else
return get_all_memes_names()
end
elseif matches[1] == "search" then
local meme_id = match_meme(matches[2])
if meme_id == nil then
return "I can't match that search with any meme."
end
return "With that search your meme is " .. meme_id
end
local searchterm = string.gsub(matches[1]:lower(), ' ', '')
local meme_id = _cache[searchterm] or match_meme(matches[1])
if not meme_id then
return 'I don\'t understand the meme name "' .. matches[1] .. '"'
end
_cache[searchterm] = meme_id
print("Generating meme: " .. meme_id .. " with texts " .. matches[2] .. ' and ' .. matches[3])
local url_gen = generate_meme(meme_id, matches[2], matches[3])
send_photo_from_url(receiver, url_gen, callback_send, {receiver=receiver, url=url_gen})
return nil
end
return {
description = "Generate a meme image with up and bottom texts.",
usage = {
"!meme search (name): Return the name of the meme that match.",
"!meme list: Return the link where you can see the memes.",
"!meme listall: Return the list of all memes. Only admin can call it.",
'!meme [name] - [text_up] - [text_down]: Generate a meme with the picture that match with that name with the texts provided.',
'!meme [name] "[text_up]" "[text_down]": Generate a meme with the picture that match with that name with the texts provided.',
},
patterns = {
"^!meme (search) (.+)$",
'^!meme (list)$',
'^!meme (listall)$',
'^!meme (.+) "(.*)" "(.*)"$',
'^!meme "(.+)" "(.*)" "(.*)"$',
"^!meme (.+) %- (.*) %- (.*)$"
},
run = run
}
| gpl-2.0 |
litmus4/sejx3 | WoW/oUF_Drk/Plugins/Experience.lua | 1 | 4282 | --[[
Elements handled:
.Experience [statusbar]
.Experience.Text [fontstring] (optional)
.Experience.Rested [statusbar] (optional)
Booleans:
- Tooltip
Functions that can be overridden from within a layout:
- PostUpdate(self, event, unit, bar, min, max)
- OverrideText(bar, unit, min, max)
--]]
local hunter = select(2, UnitClass('player')) == 'HUNTER'
local function xp(unit)
if(unit == 'pet') then
return GetPetExperience()
else
return UnitXP(unit), UnitXPMax(unit)
end
end
local function tooltip(self)
local unit = self:GetParent().unit
local min, max = xp(unit)
local bars = unit == 'pet' and 6 or 20
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT', 5, -5)
GameTooltip:AddLine(format('XP: %d / %d (%d%% - %d bars)', min, max, min / max * 100, bars))
GameTooltip:AddLine(format('Left: %d (%d%% - %d bars)', max - min, (max - min) / max * 100, bars * (max - min) / max))
if(self.exhaustion) then
GameTooltip:AddLine(format('|cff0090ffRested: +%d (%d%%)', self.exhaustion, self.exhaustion / max * 100))
end
GameTooltip:Show()
end
local function update(self)
local bar, unit = self.Experience, self.unit
local exhaustion = GetXPExhaustion()
local min, max = xp(unit)
bar:SetMinMaxValues(0, max)
bar:SetValue(min)
bar:Show()
if(bar.Text) then
if(bar.OverrideText) then
bar:OverrideText(unit, min, max)
else
bar.Text:SetFormattedText('%d / %d', min, max)
end
end
if(bar.Rested) then
if(unit == 'player' and exhaustion and exhaustion > 0) then
bar.Rested:SetMinMaxValues(0, max)
bar.Rested:SetValue(math.min(min + exhaustion, max))
bar.exhaustion = exhaustion
else
bar.Rested:SetMinMaxValues(0, 1)
bar.Rested:SetValue(0)
bar.exhaustion = nil
end
end
if(bar.PostUpdate) then
bar.PostUpdate(self, event, unit, bar, min, max)
end
end
local function argcheck(self)
local bar = self.Experience
if(self.unit == 'player') then
if(IsXPUserDisabled()) then
self:DisableElement('Experience')
self:RegisterEvent('ENABLE_XP_GAIN', function(self)
self:EnableElement('Experience')
self:UpdateElement('Experience')
end)
elseif(UnitLevel('player') == MAX_PLAYER_LEVEL) then
bar:Hide()
else
update(self)
end
elseif(self.unit == 'pet') then
if(not self.disallowVehicleSwap and UnitHasVehicleUI('player')) then
update(self)
bar:Hide()
elseif(UnitExists('pet') and UnitLevel('pet') ~= UnitLevel('player') and hunter) then
update(self)
else
bar:Hide()
end
end
end
local function petcheck(self, event, unit)
if(unit == 'player') then
argcheck(self)
end
end
local function enable(self, unit)
local bar = self.Experience
if(bar) then
if(not bar:GetStatusBarTexture()) then
bar:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
self:RegisterEvent('PLAYER_XP_UPDATE', argcheck)
self:RegisterEvent('PLAYER_LEVEL_UP', argcheck)
self:RegisterEvent('UNIT_PET', petcheck)
if(bar.Rested) then
self:RegisterEvent('UPDATE_EXHAUSTION', argcheck)
bar.Rested:SetFrameLevel(1)
end
if(hunter) then
self:RegisterEvent('UNIT_PET_EXPERIENCE', argcheck)
end
if(not self.disallowVehicleSwap) then
self:RegisterEvent('UNIT_ENTERED_VEHICLE', argcheck)
self:RegisterEvent('UNIT_EXITED_VEHICLE', argcheck)
end
if(bar.Tooltip) then
bar:EnableMouse()
bar:HookScript('OnLeave', GameTooltip_Hide)
bar:HookScript('OnEnter', tooltip)
end
bar:HookScript('OnHide', function(self)
if(self.Rested) then
self.Rested:Hide()
end
end)
bar:HookScript('OnShow', function(self)
if(self.Rested) then
self.Rested:Show()
end
end)
return true
end
end
local function disable(self)
local bar = self.Experience
if(bar) then
bar:Hide()
self:UnregisterEvent('PLAYER_XP_UPDATE', argcheck)
self:UnregisterEvent('PLAYER_LEVEL_UP', argcheck)
self:UnregisterEvent('UNIT_PET', petcheck)
if(bar.Rested) then
self:UnregisterEvent('UPDATE_EXHAUSTION', argcheck)
end
if(hunter) then
self:UnregisterEvent('UNIT_PET_EXPERIENCE', argcheck)
end
if(not self.disallowVehicleSwap) then
self:UnregisterEvent('UNIT_ENTERED_VEHICLE', argcheck)
self:UnregisterEvent('UNIT_EXITED_VEHICLE', argcheck)
end
end
end
oUF:AddElement('Experience', argcheck, enable, disable)
| mit |
ExtraTabTeam/ExtraTab | bot/extra.lua | 1 | 76642 | -- Main Bot Framework
--MaraThon Team
local M = {}
-- There are chat_id, group_id, and channel_id
function getChatId(id)
local chat = {}
local id = tostring(id)
if id:match('^-100') then
local channel_id = id:gsub('-100', '')
chat = {ID = channel_id, type = 'channel'}
else
local group_id = id:gsub('-', '')
chat = {ID = group_id, type = 'group'}
end
return chat
end
M.getChatId = getChatId
local function getInputMessageContent(file, filetype, caption)
if file:match('./') then
infile = {ID = "InputFileLocal", path_ = file}
elseif file:match('^%d+$') then
infile = {ID = "InputFileId", id_ = file}
else
infile = {ID = "InputFilePersistentId", persistent_id_ = file}
end
local inmsg = {}
local filetype = filetype:lower()
if filetype == 'animation' then
inmsg = {ID = "InputMessageAnimation", animation_ = infile, caption_ = caption}
elseif filetype == 'audio' then
inmsg = {ID = "InputMessageAudio", audio_ = infile, caption_ = caption}
elseif filetype == 'document' then
inmsg = {ID = "InputMessageDocument", document_ = infile, caption_ = caption}
elseif filetype == 'photo' then
inmsg = {ID = "InputMessagePhoto", photo_ = infile, caption_ = caption}
elseif filetype == 'sticker' then
inmsg = {ID = "InputMessageSticker", sticker_ = infile, caption_ = caption}
elseif filetype == 'video' then
inmsg = {ID = "InputMessageVideo", video_ = infile, caption_ = caption}
elseif filetype == 'voice' then
inmsg = {ID = "InputMessageVoice", voice_ = infile, caption_ = caption}
end
return inmsg
end
-- User can send bold, italic, and monospace text uses HTML or Markdown format.
local function getParseMode(parse_mode)
if parse_mode then
local mode = parse_mode:lower()
if mode == 'markdown' or mode == 'md' then
P = {ID = "TextParseModeMarkdown"}
elseif mode == 'html' then
P = {ID = "TextParseModeHTML"}
end
end
return P
end
-- Returns current authorization state, offline request
local function getAuthState()
tdcli_function ({
ID = "GetAuthState",
}, dl_cb, nil)
end
M.getAuthState = getAuthState
-- Sets user's phone number and sends authentication code to the user. Works only when authGetState returns authStateWaitPhoneNumber. If phone number is not recognized or another error has happened, returns an error. Otherwise returns authStateWaitCode
-- @phone_number User's phone number in any reasonable format @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False
local function setAuthPhoneNumber(phone_number, allow_flash_call, is_current_phone_number)
tdcli_function ({
ID = "SetAuthPhoneNumber",
phone_number_ = phone_number,
allow_flash_call_ = allow_flash_call,
is_current_phone_number_ = is_current_phone_number
}, dl_cb, nil)
end
M.setAuthPhoneNumber = setAuthPhoneNumber
-- Resends authentication code to the user. Works only when authGetState returns authStateWaitCode and next_code_type of result is not null. Returns authStateWaitCode on success
local function getInputFile(file)
if file:match('/') then
infile = {ID = "InputFileLocal", path_ = file}
elseif file:match('^%d+$') then
infile = {ID = "InputFileId", id_ = file}
else
infile = {ID = "InputFilePersistentId", persistent_id_ = file}
end
return infile
end
M.getlnputFile = getlnputFile
--dkdkdkd
local function resendAuthCode()
tdcli_function ({
ID = "ResendAuthCode",
}, dl_cb, nil)
end
M.resendAuthCode = resendAuthCode
-- Checks authentication code. Works only when authGetState returns authStateWaitCode. Returns authStateWaitPassword or authStateOk on success @code Verification code from SMS, Telegram message, voice call or flash call
-- @first_name User first name, if user is yet not registered, 1-255 characters @last_name Optional user last name, if user is yet not registered, 0-255 characters
local function checkAuthCode(code, first_name, last_name)
tdcli_function ({
ID = "CheckAuthCode",
code_ = code,
first_name_ = first_name,
last_name_ = last_name
}, dl_cb, nil)
end
M.checkAuthCode = checkAuthCode
-- Checks password for correctness. Works only when authGetState returns authStateWaitPassword. Returns authStateOk on success @password Password to check
local function checkAuthPassword(password)
tdcli_function ({
ID = "CheckAuthPassword",
password_ = password
}, dl_cb, nil)
end
M.checkAuthPassword = checkAuthPassword
-- Requests to send password recovery code to email. Works only when authGetState returns authStateWaitPassword. Returns authStateWaitPassword on success
local function requestAuthPasswordRecovery()
tdcli_function ({
ID = "RequestAuthPasswordRecovery",
}, dl_cb, nil)
end
M.requestAuthPasswordRecovery = requestAuthPasswordRecovery
-- Recovers password with recovery code sent to email. Works only when authGetState returns authStateWaitPassword. Returns authStateOk on success @recovery_code Recovery code to check
local function recoverAuthPassword(recovery_code)
tdcli_function ({
ID = "RecoverAuthPassword",
recovery_code_ = recovery_code
}, dl_cb, nil)
end
M.recoverAuthPassword = recoverAuthPassword
-- Logs out user. If force == false, begins to perform soft log out, returns authStateLoggingOut after completion. If force == true then succeeds almost immediately without cleaning anything at the server, but returns error with code 401 and description "Unauthorized"
-- @force If true, just delete all local data. Session will remain in list of active sessions
local function resetAuth(force)
tdcli_function ({
ID = "ResetAuth",
force_ = force or nil
}, dl_cb, nil)
end
M.resetAuth = resetAuth
-- Check bot's authentication token to log in as a bot. Works only when authGetState returns authStateWaitPhoneNumber. Can be used instead of setAuthPhoneNumber and checkAuthCode to log in. Returns authStateOk on success @token Bot token
local function checkAuthBotToken(token)
tdcli_function ({
ID = "CheckAuthBotToken",
token_ = token
}, dl_cb, nil)
end
M.checkAuthBotToken = checkAuthBotToken
-- Returns current state of two-step verification
local function getPasswordState()
tdcli_function ({
ID = "GetPasswordState",
}, dl_cb, nil)
end
M.getPasswordState = getPasswordState
-- Changes user password. If new recovery email is specified, then error EMAIL_UNCONFIRMED is returned and password change will not be applied until email will be confirmed. Application should call getPasswordState from time to time to check if email is already confirmed
-- @old_password Old user password @new_password New user password, may be empty to remove the password @new_hint New password hint, can be empty @set_recovery_email Pass True, if recovery email should be changed @new_recovery_email New recovery email, may be empty
local function setPassword(old_password, new_password, new_hint, set_recovery_email, new_recovery_email)
tdcli_function ({
ID = "SetPassword",
old_password_ = old_password,
new_password_ = new_password,
new_hint_ = new_hint,
set_recovery_email_ = set_recovery_email,
new_recovery_email_ = new_recovery_email
}, dl_cb, nil)
end
M.setPassword = setPassword
-- Returns set up recovery email @password Current user password
local function getRecoveryEmail(password)
tdcli_function ({
ID = "GetRecoveryEmail",
password_ = password
}, dl_cb, nil)
end
M.getRecoveryEmail = getRecoveryEmail
-- Changes user recovery email @password Current user password @new_recovery_email New recovery email
local function setRecoveryEmail(password, new_recovery_email)
tdcli_function ({
ID = "SetRecoveryEmail",
password_ = password,
new_recovery_email_ = new_recovery_email
}, dl_cb, nil)
end
M.setRecoveryEmail = setRecoveryEmail
-- Requests to send password recovery code to email
local function requestPasswordRecovery()
tdcli_function ({
ID = "RequestPasswordRecovery",
}, dl_cb, nil)
end
M.requestPasswordRecovery = requestPasswordRecovery
-- Recovers password with recovery code sent to email @recovery_code Recovery code to check
local function recoverPassword(recovery_code)
tdcli_function ({
ID = "RecoverPassword",
recovery_code_ = tostring(recovery_code)
}, dl_cb, nil)
end
M.recoverPassword = recoverPassword
-- Returns current logged in user
local function getMe(cb)
tdcli_function ({
ID = "GetMe",
}, cb, nil)
end
M.getMe = getMe
-- Returns information about a user by its identifier, offline request if current user is not a bot @user_id User identifier
local function getUser(user_id,cb)
tdcli_function ({
ID = "GetUser",
user_id_ = user_id
}, cb, nil)
end
M.getUser = getUser
-- Returns full information about a user by its identifier @user_id User identifier
local function getUserFull(user_id)
tdcli_function ({
ID = "GetUserFull",
user_id_ = user_id
}, dl_cb, nil)
end
M.getUserFull = getUserFull
-- Returns information about a group by its identifier, offline request if current user is not a bot @group_id Group identifier
local function getGroup(group_id)
tdcli_function ({
ID = "GetGroup",
group_id_ = getChatId(group_id).ID
}, dl_cb, nil)
end
M.getGroup = getGroup
-- Returns full information about a group by its identifier @group_id Group identifier
local function getGroupFull(group_id)
tdcli_function ({
ID = "GetGroupFull",
group_id_ = getChatId(group_id).ID
}, dl_cb, nil)
end
M.getGroupFull = getGroupFull
-- Returns information about a channel by its identifier, offline request if current user is not a bot @channel_id Channel identifier
local function getChannel(channel_id,cb)
tdcli_function ({
ID = "GetChannel",
channel_id_ = getChatId(channel_id).ID
}, cb, nil)
end
M.getChannel = getChannel
-- Returns full information about a channel by its identifier, cached for at most 1 minute @channel_id Channel identifier
local function getChannelFull(channel_id,cb)
tdcli_function ({
ID = "GetChannelFull",
channel_id_ = getChatId(channel_id).ID
}, cb, nil)
end
M.getChannelFull = getChannelFull
-- Returns information about a chat by its identifier, offline request if current user is not a bot @chat_id Chat identifier
local function getChat(chat_id)
tdcli_function ({
ID = "GetChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.getChat = getChat
-- Returns information about a message @chat_id Identifier of the chat, message belongs to @message_id Identifier of the message to get
local function getMessage(chat_id, message_id,cb)
tdcli_function ({
ID = "GetMessage",
chat_id_ = chat_id,
message_id_ = message_id
}, cb, nil)
end
M.getMessage = getMessage
-- Returns information about messages. If message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat, messages belongs to @message_ids Identifiers of the messages to get
local function getMessages(chat_id, message_ids)
tdcli_function ({
ID = "GetMessages",
chat_id_ = chat_id,
message_ids_ = message_ids -- vector
}, dl_cb, nil)
end
M.getMessages = getMessages
-- Returns information about a file, offline request @file_id Identifier of the file to get
local function getFile(file_id)
tdcli_function ({
ID = "GetFile",
file_id_ = file_id
}, dl_cb, nil)
end
M.getFile = getFile
-- Returns information about a file by its persistent id, offline request @persistent_file_id Persistent identifier of the file to get
local function getFilePersistent(persistent_file_id)
tdcli_function ({
ID = "GetFilePersistent",
persistent_file_id_ = persistent_file_id
}, dl_cb, nil)
end
M.getFilePersistent = getFilePersistent
-- BAD RESULT
-- Returns list of chats in the right order, chats are sorted by (order, chat_id) in decreasing order. For example, to get list of chats from the beginning, the offset_order should be equal 2^63 - 1 @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from @limit Maximum number of chats to be returned
local function getChats(offset_order, offset_chat_id, limit)
tdcli_function ({
ID = "GetChats",
offset_order_ = offset_order or 9223372036854775807,
offset_chat_id_ = offset_chat_id or 0,
limit_ = limit or 20
}, dl_cb, nil)
end
M.getChats = getChats
-- Searches public chat by its username. Currently only private and channel chats can be public. Returns chat if found, otherwise some error is returned @username Username to be resolved
local function searchPublicChat(username)
tdcli_function ({
ID = "SearchPublicChat",
username_ = username
}, dl_cb, nil)
end
M.searchPublicChat = searchPublicChat
-- Searches public chats by prefix of their username. Currently only private and channel (including supergroup) chats can be public. Returns meaningful number of results. Returns nothing if length of the searched username prefix is less than 5. Excludes private chats with contacts from the results @username_prefix Prefix of the username to search
local function searchPublicChats(username_prefix)
tdcli_function ({
ID = "SearchPublicChats",
username_prefix_ = username_prefix
}, dl_cb, nil)
end
M.searchPublicChats = searchPublicChats
-- Searches for specified query in the title and username of known chats, offline request. Returns chats in the order of them in the chat list @query Query to search for, if query is empty, returns up to 20 recently found chats @limit Maximum number of chats to be returned
local function searchChats(query, limit)
tdcli_function ({
ID = "SearchChats",
query_ = query,
limit_ = limit
}, dl_cb, nil)
end
M.searchChats = searchChats
-- Adds chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, at first it is removed from the list @chat_id Identifier of the chat to add
local function addRecentlyFoundChat(chat_id)
tdcli_function ({
ID = "AddRecentlyFoundChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.addRecentlyFoundChat = addRecentlyFoundChat
-- Deletes chat from the list of recently found chats @chat_id Identifier of the chat to delete
local function deleteRecentlyFoundChat(chat_id)
tdcli_function ({
ID = "DeleteRecentlyFoundChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.deleteRecentlyFoundChat = deleteRecentlyFoundChat
-- Clears list of recently found chats
local function deleteRecentlyFoundChats()
tdcli_function ({
ID = "DeleteRecentlyFoundChats",
}, dl_cb, nil)
end
M.deleteRecentlyFoundChats = deleteRecentlyFoundChats
-- Returns list of common chats with an other given user. Chats are sorted by their type and creation date @user_id User identifier @offset_chat_id Chat identifier to return chats from, use 0 for the first request @limit Maximum number of chats to be returned, up to 100
local function getCommonChats(user_id, offset_chat_id, limit)
tdcli_function ({
ID = "GetCommonChats",
user_id_ = user_id,
offset_chat_id_ = offset_chat_id,
limit_ = limit
}, dl_cb, nil)
end
M.getCommonChats = getCommonChats
-- Returns messages in a chat. Automatically calls openChat. Returns result in reverse chronological order, i.e. in order of decreasing message.message_id @chat_id Chat identifier
-- @from_message_id Identifier of the message near which we need a history, you can use 0 to get results from the beginning, i.e. from oldest to newest
-- @offset Specify 0 to get results exactly from from_message_id or negative offset to get specified message and some newer messages
-- @limit Maximum number of messages to be returned, should be positive and can't be greater than 100. If offset is negative, limit must be greater than -offset. There may be less than limit messages returned even the end of the history is not reached
local function getChatHistory(chat_id, from_message_id, offset, limit,cb)
tdcli_function ({
ID = "GetChatHistory",
chat_id_ = chat_id,
from_message_id_ = from_message_id,
offset_ = offset,
limit_ = limit
}, cb, nil)
end
M.getChatHistory = getChatHistory
-- Deletes all messages in the chat. Can't be used for channel chats @chat_id Chat identifier @remove_from_chat_list Pass true, if chat should be removed from the chat list
local function del_all_msgs(chat_id, user_id)
tdcli_function ({
ID = "DeleteMessagesFromUser",
chat_id_ = chat_id,
user_id_ = user_id
}, dl_cb, nil)
end
M.del_all_msgs = del_all_msgs
--kdjfjf
local function deleteChatHistory(chat_id, remove_from_chat_list)
tdcli_function ({
ID = "DeleteChatHistory",
chat_id_ = chat_id,
remove_from_chat_list_ = remove_from_chat_list
}, dl_cb, nil)
end
M.deleteChatHistory = deleteChatHistory
--kejfnn
local function sendPhoto(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, photo, caption)
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = from_background,
reply_markup_ = reply_markup,
input_message_content_ = {
ID = "InputMessagePhoto",
photo_ = getInputFile(photo),
added_sticker_file_ids_ = {},
width_ = 0,
height_ = 0,
caption_ = caption
},
}, dl_cb, nil)
end
M.sendPhoto = sendPhoto
-- Searches for messages with given words in the chat. Returns result in reverse chronological order, i. e. in order of decreasimg message_id. Doesn't work in secret chats @chat_id Chat identifier to search in
-- @query Query to search for @from_message_id Identifier of the message from which we need a history, you can use 0 to get results from beginning @limit Maximum number of messages to be returned, can't be greater than 100
-- @filter Filter for content of searched messages
-- filter = Empty|Animation|Audio|Document|Photo|Video|Voice|PhotoAndVideo|Url|ChatPhoto
local function searchChatMessages(chat_id, query, from_message_id, limit, filter,cb)
tdcli_function ({
ID = "SearchChatMessages",
chat_id_ = chat_id,
query_ = query,
from_message_id_ = from_message_id,
limit_ = limit,
filter_ = {
ID = 'SearchMessagesFilter' .. filter
},
},cb, nil)
end
M.searchChatMessages = searchChatMessages
--searchChatMessages chat_id:long query:string from_message_id:int limit:int filter:SearchMessagesFilter = Messages;
-- Searches for messages in all chats except secret. Returns result in reverse chronological order, i. e. in order of decreasing (date, chat_id, message_id) @query Query to search for
-- @offset_date Date of the message to search from, you can use 0 or any date in the future to get results from the beginning
-- @offset_chat_id Chat identifier of the last found message or 0 for the first request
-- @offset_message_id Message identifier of the last found message or 0 for the first request
-- @limit Maximum number of messages to be returned, can't be greater than 100
local function searchMessages(query, offset_date, offset_chat_id, offset_message_id, limit)
tdcli_function ({
ID = "SearchMessages",
query_ = query,
offset_date_ = offset_date,
offset_chat_id_ = offset_chat_id,
offset_message_id_ = offset_message_id,
limit_ = limit
}, dl_cb, nil)
end
M.searchMessages = searchMessages
-- Sends a message. Returns sent message. UpdateChatTopMessage will not be sent, so returned message should be used to update chat top message @chat_id Chat to send message @reply_to_message_id Identifier of a message to reply to or 0
-- @disable_notification Pass true, to disable notification about the message @from_background Pass true, if the message is sent from background
-- @reply_markup Bots only. Markup for replying to message @input_message_content Content of a message to send
local function sendText(chat_id, reply_to_message_id, disable_notification, text, disable_web_page_preview, parse_mode,msg)
local TextParseMode = getParseMode(parse_mode)
local entities = {}
if msg and text:match('<user>') and text:match('<user>') then
local x = string.len(text:match('(.*)<user>'))
local offset = x
local y = string.len(text:match('<user>(.*)</user>'))
local length = y
text = text:gsub('<user>','')
text = text:gsub('</user>','')
table.insert(entities,{ID="MessageEntityMentionName", offset_=0, length_=2, user_id_=234458457})
end
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = 1,
reply_markup_ = nil,
input_message_content_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = 0,
entities_ = entities,
parse_mode_ = TextParseMode,
},
}, dl_cb, nil)
end
M.sendText = sendText
--sendMessage chat_id:long reply_to_message_id:int disable_notification:Bool from_background:Bool reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message;
-- Invites bot to a chat (if it is not in the chat) and send /start to it. Bot can't be invited to a private chat other than chat with the bot. Bots can't be invited to broadcast channel chats. Returns sent message. UpdateChatTopMessage will not be sent, so returned message should be used to update chat top message
-- @bot_user_id Identifier of the bot @chat_id Identifier of the chat @parameter Hidden parameter sent to bot for deep linking (https://api.telegram.org/bots#deep-linking)
-- parameter=start|startgroup or custom as defined by bot creator
local function sendBotStartMessage(bot_user_id, chat_id, parameter)
tdcli_function ({
ID = "SendBotStartMessage",
bot_user_id_ = bot_user_id,
chat_id_ = chat_id,
parameter_ = parameter
}, dl_cb, nil)
end
M.sendBotStartMessage = sendBotStartMessage
-- Sends result of the inline query as a message. Returns sent message. UpdateChatTopMessage will not be sent, so returned message should be used to update chat top message. Always clears chat draft message @chat_id Chat to send message @reply_to_message_id Identifier of a message to reply to or 0
-- @disable_notification Pass true, to disable notification about the message @from_background Pass true, if the message is sent from background
-- @query_id Identifier of the inline query @result_id Identifier of the inline result
local function sendInlineQueryResultMessage(chat_id, reply_to_message_id, disable_notification, from_background, query_id, result_id)
tdcli_function ({
ID = "SendInlineQueryResultMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = from_background,
query_id_ = query_id,
result_id_ = result_id
}, dl_cb, nil)
end
M.sendInlineQueryResultMessage = sendInlineQueryResultMessage
-- Forwards previously sent messages. Returns forwarded messages in the same order as message identifiers passed in message_ids. If message can't be forwarded, null will be returned instead of the message. UpdateChatTopMessage will not be sent, so returned messages should be used to update chat top message
-- @chat_id Identifier of a chat to forward messages @from_chat_id Identifier of a chat to forward from @message_ids Identifiers of messages to forward
-- @disable_notification Pass true, to disable notification about the message @from_background Pass true, if the message is sent from background
local function forwardMessages(chat_id, from_chat_id, message_ids, disable_notification)
tdcli_function ({
ID = "ForwardMessages",
chat_id_ = chat_id,
from_chat_id_ = from_chat_id,
message_ids_ = message_ids, -- vector
disable_notification_ = disable_notification,
from_background_ = 1
}, dl_cb, nil)
end
M.forwardMessages = forwardMessages
-- Deletes messages. UpdateDeleteMessages will not be sent for messages deleted through that function @chat_id Chat identifier @message_ids Identifiers of messages to delete
local function deleteMessages(chat_id, message_ids)
tdcli_function ({
ID = "DeleteMessages",
chat_id_ = chat_id,
message_ids_ = message_ids -- vector {[0] = id} or {id1, id2, id3, [0] = id}
}, dl_cb, nil)
end
M.deleteMessages = deleteMessages
-- Edits text of text or game message. Non-bots can edit message in a limited period of time. Returns edited message after edit is complete server side
-- @chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup Bots only. New message reply markup @input_message_content New text content of the message. Should be of type InputMessageText
local function editMessageText(chat_id, message_id, reply_markup, text, disable_web_page_preview)
tdcli_function ({
ID = "EditMessageText",
chat_id_ = chat_id,
message_id_ = message_id,
reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup
input_message_content_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = 0,
entities_ = {}
},
}, dl_cb, nil)
end
M.editMessageText = editMessageText
-- Edits message content caption. Non-bots can edit message in a limited period of time. Returns edited message after edit is complete server side
-- @chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup Bots only. New message reply markup @caption New message content caption, 0-200 characters
local function editMessageCaption(chat_id, message_id, reply_markup, caption)
tdcli_function ({
ID = "EditMessageCaption",
chat_id_ = chat_id,
message_id_ = message_id,
reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup
caption_ = caption
}, dl_cb, nil)
end
M.editMessageCaption = editMessageCaption
-- Bots only. Edits message reply markup. Returns edited message after edit is complete server side
-- @chat_id Chat the message belongs to @message_id Identifier of the message @reply_markup New message reply markup
local function editMessageReplyMarkup(inline_message_id, reply_markup, caption)
tdcli_function ({
ID = "EditInlineMessageCaption",
inline_message_id_ = inline_message_id,
reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup
caption_ = caption
}, dl_cb, nil)
end
M.editMessageReplyMarkup = editMessageReplyMarkup
-- Bots only. Edits text of an inline text or game message sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup @input_message_content New text content of the message. Should be of type InputMessageText
local function editInlineMessageText(inline_message_id, reply_markup, text, disable_web_page_preview)
tdcli_function ({
ID = "EditInlineMessageText",
inline_message_id_ = inline_message_id,
reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup
input_message_content_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = 0,
entities_ = {}
},
}, dl_cb, nil)
end
M.editInlineMessageText = editInlineMessageText
-- Bots only. Edits caption of an inline message content sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup @caption New message content caption, 0-200 characters
local function editInlineMessageCaption(inline_message_id, reply_markup, caption)
tdcli_function ({
ID = "EditInlineMessageCaption",
inline_message_id_ = inline_message_id,
reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup
caption_ = caption
}, dl_cb, nil)
end
M.editInlineMessageCaption = editInlineMessageCaption
-- Bots only. Edits reply markup of an inline message sent via bot @inline_message_id Inline message identifier @reply_markup New message reply markup
local function editInlineMessageReplyMarkup(inline_message_id, reply_markup)
tdcli_function ({
ID = "EditInlineMessageReplyMarkup",
inline_message_id_ = inline_message_id,
reply_markup_ = reply_markup -- reply_markup:ReplyMarkup
}, dl_cb, nil)
end
M.editInlineMessageReplyMarkup = editInlineMessageReplyMarkup
-- Sends inline query to a bot and returns its results. Unavailable for bots @bot_user_id Identifier of the bot send query to @chat_id Identifier of the chat, where the query is sent @user_location User location, only if needed @query Text of the query @offset Offset of the first entry to return
local function getInlineQueryResults(bot_user_id, chat_id, latitude, longitude, query, offset)
tdcli_function ({
ID = "GetInlineQueryResults",
bot_user_id_ = bot_user_id,
chat_id_ = chat_id,
user_location_ = {
ID = "Location",
latitude_ = latitude,
longitude_ = longitude
},
query_ = query,
offset_ = offset
}, dl_cb, nil)
end
M.getInlineQueryResults = getInlineQueryResults
-- Bots only. Sets result of the inline query @inline_query_id Identifier of the inline query @is_personal Does result of the query can be cached only for specified user
-- @results Results of the query @cache_time Allowed time to cache results of the query in seconds @next_offset Offset for the next inline query, pass empty string if there is no more results
-- @switch_pm_text If non-empty, this text should be shown on the button, which opens private chat with the bot and sends bot start message with parameter switch_pm_parameter @switch_pm_parameter Parameter for the bot start message
local function answerInlineQuery(inline_query_id, is_personal, cache_time, next_offset, switch_pm_text, switch_pm_parameter)
tdcli_function ({
ID = "AnswerInlineQuery",
inline_query_id_ = inline_query_id,
is_personal_ = is_personal,
results_ = results, --vector<InputInlineQueryResult>,
cache_time_ = cache_time,
next_offset_ = next_offset,
switch_pm_text_ = switch_pm_text,
switch_pm_parameter_ = switch_pm_parameter
}, dl_cb, nil)
end
M.answerInlineQuery = answerInlineQuery
-- Sends callback query to a bot and returns answer to it. Unavailable for bots @chat_id Identifier of the chat with a message @message_id Identifier of the message, from which the query is originated @payload Query payload
local function getCallbackQueryAnswer(chat_id, message_id, text, show_alert, url)
tdcli_function ({
ID = "GetCallbackQueryAnswer",
chat_id_ = chat_id,
message_id_ = message_id,
payload_ = {
ID = "CallbackQueryAnswer",
text_ = text,
show_alert_ = show_alert,
url_ = url
},
}, dl_cb, nil)
end
M.getCallbackQueryAnswer = getCallbackQueryAnswer
-- Bots only. Sets result of the callback query @callback_query_id Identifier of the callback query @text Text of the answer @show_alert If true, an alert should be shown to the user instead of a toast @url Url to be opened @cache_time Allowed time to cache result of the query in seconds
local function answerCallbackQuery(callback_query_id, text, show_alert, url, cache_time)
tdcli_function ({
ID = "AnswerCallbackQuery",
callback_query_id_ = callback_query_id,
text_ = text,
show_alert_ = show_alert,
url_ = url,
cache_time_ = cache_time
}, dl_cb, nil)
end
M.answerCallbackQuery = answerCallbackQuery
-- Bots only. Updates game score of the specified user in the game @chat_id Chat a message with the game belongs to @message_id Identifier of the message @edit_message True, if message should be edited @user_id User identifier @score New score
-- @force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table
local function setGameScore(chat_id, message_id, edit_message, user_id, score, force)
tdcli_function ({
ID = "SetGameScore",
chat_id_ = chat_id,
message_id_ = message_id,
edit_message_ = edit_message,
user_id_ = user_id,
score_ = score,
force_ = force
}, dl_cb, nil)
end
M.setGameScore = setGameScore
-- Bots only. Updates game score of the specified user in the game @inline_message_id Inline message identifier @edit_message True, if message should be edited @user_id User identifier @score New score
-- @force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table
local function setInlineGameScore(inline_message_id, edit_message, user_id, score, force)
tdcli_function ({
ID = "SetInlineGameScore",
inline_message_id_ = inline_message_id,
edit_message_ = edit_message,
user_id_ = user_id,
score_ = score,
force_ = force
}, dl_cb, nil)
end
M.setInlineGameScore = setInlineGameScore
-- Bots only. Returns game high scores and some part of the score table around of the specified user in the game @chat_id Chat a message with the game belongs to @message_id Identifier of the message @user_id User identifie
local function getGameHighScores(chat_id, message_id, user_id)
tdcli_function ({
ID = "GetGameHighScores",
chat_id_ = chat_id,
message_id_ = message_id,
user_id_ = user_id
}, dl_cb, nil)
end
M.getGameHighScores = getGameHighScores
-- Bots only. Returns game high scores and some part of the score table around of the specified user in the game @inline_message_id Inline message identifier @user_id User identifier
local function getInlineGameHighScores(inline_message_id, user_id)
tdcli_function ({
ID = "GetInlineGameHighScores",
inline_message_id_ = inline_message_id,
user_id_ = user_id
}, dl_cb, nil)
end
M.getInlineGameHighScores = getInlineGameHighScores
-- Deletes default reply markup from chat. This method needs to be called after one-time keyboard or ForceReply reply markup has been used. UpdateChatReplyMarkup will be send if reply markup will be changed @chat_id Chat identifier
-- @message_id Message identifier of used keyboard
local function deleteChatReplyMarkup(chat_id, message_id)
tdcli_function ({
ID = "DeleteChatReplyMarkup",
chat_id_ = chat_id,
message_id_ = message_id
}, dl_cb, nil)
end
M.deleteChatReplyMarkup = deleteChatReplyMarkup
-- Sends notification about user activity in a chat @chat_id Chat identifier @action Action description
-- action = Typing|Cancel|RecordVideo|UploadVideo|RecordVoice|UploadVoice|UploadPhoto|UploadDocument|GeoLocation|ChooseContact|StartPlayGame
local function sendChatAction(chat_id, action, progress)
tdcli_function ({
ID = "SendChatAction",
chat_id_ = chat_id,
action_ = {
ID = "SendMessage" .. action .. "Action",
progress_ = progress or nil
}
}, dl_cb, nil)
end
M.sendChatAction = sendChatAction
-- Chat is opened by the user. Many useful activities depends on chat being opened or closed. For example, in channels all updates are received only for opened chats @chat_id Chat identifier
local function openChat(chat_id)
tdcli_function ({
ID = "OpenChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.openChat = openChat
-- Chat is closed by the user. Many useful activities depends on chat being opened or closed. @chat_id Chat identifier
local function closeChat(chat_id)
tdcli_function ({
ID = "CloseChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.closeChat = closeChat
-- Messages are viewed by the user. Many useful activities depends on message being viewed. For example, marking messages as read, incrementing of view counter, updating of view counter, removing of deleted messages in channels @chat_id Chat identifier @message_ids Identifiers of viewed messages
local function viewMessages(chat_id, message_ids)
tdcli_function ({
ID = "ViewMessages",
chat_id_ = chat_id,
message_ids_ = message_ids -- vector
}, dl_cb, nil)
end
M.viewMessages = viewMessages
-- Message content is opened, for example the user has opened a photo, a video, a document, a location or a venue or have listened to an audio or a voice message @chat_id Chat identifier of the message @message_id Identifier of the message with opened content
local function openMessageContent(chat_id, message_id,cb)
tdcli_function ({
ID = "OpenMessageContent",
chat_id_ = chat_id,
message_id_ = message_id
}, cb, nil)
end
M.openMessageContent = openMessageContent
-- Returns existing chat corresponding to the given user @user_id User identifier
local function createPrivateChat(user_id)
tdcli_function ({
ID = "CreatePrivateChat",
user_id_ = user_id
}, dl_cb, nil)
end
M.createPrivateChat = createPrivateChat
-- Returns existing chat corresponding to the known group @group_id Group identifier
local function createGroupChat(group_id)
tdcli_function ({
ID = "CreateGroupChat",
group_id_ = getChatId(group_id).ID
}, dl_cb, nil)
end
M.createGroupChat = createGroupChat
-- Returns existing chat corresponding to the known channel @channel_id Channel identifier
local function createChannelChat(channel_id)
tdcli_function ({
ID = "CreateChannelChat",
channel_id_ = getChatId(channel_id).ID
}, dl_cb, nil)
end
M.createChannelChat = createChannelChat
-- Returns existing chat corresponding to the known secret chat @secret_chat_id SecretChat identifier
local function createSecretChat(secret_chat_id)
tdcli_function ({
ID = "CreateSecretChat",
secret_chat_id_ = secret_chat_id
}, dl_cb, nil)
end
M.createSecretChat = createSecretChat
-- Creates new group chat and send corresponding messageGroupChatCreate, returns created chat @user_ids Identifiers of users to add to the group @title Title of new group chat, 0-255 characters
local function createNewGroupChat(user_ids, title)
tdcli_function ({
ID = "CreateNewGroupChat",
user_ids_ = user_ids, -- vector
title_ = title
}, dl_cb, nil)
end
M.createNewGroupChat = createNewGroupChat
-- Creates new channel chat and send corresponding messageChannelChatCreate, returns created chat @title Title of new channel chat, 0-255 characters @is_supergroup True, if supergroup chat should be created @about Information about the channel, 0-255 characters
local function createNewChannelChat(title, is_supergroup, about)
tdcli_function ({
ID = "CreateNewChannelChat",
title_ = title,
is_supergroup_ = is_supergroup,
about_ = about
}, dl_cb, nil)
end
M.createNewChannelChat = createNewChannelChat
-- CRASHED
-- Creates new secret chat, returns created chat @user_id Identifier of a user to create secret chat with
local function createNewSecretChat(user_id)
tdcli_function ({
ID = "CreateNewSecretChat",
user_id_ = user_id
}, dl_cb, nil)
end
M.createNewSecretChat = createNewSecretChat
-- Creates new channel supergroup chat from existing group chat and send corresponding messageChatMigrateTo and messageChatMigrateFrom. Deactivates group @chat_id Group chat identifier
local function migrateGroupChatToChannelChat(chat_id)
tdcli_function ({
ID = "MigrateGroupChatToChannelChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.migrateGroupChatToChannelChat = migrateGroupChatToChannelChat
-- Changes chat title. Title can't be changed for private chats. Title will not change until change will be synchronized with the server. Title will not be changed if application is killed before it can send request to the server.
-- - There will be update about change of the title on success. Otherwise error will be returned
-- @chat_id Chat identifier @title New title of a chat, 0-255 characters
local function changeChatTitle(chat_id, title)
tdcli_function ({
ID = "ChangeChatTitle",
chat_id_ = chat_id,
title_ = title
}, dl_cb, nil)
end
M.changeChatTitle = changeChatTitle
-- Changes chat photo. Photo can't be changed for private chats. Photo will not change until change will be synchronized with the server. Photo will not be changed if application is killed before it can send request to the server.
-- - There will be update about change of the photo on success. Otherwise error will be returned @chat_id Chat identifier @photo New chat photo. You can use zero InputFileId to delete photo. Files accessible only by HTTP URL are not acceptable
local function changeChatPhoto(chat_id, file)
tdcli_function ({
ID = "ChangeChatPhoto",
chat_id_ = chat_id,
photo_ = {
ID = "InputFileLocal",
path_ = file
}
}, dl_cb, nil)
end
M.changeChatPhoto = changeChatPhoto
-- Changes chat draft message @chat_id Chat identifier @draft_message New draft message, nullable
local function changeChatDraftMessage(chat_id, reply_to_message_id, text, disable_web_page_preview, clear_draft, parse_mode)
local TextParseMode = getParseMode(parse_mode)
tdcli_function ({
ID = "ChangeChatDraftMessage",
chat_id_ = chat_id,
draft_message_ = {
ID = "DraftMessage",
reply_to_message_id_ = reply_to_message_id,
input_message_text_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = clear_draft,
entities_ = {},
parse_mode_ = TextParseMode,
},
},
}, dl_cb, nil)
end
M.changeChatDraftMessage = changeChatDraftMessage
-- Adds new member to chat. Members can't be added to private or secret chats. Member will not be added until chat state will be synchronized with the server. Member will not be added if application is killed before it can send request to the server
-- @chat_id Chat identifier @user_id Identifier of the user to add @forward_limit Number of previous messages from chat to forward to new member, ignored for channel chats
local function addChatMember(chat_id, user_id, forward_limit)
tdcli_function ({
ID = "AddChatMember",
chat_id_ = chat_id,
user_id_ = user_id,
forward_limit_ = forward_limit
}, dl_cb, nil)
end
M.addChatMember = addChatMember
-- Adds many new members to the chat. Currently, available only for channels. Can't be used to join the channel. Member will not be added until chat state will be synchronized with the server. Member will not be added if application is killed before it can send request to the server
-- @chat_id Chat identifier @user_ids Identifiers of the users to add
local function addChatMembers(chat_id, user_ids)
tdcli_function ({
ID = "AddChatMembers",
chat_id_ = chat_id,
user_ids_ = user_ids -- vector
}, dl_cb, nil)
end
M.addChatMembers = addChatMembers
-- Changes status of the chat member, need appropriate privileges. In channel chats, user will be added to chat members if he is yet not a member and there is less than 200 members in the channel.
-- Status will not be changed until chat state will be synchronized with the server. Status will not be changed if application is killed before it can send request to the server
-- @chat_id Chat identifier @user_id Identifier of the user to edit status, bots can be editors in the channel chats @status New status of the member in the chat
-- status = Creator|Editor|Moderator|Member|Left|Kicked
local function changeChatMemberStatus(chat_id, user_id, status)
tdcli_function ({
ID = "ChangeChatMemberStatus",
chat_id_ = chat_id,
user_id_ = user_id,
status_ = {
ID = "ChatMemberStatus" .. status
},
}, dl_cb, nil)
end
M.changeChatMemberStatus = changeChatMemberStatus
-- Returns information about one participant of the chat @chat_id Chat identifier @user_id User identifier
local function getChatMember(chat_id, user_id)
tdcli_function ({
ID = "GetChatMember",
chat_id_ = chat_id,
user_id_ = user_id
}, dl_cb, nil)
end
M.getChatMember = getChatMember
-- Asynchronously downloads file from cloud. Updates updateFileProgress will notify about download progress. Update updateFile will notify about successful download @file_id Identifier of file to download
local function downloadFile(file_id)
tdcli_function ({
ID = "DownloadFile",
file_id_ = file_id
}, dl_cb, nil)
end
M.downloadFile = downloadFile
-- Stops file downloading. If file already downloaded do nothing. @file_id Identifier of file to cancel download
local function cancelDownloadFile(file_id)
tdcli_function ({
ID = "CancelDownloadFile",
file_id_ = file_id
}, dl_cb, nil)
end
M.cancelDownloadFile = cancelDownloadFile
-- Generates new chat invite link, previously generated link is revoked. Available for group and channel chats. Only creator of the chat can export chat invite link @chat_id Chat identifier
local function exportChatInviteLink(chat_id)
tdcli_function ({
ID = "ExportChatInviteLink",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.exportChatInviteLink = exportChatInviteLink
-- Checks chat invite link for validness and returns information about the corresponding chat @invite_link Invite link to check. Should begin with "https:-- telegram.me/joinchat/"
local function checkChatInviteLink(link,cb)
tdcli_function ({
ID = "CheckChatInviteLink",
invite_link_ = link
}, cb, nil)
end
M.checkChatInviteLink = checkChatInviteLink
-- Imports chat invite link, adds current user to a chat if possible. Member will not be added until chat state will be synchronized with the server. Member will not be added if application is killed before it can send request to the server
-- @invite_link Invite link to import. Should begin with "https:-- telegram.me/joinchat/"
local function importChatInviteLink(invite_link)
tdcli_function ({
ID = "ImportChatInviteLink",
invite_link_ = invite_link
}, dl_cb, nil)
end
M.importChatInviteLink = importChatInviteLink
-- Adds user to black list @user_id User identifier
local function blockUser(user_id)
tdcli_function ({
ID = "BlockUser",
user_id_ = user_id
}, dl_cb, nil)
end
M.blockUser = blockUser
-- Removes user from black list @user_id User identifier
local function unblockUser(user_id)
tdcli_function ({
ID = "UnblockUser",
user_id_ = user_id
}, dl_cb, nil)
end
M.unblockUser = unblockUser
-- Returns users blocked by the current user @offset Number of users to skip in result, must be non-negative @limit Maximum number of users to return, can't be greater than 100
local function getBlockedUsers(offset, limit,cb)
tdcli_function ({
ID = "GetBlockedUsers",
offset_ = offset,
limit_ = limit
}, dl_cb, nil)
end
M.getBlockedUsers = getBlockedUsers
-- Adds new contacts/edits existing contacts, contacts user identifiers are ignored. Returns list of corresponding users in the same order as input contacts. If contact doesn't registered in Telegram, user with id == 0 will be returned @contacts List of contacts to import/edit
local function importContacts(phone_number, first_name, last_name, user_id)
tdcli_function ({
ID = "ImportContacts",
contacts_ = {[0] = {
phone_number_ = tostring(phone_number),
first_name_ = tostring(first_name),
last_name_ = tostring(last_name),
user_id_ = user_id
},
},
}, dl_cb, nil)
end
M.importContacts = importContacts
-- Searches for specified query in the first name, last name and username of the known user contacts @query Query to search for, can be empty to return all contacts @limit Maximum number of users to be returned
local function searchContacts(query, limit)
tdcli_function ({
ID = "SearchContacts",
query_ = query,
limit_ = limit
}, dl_cb, nil)
end
M.searchContacts = searchContacts
-- Deletes users from contacts list @user_ids Identifiers of users to be deleted
local function deleteContacts(user_ids)
tdcli_function ({
ID = "DeleteContacts",
user_ids_ = user_ids -- vector
}, dl_cb, nil)
end
M.deleteContacts = deleteContacts
-- Returns profile photos of the user. Result of this query can't be invalidated, so it must be used with care @user_id User identifier @offset Photos to skip, must be non-negative @limit Maximum number of photos to be returned, can't be greater than 100
local function getUserProfilePhotos(user_id, offset, limit,cb)
tdcli_function ({
ID = "GetUserProfilePhotos",
user_id_ = user_id,
offset_ = offset,
limit_ = limit
}, cb, nil)
end
M.getUserProfilePhotos = getUserProfilePhotos
-- Returns stickers corresponding to given emoji @emoji String representation of emoji. If empty, returns all known stickers
local function getStickers(emoji,cb)
tdcli_function ({
ID = "GetStickers",
emoji_ = emoji
}, cb, nil)
end
M.getStickers = getStickers
-- Returns list of installed sticker sets @only_enabled If true, returns only enabled sticker sets
local function getStickerSets(only_enabled)
tdcli_function ({
ID = "GetStickerSets",
only_enabled_ = only_enabled
}, dl_cb, nil)
end
M.getStickerSets = getStickerSets
-- Returns information about sticker set by its identifier @set_id Identifier of the sticker set
local function getStickerSet(set_id)
tdcli_function ({
ID = "GetStickerSet",
set_id_ = set_id
}, dl_cb, nil)
end
M.getStickerSet = getStickerSet
-- Searches sticker set by its short name @name Name of the sticker set
local function searchStickerSet(name)
tdcli_function ({
ID = "SearchStickerSet",
name_ = name
}, dl_cb, nil)
end
M.searchStickerSet = searchStickerSet
-- Installs/uninstalls or enables/archives sticker set. Official sticker set can't be uninstalled, but it can be archived @set_id Identifier of the sticker set @is_installed New value of is_installed @is_enabled New value of is_enabled
local function updateStickerSet(set_id, is_installed, is_enabled)
tdcli_function ({
ID = "UpdateStickerSet",
set_id_ = set_id,
is_installed_ = is_installed,
is_enabled_ = is_enabled
}, dl_cb, nil)
end
M.updateStickerSet = updateStickerSet
-- Returns saved animations
local function getSavedAnimations()
tdcli_function ({
ID = "GetSavedAnimations",
}, dl_cb, nil)
end
M.getSavedAnimations = getSavedAnimations
-- Manually adds new animation to the list of saved animations. New animation is added to the beginning of the list. If the animation is already in the list, at first it is removed from the list. Only video animations with MIME type "video/mp4" can be added to the list
-- @animation Animation file to add. Only known to server animations (i. e. successfully sent via message) can be added to the list
local function addSavedAnimation(id)
tdcli_function ({
ID = "AddSavedAnimation",
animation_ = {
ID = "InputFileId",
id_ = id
},
}, dl_cb, nil)
end
M.addSavedAnimation = addSavedAnimation
-- Removes animation from the list of saved animations @animation Animation file to delete
local function deleteSavedAnimation(id)
tdcli_function ({
ID = "DeleteSavedAnimation",
animation_ = {
ID = "InputFileId",
id_ = id
},
}, dl_cb, nil)
end
M.deleteSavedAnimation = deleteSavedAnimation
-- Returns up to 20 recently used inline bots in the order of the last usage
local function getRecentInlineBots()
tdcli_function ({
ID = "GetRecentInlineBots",
}, dl_cb, nil)
end
M.getRecentInlineBots = getRecentInlineBots
-- Get web page preview by text of the message. Do not call this function to often @message_text Message text
local function getWebPagePreview(message_text)
tdcli_function ({
ID = "GetWebPagePreview",
message_text_ = message_text
}, dl_cb, nil)
end
M.getWebPagePreview = getWebPagePreview
-- Returns notification settings for given scope @scope Scope to return information about notification settings
-- scope = Chat(chat_id)|PrivateChats|GroupChats|AllChats|
local function getNotificationSettings(scope, chat_id)
tdcli_function ({
ID = "GetNotificationSettings",
scope_ = {
ID = 'NotificationSettingsFor' .. scope,
chat_id_ = chat_id or nil
},
}, dl_cb, nil)
end
M.getNotificationSettings = getNotificationSettings
-- Changes notification settings for given scope @scope Scope to change notification settings
-- @notification_settings New notification settings for given scope
-- scope = Chat(chat_id)|PrivateChats|GroupChats|AllChats|
local function setNotificationSettings(scope, chat_id, mute_for, show_preview)
tdcli_function ({
ID = "SetNotificationSettings",
scope_ = {
ID = 'NotificationSettingsFor' .. scope,
chat_id_ = chat_id or nil
},
notification_settings_ = {
ID = "NotificationSettings",
mute_for_ = mute_for,
sound_ = "default",
show_preview_ = show_preview
}
}, dl_cb, nil)
end
M.setNotificationSettings = setNotificationSettings
-- Uploads new profile photo for logged in user. Photo will not change until change will be synchronized with the server. Photo will not be changed if application is killed before it can send request to the server. If something changes, updateUser will be sent @photo_path Path to new profile photo
local function setProfilePhoto(photo_path)
tdcli_function ({
ID = "SetProfilePhoto",
photo_path_ = photo_path
}, dl_cb, nil)
end
M.setProfilePhoto = setProfilePhoto
-- Deletes profile photo. If something changes, updateUser will be sent @profile_photo_id Identifier of profile photo to delete
local function deleteProfilePhoto(profile_photo_id)
tdcli_function ({
ID = "DeleteProfilePhoto",
profile_photo_id_ = profile_photo_id
}, dl_cb, nil)
end
M.deleteProfilePhoto = deleteProfilePhoto
-- Changes first and last names of logged in user. If something changes, updateUser will be sent @first_name New value of user first name, 1-255 characters @last_name New value of optional user last name, 0-255 characters
local function changeName(first_name, last_name)
tdcli_function ({
ID = "ChangeName",
first_name_ = first_name,
last_name_ = last_name
}, dl_cb, nil)
end
M.changeName = changeName
-- Changes about information of logged in user @about New value of userFull.about, 0-255 characters
local function changeAbout(about)
tdcli_function ({
ID = "ChangeAbout",
about_ = about
}, dl_cb, nil)
end
M.changeAbout = changeAbout
-- Changes username of logged in user. If something changes, updateUser will be sent @username New value of username. Use empty string to remove username
local function changeUsername(username)
tdcli_function ({
ID = "ChangeUsername",
username_ = username
}, dl_cb, nil)
end
M.changeUsername = changeUsername
-- Changes user's phone number and sends authentication code to the new user's phone number. Returns authStateWaitCode with information about sent code on success
-- @phone_number New user's phone number in any reasonable format @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False
local function changePhoneNumber(phone_number, allow_flash_call, is_current_phone_number)
tdcli_function ({
ID = "ChangePhoneNumber",
phone_number_ = phone_number,
allow_flash_call_ = allow_flash_call,
is_current_phone_number_ = is_current_phone_number
}, dl_cb, nil)
end
M.changePhoneNumber = changePhoneNumber
-- Resends authentication code sent to change user's phone number. Wotks only if in previously received authStateWaitCode next_code_type was not null. Returns authStateWaitCode on success
local function resendChangePhoneNumberCode()
tdcli_function ({
ID = "ResendChangePhoneNumberCode",
}, dl_cb, nil)
end
M.resendChangePhoneNumberCode = resendChangePhoneNumberCode
-- Checks authentication code sent to change user's phone number. Returns authStateOk on success @code Verification code from SMS, voice call or flash call
local function checkChangePhoneNumberCode(code)
tdcli_function ({
ID = "CheckChangePhoneNumberCode",
code_ = code
}, dl_cb, nil)
end
M.checkChangePhoneNumberCode = checkChangePhoneNumberCode
-- Returns all active sessions of logged in user
local function getActiveSessions()
tdcli_function ({
ID = "GetActiveSessions",
}, dl_cb, nil)
end
M.getActiveSessions = getActiveSessions
-- Terminates another session of logged in user @session_id Session identifier
local function terminateSession(session_id)
tdcli_function ({
ID = "TerminateSession",
session_id_ = session_id
}, dl_cb, nil)
end
M.terminateSession = terminateSession
-- Terminates all other sessions of logged in user
local function terminateAllOtherSessions()
tdcli_function ({
ID = "TerminateAllOtherSessions",
}, dl_cb, nil)
end
M.terminateAllOtherSessions = terminateAllOtherSessions
-- Gives or revokes all members of the group editor rights. Needs creator privileges in the group @group_id Identifier of the group @anyone_can_edit New value of anyone_can_edit
local function toggleGroupEditors(group_id, anyone_can_edit)
tdcli_function ({
ID = "ToggleGroupEditors",
group_id_ = getChatId(group_id).ID,
anyone_can_edit_ = anyone_can_edit
}, dl_cb, nil)
end
M.toggleGroupEditors = toggleGroupEditors
-- Changes username of the channel. Needs creator privileges in the channel @channel_id Identifier of the channel @username New value of username. Use empty string to remove username
local function changeChannelUsername(channel_id, username)
tdcli_function ({
ID = "ChangeChannelUsername",
channel_id_ = getChatId(channel_id).ID,
username_ = username
}, dl_cb, nil)
end
M.changeChannelUsername = changeChannelUsername
-- Gives or revokes right to invite new members to all current members of the channel. Needs creator privileges in the channel. Available only for supergroups @channel_id Identifier of the channel @anyone_can_invite New value of anyone_can_invite
local function toggleChannelInvites(channel_id, anyone_can_invite)
tdcli_function ({
ID = "ToggleChannelInvites",
channel_id_ = getChatId(channel_id).ID,
anyone_can_invite_ = anyone_can_invite
}, dl_cb, nil)
end
M.toggleChannelInvites = toggleChannelInvites
-- Enables or disables sender signature on sent messages in the channel. Needs creator privileges in the channel. Not available for supergroups @channel_id Identifier of the channel @sign_messages New value of sign_messages
local function toggleChannelSignMessages(channel_id, sign_messages)
tdcli_function ({
ID = "ToggleChannelSignMessages",
channel_id_ = getChatId(channel_id).ID,
sign_messages_ = sign_messages
}, dl_cb, nil)
end
M.toggleChannelSignMessages = toggleChannelSignMessages
-- Changes information about the channel. Needs creator privileges in the broadcast channel or editor privileges in the supergroup channel @channel_id Identifier of the channel @about New value of about, 0-255 characters
local function changeChannelAbout(channel_id, about)
tdcli_function ({
ID = "ChangeChannelAbout",
channel_id_ = getChatId(channel_id).ID,
about_ = about
}, dl_cb, nil)
end
M.changeChannelAbout = changeChannelAbout
-- Pins a message in a supergroup channel chat. Needs editor privileges in the channel @channel_id Identifier of the channel @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message
local function pinChannelMessage(channel_id, message_id,disable_notification)
tdcli_function ({
ID = "PinChannelMessage",
channel_id_ = getChatId(channel_id).ID,
message_id_ = message_id,
disable_notification_ = disable_notification,
}, dl_cb, nil)
end
M.pinChannelMessage = pinChannelMessage
-- Removes pinned message in the supergroup channel. Needs editor privileges in the channel @channel_id Identifier of the channel
local function unpinChannelMessage(channel_id)
tdcli_function ({
ID = "UnpinChannelMessage",
channel_id_ = getChatId(channel_id).ID
}, dl_cb, nil)
end
M.unpinChannelMessage = unpinChannelMessage
-- Reports some supergroup channel messages from a user as spam messages @channel_id Channel identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user, the list should be non-empty
local function reportChannelSpam(channel_id, user_id, message_ids)
tdcli_function ({
ID = "ReportChannelSpam",
channel_id_ = getChatId(channel_id).ID,
user_id_ = user_id,
message_ids_ = message_ids -- vector
}, dl_cb, nil)
end
M.reportChannelSpam = reportChannelSpam
-- Returns information about channel members or kicked from channel users. Can be used only if channel_full->can_get_members == true @channel_id Identifier of the channel
-- @filter Kind of channel users to return, defaults to channelMembersRecent @offset Number of channel users to skip @limit Maximum number of users be returned, can't be greater than 200
-- filter = Recent|Administrators|Kicked|Bots
local function getChannelMembers(channel_id, offset, filter, limit,cb)
if not limit or limit > 200 then
limit = 200
end
tdcli_function ({
ID = "GetChannelMembers",
channel_id_ = getChatId(channel_id).ID,
filter_ = {
ID = "ChannelMembers" .. filter
},
offset_ = offset,
limit_ = limit
}, cb, nil)
end
M.getChannelMembers = getChannelMembers
-- Deletes channel along with all messages in corresponding chat. Releases channel username and removes all members. Needs creator privileges in the channel. Channels with more than 1000 members can't be deleted @channel_id Identifier of the channel
local function deleteChannel(channel_id)
tdcli_function ({
ID = "DeleteChannel",
channel_id_ = getChatId(channel_id).ID
}, dl_cb, nil)
end
M.deleteChannel = deleteChannel
-- Returns user that can be contacted to get support
local function getSupportUser(cb)
tdcli_function ({
ID = "GetSupportUser",
}, cb, nil)
end
M.getSupportUser = getSupportUser
-- Returns background wallpapers
local function getWallpapers(cb)
tdcli_function ({
ID = "GetWallpapers",
}, cb, nil)
end
M.getWallpapers = getWallpapers
local function registerDevice(cb)
tdcli_function ({
ID = "RegisterDevice",
}, cb, nil)
end
M.registerDevice = registerDevice
--registerDevice device_token:DeviceToken = Ok;
local function getDeviceTokens()
tdcli_function ({
ID = "GetDeviceTokens",
}, dl_cb, nil)
end
M.getDeviceTokens = getDeviceTokens
-- CRASHED
-- Changes privacy settings @key Privacy key @rules New privacy rules
-- key = UserStatus|ChatInvite
-- rules = AllowAll|AllowContacts|AllowUsers(user_ids)|DisallowAll|DisallowContacts|DisallowUsers(user_ids)
local function setPrivacy(key, rules, user_ids)
if user_ids and rules:match('Allow') then
rule = 'AllowUsers'
elseif user_ids and rules:match('Disallow') then
rule = 'DisallowUsers'
end
tdcli_function ({
ID = "SetPrivacy",
key_ = {
ID = 'PrivacyKey' .. key,
},
rules_ = {
ID = 'PrivacyRules',
rules_ = {
[0] = {
ID = 'PrivacyRule' .. rules,
},
{
ID = 'PrivacyRule' .. rule,
user_ids_ = user_ids
},
},
},
}, dl_cb, nil)
end
M.setPrivacy = setPrivacy
-- Returns current privacy settings @key Privacy key
-- key = UserStatus|ChatInvite
local function getPrivacy(key)
tdcli_function ({
ID = "GetPrivacy",
key_ = {
ID = "PrivacyKey" .. key
},
}, dl_cb, nil)
end
M.getPrivacy = getPrivacy
-- Returns value of an option by its name. See list of available options on https://core.telegram.org/tdlib/options
-- @name Name of the option
local function getOption(name)
tdcli_function ({
ID = "GetOption",
name_ = name
}, dl_cb, nil)
end
M.getOption = getOption
-- CRASHED
-- Sets value of an option. See list of available options on https://core.telegram.org/tdlib/options. Only writable options can be set
-- @name Name of the option @value New value of the option
local function setOption(name, option, value)
tdcli_function ({
ID = "SetOption",
name_ = name,
value_ = {
ID = 'Option' .. option,
value_ = value
},
}, dl_cb, nil)
end
M.setOption = setOption
-- Changes period of inactivity, after which the account of currently logged in user will be automatically deleted @ttl New account TTL
local function changeAccountTtl(days)
tdcli_function ({
ID = "ChangeAccountTtl",
ttl_ = {
ID = "AccountTtl",
days_ = days
},
}, dl_cb, nil)
end
M.changeAccountTtl = changeAccountTtl
-- Returns period of inactivity, after which the account of currently logged in user will be automatically deleted
local function getAccountTtl()
tdcli_function ({
ID = "GetAccountTtl",
}, dl_cb, nil)
end
M.getAccountTtl = getAccountTtl
-- Deletes the account of currently logged in user, deleting from the server all information associated with it. Account's phone number can be used to create new account, but only once in two weeks @reason Optional reason of account deletion
local function deleteAccount(reason)
tdcli_function ({
ID = "DeleteAccount",
reason_ = reason
}, dl_cb, nil)
end
M.deleteAccount = deleteAccount
-- Returns current chat report spam state @chat_id Chat identifier
local function getChatReportSpamState(chat_id)
tdcli_function ({
ID = "GetChatReportSpamState",
chat_id_ = chat_id
}, dl_cb, nil)
end
M.getChatReportSpamState = getChatReportSpamState
-- Reports chat as a spam chat or as not a spam chat. Can be used only if ChatReportSpamState.can_report_spam is true. After this request ChatReportSpamState.can_report_spam became false forever @chat_id Chat identifier @is_spam_chat If true, chat will be reported as a spam chat, otherwise it will be marked as not a spam chat
local function changeChatReportSpamState(chat_id, is_spam_chat)
tdcli_function ({
ID = "ChangeChatReportSpamState",
chat_id_ = chat_id,
is_spam_chat_ = is_spam_chat
}, dl_cb, nil)
end
M.changeChatReportSpamState = changeChatReportSpamState
-- Bots only. Informs server about number of pending bot updates if they aren't processed for a long time @pending_update_count Number of pending updates @error_message Last error's message
local function setBotUpdatesStatus(pending_update_count, error_message)
tdcli_function ({
ID = "SetBotUpdatesStatus",
pending_update_count_ = pending_update_count,
error_message_ = error_message
}, dl_cb, nil)
end
M.setBotUpdatesStatus = setBotUpdatesStatus
-- Returns Ok after specified amount of the time passed @seconds Number of seconds before that function returns
local function setAlarm(seconds)
tdcli_function ({
ID = "SetAlarm",
seconds_ = seconds
}, dl_cb, nil)
end
M.setAlarm = setAlarm
-- These functions below are a(n effort to mimic telegram-cli console commands --
-- Gets channel admins
local function channel_get_admins(channel,cb)
local function callback_admins(extra,result,success)
limit = result.administrator_count_
if tonumber(limit) > 0 then
maqzafzar.getChannelMembers(channel, 0, 'Administrators', limit,cb)
else return maqzafzar.sendText(channel,0, 1,'ابتدا ربات را ادمین کنید', 'html') end
end
maqzafzar.getChannelFull(channel,callback_admins)
end
M.channel_get_admins = channel_get_admins
-- Gets channel bot.
local function channel_get_bots(channel,cb)
local function callback_admins(extra,result,success)
limit = result.member_count_
maqzafzar.getChannelMembers(channel, 0, 'Bots', limit,cb)
end
maqzafzar.getChannelFull(channel,callback_admins)
end
M.channel_get_bots = channel_get_bots
-- Gets channel kicked members
local function channel_get_kicked(channel,cb)
local function callback_admins(extra,result,success)
limit = result.kicked_count_
maqzafzar.getChannelMembers(channel, 0, 'Kicked', limit,cb)
end
maqzafzar.getChannelFull(channel,callback_admins)
end
M.channel_get_kicked = channel_get_kicked
--send
-- Send SendMessage request
local function sendRequest(request_id, chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content, callback, extra)
tdcli_function ({
ID = request_id,
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = from_background,
reply_markup_ = reply_markup,
input_message_content_ = input_message_content,
}, callback or dl_cb, extra)
end
--
-- Animation message
-- @animation Animation file to send
-- @thumb Animation thumb, if available
-- @width Width of the animation, may be replaced by the server
-- @height Height of the animation, may be replaced by the server
-- @caption Animation caption, 0-200 characters
local function sendAnimation(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, animation, width, height, caption)
local input_message_content = {
ID = "InputMessageAnimation",
animation_ = getInputFile(animation),
width_ = 0,
height_ = 0,
caption_ = caption
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendAnimation = sendAnimation
-- Audio message
-- @audio Audio file to send
-- @album_cover_thumb Thumb of the album's cover, if available
-- @duration Duration of audio in seconds, may be replaced by the server
-- @title Title of the audio, 0-64 characters, may be replaced by the server
-- @performer Performer of the audio, 0-64 characters, may be replaced by the server
-- @caption Audio caption, 0-200 characters
local function sendAudio(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, audio, duration, title, performer, caption)
local input_message_content = {
ID = "InputMessageAudio",
audio_ = getInputFile(audio),
duration_ = duration or 0,
title_ = title or 0,
performer_ = performer,
caption_ = caption
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendAudio = sendAudio
-- Document message
-- @document Document to send
-- @thumb Document thumb, if available
-- @caption Document caption, 0-200 characters
local function sendDocument(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, document, caption)
local input_message_content = {
ID = "InputMessageDocument",
document_ = getInputFile(document),
caption_ = caption
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendDocument = sendDocument
-- Sticker message
-- @sticker Sticker to send
-- @thumb Sticker thumb, if available
local function sendSticker(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, sticker)
local input_message_content = {
ID = "InputMessageSticker",
sticker_ = getInputFile(sticker),
width_ = 0,
height_ = 0
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendSticker = sendSticker
-- Video message
-- @video Video to send
-- @thumb Video thumb, if available
-- @duration Duration of video in seconds
-- @width Video width
-- @height Video height
-- @caption Video caption, 0-200 characters
local function sendVideo(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, video, duration, width, height, caption)
local input_message_content = {
ID = "InputMessageVideo",
video_ = getInputFile(video),
added_sticker_file_ids_ = {},
duration_ = duration or 0,
width_ = width or 0,
height_ = height or 0,
caption_ = caption
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendVideo = sendVideo
-- Voice message
-- @voice Voice file to send
-- @duration Duration of voice in seconds
-- @waveform Waveform representation of the voice in 5-bit format
-- @caption Voice caption, 0-200 characters
local function sendVoice(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, voice, duration, waveform, caption)
local input_message_content = {
ID = "InputMessageVoice",
voice_ = getInputFile(voice),
duration_ = duration or 0,
waveform_ = waveform,
caption_ = caption
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendVoice = sendVoice
-- Message with location
-- @latitude Latitude of location in degrees as defined by sender
-- @longitude Longitude of location in degrees as defined by sender
local function sendLocation(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, latitude, longitude)
local input_message_content = {
ID = "InputMessageLocation",
location_ = {
ID = "Location",
latitude_ = latitude,
longitude_ = longitude
},
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendLocation = sendLocation
-- Message with information about venue
-- @venue Venue to send
-- @latitude Latitude of location in degrees as defined by sender
-- @longitude Longitude of location in degrees as defined by sender
-- @title Venue name as defined by sender
-- @address Venue address as defined by sender
-- @provider Provider of venue database as defined by sender. Only "foursquare" need to be supported currently
-- @id Identifier of the venue in provider database as defined by sender
local function sendVenue(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, latitude, longitude, title, address, id)
local input_message_content = {
ID = "InputMessageVenue",
venue_ = {
ID = "Venue",
location_ = {
ID = "Location",
latitude_ = latitude,
longitude_ = longitude
},
title_ = title,
address_ = address,
provider_ = 'foursquare',
id_ = id
},
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendVenue = sendVenue
-- User contact message
-- @contact Contact to send
-- @phone_number User's phone number
-- @first_name User first name, 1-255 characters
-- @last_name User last name
-- @user_id User identifier if known, 0 otherwise
local function sendContact(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, phone_number, first_name, last_name, user_id)
local input_message_content = {
ID = "InputMessageContact",
contact_ = {
ID = "Contact",
phone_number_ = phone_number,
first_name_ = first_name,
last_name_ = last_name,
user_id_ = user_id
},
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendContact = sendContact
-- Message with a game
-- @bot_user_id User identifier of a bot owned the game
-- @game_short_name Game short name
local function sendGame(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, bot_user_id, game_short_name)
local input_message_content = {
ID = "InputMessageGame",
bot_user_id_ = bot_user_id,
game_short_name_ = game_short_name
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendGame = sendGame
-- Find chat by username
local function resolve_username(username,cb)
tdcli_function ({
ID = "SearchPublicChat",
username_ = username
}, cb, nil)
end
M.resolve_username = resolve_username
-- Forwarded message
-- @from_chat_id Chat identifier of the message to forward
-- @message_id Identifier of the message to forward
local function sendForwarded(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, from_chat_id, message_id)
local input_message_content = {
ID = "InputMessageForwarded",
from_chat_id_ = from_chat_id,
message_id_ = message_id,
in_game_share_ = in_game_share
}
sendRequest('SendMessage', chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, input_message_content)
end
M.sendForwarded = sendForwarded
return M
| gpl-3.0 |
ahuraa/trinityadmin | Commands/Commands_Who.lua | 2 | 5954 | -------------------------------------------------------------------------------------------------------------
--
-- TrinityAdmin Version 3.x
-- TrinityAdmin is a derivative of MangAdmin.
--
-- Copyright (C) 2007 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-- This is free software: you are free to change and redistribute it.
-- There is NO WARRANTY, to the extent permitted by law.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- Official Forums: http://groups.google.com/group/trinityadmin
-- GoogleCode Website: http://code.google.com/p/trinityadmin/
-- Subversion Repository: http://trinityadmin.googlecode.com/svn/
-- Dev Blog: http://trinityadmin.blogspot.com/
-------------------------------------------------------------------------------------------------------------
function WhoUpdate()
MangAdmin:LogAction("Getting Who.")
local whoCount = 0
table.foreachi(MangAdmin.db.account.buffer.who, function() whoCount = whoCount + 1 end)
if whoCount > 0 then
ma_whoscrollframe1:SetText("Loading")
local lineplusoffset
local line
ma_whoscrollframe:Show()
FauxScrollFrame_Update(ma_whoscrollframe,whoCount,12,16);
for line = 1,12 do
lineplusoffset = line + FauxScrollFrame_GetOffset(ma_whoscrollframe)
if lineplusoffset <= whoCount then
local object = MangAdmin.db.account.buffer.who[lineplusoffset]
if object then
getglobal("ma_whoscrollframe"..line):SetText("Acct: |cffffffff"..object["tAcc"].."|r Char: |cffffffff"..object["tChar"].."|r GMLvl: |cffffffff"..object["tGMLevel"].."|r Exp: |cffffffff"..object["tExp"].."|r")
ma_deletewhobutton:Enable()
ma_answerwhobutton:Enable()
ma_summonwhobutton:Enable()
ma_gocharwhobutton:Enable()
ma_whisperwhobutton:Enable()
getglobal("ma_whoscrollframe"..line):SetScript("OnEnter", function() --[[Do nothing]] end)
getglobal("ma_whoscrollframe"..line):SetScript("OnLeave", function() --[[Do nothing]] end)
getglobal("ma_whoscrollframe"..line):SetScript("OnClick", function() WhoDetail(object["tAcc"], object["tChar"], object["tMap"], object["tZone"]) end)
getglobal("ma_whoscrollframe"..line):Enable()
getglobal("ma_whoscrollframe"..line):Show()
end
else
getglobal("ma_whoscrollframe"..line):Hide()
end
end
else
--MangAdmin:NoResults("ticket")
end
-- else
-- end
--MangAdmin.db.account.buffer.tickets = {}
--MangAdmin.db.char.requests.ticket = false
end
function WhoDetail(tAcc, tChar, tMap, tZone)
-- MangAdmin.db.char.requests.ticket = false
-- MangAdmin:ChatMsg(tNumber)
-- tNumber=string.gsub(tNumber, "00", "")
-- MangAdmin:ChatMsg(tNumber)
--x = x - 1
-- tNumber = string.match(tNumber, "%d+")
MangAdmin:ChatMsg(".pinfo "..tChar)
ma_whoid:SetText(tAcc)
ma_who:SetText(tChar)
local MapName=ReturnMapName(tMap)
local AreaName=ReturnAreaName(tZone)
ma_whowhere:SetText(MapName.."-"..AreaName)
MangAdmin:LogAction("Displaying character detail on "..tAcc..":"..tChar)
-- local ticketdetail = MangAdmin.db.account.buffer.ticketsfull
end
function ResetWho()
MangAdmin.db.account.buffer.who = {}
wipe(MangAdmin.db.account.buffer.who)
MangAdmin.db.account.buffer.who = {}
WhoUpdate()
end
function Who(value)
if value == "delete" then
MangAdmin:ChatMsg(".kick "..ma_who:GetText())
MangAdmin:LogAction("Kicked: "..ma_who:GetText())
ResetWho()
elseif value == "gochar" then
MangAdmin:ChatMsg(".appear "..ma_who:GetText())
elseif value == "getchar" then
MangAdmin:ChatMsg(".summon "..ma_who:GetText())
elseif value == "answer" then
MangAdmin:TogglePopup("mail", {recipient = ma_who:GetText(), subject = ""})
elseif value == "whisper" then
--ChatFrame1EditBox:Show()
-- ChatEdit_GetLastActiveWindow():Show()
--ChatEdit_ActivateChat(ChatEdit_GetActiveWindow());
-- ChatFrame1EditBox:Insert("/w "..ma_who:GetText().." ".. string.char(10)..string.char(13));
-- ChatEdit_FocusActiveWindow(1);
local editbox = ChatFrame1EditBox
if not editbox then
-- Support for 3.3.5 and newer
editbox = ChatEdit_GetActiveWindow()
end
ChatEdit_ActivateChat(editbox);
if editbox then
editbox:Insert("/w "..ma_who:GetText().." ");
end
elseif value == "customize" then
MangAdmin:ChatMsg(".character customize "..ma_who:GetText())
elseif value == "chardelete" then
MangAdmin:ChatMsg(".character delete "..ma_who:GetText())
elseif value == "charrename" then
MangAdmin:ChatMsg(".character rename "..ma_who:GetText())
elseif value == "1dayban" then
MangAdmin:ChatMsg(".ban character "..ma_who:GetText().." 1d 1Day ban by GM")
elseif value == "permban" then
MangAdmin:ChatMsg(".ban character "..ma_who:GetText().." -1d Permanent ban by GM")
elseif value == "jaila" then
cname=ma_who:GetText()
MangAdmin:ChatMsg(".tele name "..cname.." ma_AllianceJail")
MangAdmin:LogAction("Jailed player "..cname..".")
MangAdmin:ChatMsg(".notify "..cname.." has been found guilty and jailed.")
elseif value == "jailh" then
cname=ma_who:GetText()
MangAdmin:ChatMsg(".tele name "..cname.." ma_HordeJail")
MangAdmin:LogAction("Jailed player "..cname..".")
MangAdmin:ChatMsg(".notify "..cname.." has been found guilty and jailed.")
elseif value == "unjail" then
cname=ma_who:GetText()
MangAdmin:ChatMsg(".recall "..cname)
MangAdmin:LogAction("UnJailed player "..cname..".")
MangAdmin:ChatMsg(".notify "..cname.." has been pardoned and released from jail.")
end
end | gpl-2.0 |
logzero/ValyriaTear | dat/maps/layna_village/layna_village_riverbank_map.lua | 4 | 87116 | map_data = {}
-- The number of rows, and columns that compose the map
map_data.num_tile_cols = 60
map_data.num_tile_rows = 40
-- The tilesets definition files used.
map_data.tileset_filenames = {}
map_data.tileset_filenames[1] = "dat/tilesets/mountain_landscape.lua"
map_data.tileset_filenames[2] = "dat/tilesets/mountain_house_exterior.lua"
map_data.tileset_filenames[3] = "dat/tilesets/mountain_house_exterior2.lua"
map_data.tileset_filenames[4] = "dat/tilesets/water_tileset.lua"
map_data.tileset_filenames[5] = "dat/tilesets/village_exterior.lua"
-- The map grid to indicate walkability. 0 is walkable, 1 is not.
map_data.map_grid = {}
map_data.map_grid[0] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }
map_data.map_grid[1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }
map_data.map_grid[2] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }
map_data.map_grid[3] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 }
map_data.map_grid[4] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[5] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[6] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[7] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[8] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[13] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[17] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[19] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[21] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[22] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[23] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[25] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[26] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[27] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[28] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[29] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[31] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[33] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[34] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[35] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[37] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[38] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[39] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[40] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[41] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[42] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[43] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[44] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[45] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[46] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[47] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[48] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[49] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[50] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[51] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[52] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[53] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[54] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[55] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[56] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[57] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[58] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[59] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }
map_data.map_grid[60] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }
map_data.map_grid[61] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }
map_data.map_grid[62] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[63] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[65] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
map_data.map_grid[66] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[67] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[68] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[69] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[70] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[71] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[72] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[73] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[74] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[75] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[76] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[77] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[78] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
map_data.map_grid[79] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-- The tile layers. The numbers are indeces to the tile_mappings table.
map_data.layers = {}
map_data.layers[0] = {}
map_data.layers[0].type = "ground"
map_data.layers[0].name = "Water"
map_data.layers[0][0] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 818, 819, 819, 819, 819, 819, 819, 819, 819, 819, 820, 821, 838, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][1] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 834, 819, 819, 819, 819, 819, 819, 781, 820, 819, 819, 821, 838, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][2] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 834, 819, 819, 819, 819, 779, 819, 835, 836, 779, 820, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][3] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 818, 819, 819, 819, 835, 836, 819, 820, 819, 819, 820, 835, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][4] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 834, 809, 819, 819, 819, 781, 835, 836, 819, 820, 820, 781, 836, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][5] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 850, 865, 809, 819, 819, 819, 819, 819, 835, 836, 820, 835, 836, 836, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][6] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 819, 819, 865, 809, 819, 819, 819, 820, 780, 819, 820, 819, 820, 819, 836, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][7] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 819, 819, 819, 865, 809, 820, 835, 836, 819, 819, 820, 835, 836, 835, 836, 836, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][8] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 866, 865, 809, 819, 819, 819, 819, 820, 819, 819, 820, 780, 836, 836, 915, 824, 790, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 866, 865, 867, 809, 900, 819, 820, 835, 835, 836, 835, 835, 836, 836, 915, 824, 790, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 809, 900, 819, 781, 819, 819, 820, 819, 835, 836, 836, 915, 838, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][11] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 850, 809, 900, 836, 819, 835, 836, 819, 819, 819, 819, 837, 806, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][12] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 835, 809, 900, 819, 819, 819, 819, 779, 819, 819, 821, 822, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][13] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 819, 809, 900, 820, 819, 819, 835, 835, 835, 837, 838, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][14] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 836, 780, 835, 836, 819, 819, 837, 806, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][15] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 819, 819, 779, 819, 780, 835, 821, 822, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 819, 819, 820, 819, 819, 821, 838, 883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 835, 835, 835, 779, 819, 819, 837, 806, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][18] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 835, 835, 835, 835, 819, 820, 821, 822, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][19] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 819, 819, 819, 819, 819, 820, 837, 806, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 781, 819, 835, 835, 836, 821, 822, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][21] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 834, 820, 819, 819, 820, 819, 782, 837, 838, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 836, 819, 820, 836, 819, 819, 821, 806, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][23] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 819, 820, 819, 820, 819, 837, 822, 883, 819, 819, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][24] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 834, 819, 835, 836, 819, 779, 819, 821, 806, 883, 835, 835, 836, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][25] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 835, 836, 819, 835, 836, 819, 821, 822, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][26] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 819, 819, 819, 819, 819, 821, 806, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][27] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 819, 820, 819, 820, 819, 835, 837, 806, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][28] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 835, 779, 835, 836, 819, 819, 821, 822, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][29] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817, 818, 819, 819, 819, 820, 819, 819, 821, 838, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][30] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 819, 835, 836, 819, 819, 837, 806, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][31] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 818, 819, 820, 819, 819, 819, 820, 821, 822, 883, 883, 820, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[0][32] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 835, 836, 819, 819, 835, 836, 837, 838, 883, 785, 785, 785, 785, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883 }
map_data.layers[0][33] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 818, 819, 819, 819, 835, 836, 819, 899, 824, 787, 787, 788, 787, 787, 788, 787, 787, 788, 787, 787, 788, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 788, 789, 787, 787, 787, 787, 787 }
map_data.layers[0][34] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 818, 819, 820, 835, 835, 835, 835, 835, 899, 804, 803, 804, 803, 804, 803, 804, 803, 803, 803, 803, 803, 804, 803, 804, 803, 804, 804, 803, 803, 804, 803, 803, 804, 803, 804, 803, 803, 804 }
map_data.layers[0][35] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 819, 820, 819, 819, 819, 820, 819, 819, 835, 836, 835, 836, 836, 819, 820, 835, 835, 836, 820, 819, 819, 820, 820, 835, 835, 819, 819, 820, 781, 835, 819, 820, 836, 835, 835, 835, 835 }
map_data.layers[0][36] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 834, 835, 836, 819, 819, 835, 836, 819, 819, 819, 819, 819, 819, 819, 819, 819, 820, 819, 819, 820, 835, 835, 836, 819, 819, 820, 835, 780, 836, 836, 819, 835, 836, 820, 819, 819, 819, 819 }
map_data.layers[0][37] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 850, 899, 819, 819, 819, 819, 819, 820, 819, 819, 820, 819, 835, 819, 819, 819, 820, 819, 819, 820, 819, 819, 820, 819, 820, 836, 779, 836, 819, 819, 819, 835, 835, 819, 820, 819, 819, 819 }
map_data.layers[0][38] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833, 809, 850, 899, 819, 819, 835, 835, 836, 819, 835, 836, 820, 819, 835, 835, 835, 836, 835, 819, 819, 820, 835, 836, 819, 820, 819, 835, 836, 819, 819, 819, 819, 819, 835, 819, 819, 819, 835 }
map_data.layers[0][39] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 865, 809, 851, 899, 819, 819, 819, 819, 819, 819, 835, 836, 819, 819, 819, 835, 835, 835, 835, 835, 836, 819, 835, 835, 836, 819, 819, 820, 819, 819, 819, 819, 819, 819, 835, 835, 835, 836 }
map_data.layers[1] = {}
map_data.layers[1].type = "ground"
map_data.layers[1].name = "Village ground"
map_data.layers[1][0] = { 42, 42, 26, 42, 26, 26, 42, 10, 10, 36, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, 798, -1, 80, 70, 54, 50, 50, 50, 50, -1, -1, -1, -1, -1, 29, 78, 43, 44, 44, 126, 42, 78, 78, 78, 78, 78, 78, 43, 45, 78, 78, 78, 78, 78, 42, 42, 28, 28, 28, 29 }
map_data.layers[1][1] = { 10, 10, 26, 42, 26, 26, 42, 26, 42, 52, 53, -1, -1, -1, 776, -1, -1, -1, -1, -1, 814, -1, 96, 86, 70, 54, 50, 50, 50, -1, -1, -1, -1, 111, 29, 11, 95, 95, 79, 94, 79, 78, 79, 95, 95, 94, 94, 94, 78, 95, 79, 94, 79, 78, 94, 79, 94, 79, 78, 94 }
map_data.layers[1][2] = { 44, 126, 10, 10, 42, 26, 26, 26, 42, 52, 53, -1, -1, -1, -1, -1, -1, -1, 798, -1, 797, -1, -1, 102, 86, 70, 54, 50, 50, -1, -1, -1, -1, 111, 12, 110, 78, 95, 95, 94, 95, 95, 95, 79, 78, 79, 78, 79, 78, 78, 79, 94, 95, 95, 67, 67, 67, 67, 95, 94 }
map_data.layers[1][3] = { 95, 43, 10, 10, 26, 10, 42, 26, 26, 52, 53, -1, -1, -1, -1, -1, 797, -1, 814, 782, 813, -1, -1, -1, 102, 86, 70, 54, 50, 38, 39, -1, -1, -1, 29, 78, 94, 79, 79, 78, 94, 78, 95, 94, 95, 79, 79, 94, 78, 78, 95, 94, 79, 95, 95, 78, 79, 79, 95, 94 }
map_data.layers[1][4] = { 79, 78, 43, 126, 26, 42, 10, 26, 26, 36, 37, -1, -1, -1, -1, -1, 778, -1, -1, 795, 810, -1, -1, -1, -1, 102, 86, 70, 54, 33, 33, 33, -1, -1, 29, 78, 78, 79, 94, 95, 94, 79, 78, 79, 95, 94, 94, 78, 11, 12, 13, 94, 78, 94, 79, 78, 78, 95, 78, 95 }
map_data.layers[1][5] = { 79, 94, 94, 27, 10, 42, 42, 10, 42, 114, 115, 21, -1, -1, -1, -1, 798, -1, 826, 811, 798, -1, -1, -1, -1, -1, 102, 86, 70, 71, 49, 33, 55, -1, -1, 94, 95, 94, 79, 79, 79, 94, 94, 79, 95, 78, 79, 79, 27, 42, 29, 94, 94, 78, 79, 95, 94, 79, 95, 78 }
map_data.layers[1][6] = { 78, 78, 94, 43, 126, 10, 10, 26, 42, 130, 131, 115, 21, -1, -1, -1, 814, 795, -1, -1, 814, 799, -1, -1, -1, -1, -1, 102, 86, 87, 71, 49, 161, 38, 71, 94, 79, 95, 78, 95, 79, 78, 94, 95, 79, 78, 79, 11, 110, 42, 29, 79, 94, 95, 94, 79, 79, 79, 95, 78 }
map_data.layers[1][7] = { 95, 79, 94, 95, 43, 42, 26, 26, 10, 26, 130, 131, 115, 21, -1, -1, -1, 811, -1, 777, -1, 815, 795, -1, -1, -1, -1, -1, 102, 86, 87, 71, 177, 54, 29, 78, 78, 79, 94, 94, 79, 79, 79, 94, 78, 78, 11, 110, 42, 127, 45, 94, 94, 79, 94, 79, 79, 78, 94, 95 }
map_data.layers[1][8] = { 78, 78, 95, 95, 79, 126, 10, 42, 26, 42, 26, 42, 131, 115, 21, -1, -1, -1, -1, -1, -1, 826, 811, -1, -1, -1, -1, -1, -1, 102, 86, 87, 103, 102, 103, 94, 78, 79, 78, 94, 78, 95, 94, 95, 79, 94, 27, 26, 127, 45, 78, 79, 78, 78, 78, 94, 79, 78, 78, 78 }
map_data.layers[1][9] = { 94, 95, 78, 78, 78, 43, 126, 26, 10, 26, 26, 26, 42, 114, 115, 8, 2, 4, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, -1, 102, 103, -1, -1, -1, 79, 78, 78, 78, 94, 79, 94, 78, 78, 95, 79, 27, 42, 111, 13, 79, 78, 95, 79, 78, 94, 95, 79, 78, 79 }
map_data.layers[1][10] = { 95, 78, 94, 95, 95, 79, 43, 126, 26, 26, 10, 42, 42, 130, 131, 20, 18, 20, 21, -1, -1, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, -1, -1, 78, 11, 12, 12, 13, 11, 12, 12, 12, 12, 12, 110, 10, 26, 111, 12, 12, 12, 13, 94, 79, 78, 79, 95, 95 }
map_data.layers[1][11] = { 79, 78, 95, 95, 78, 78, 79, 43, 42, 10, 26, 26, 42, 26, 10, 34, 35, 36, 115, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, 27, 28, 26, 111, 110, 28, 10, 28, 28, 28, 127, 44, 126, 28, 42, 28, 28, 111, 12, 13, 95, 95, 94, 94 }
map_data.layers[1][12] = { 95, 78, 95, 79, 95, 94, 78, 43, 126, 42, 42, 42, 10, 42, 42, 130, 130, 130, 131, 115, 21, -1, -1, -1, 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, 43, 126, 28, 28, 42, 127, 44, 44, 44, 44, 45, 79, 43, 44, 44, 44, 126, 26, 28, 111, 12, 13, 94, 95 }
map_data.layers[1][13] = { 78, 79, 79, 95, 79, 78, 79, 78, 43, 126, 42, 10, 42, 26, 10, 26, 10, 42, 130, 131, 115, 21, -1, -1, -1, -1, 783, -1, -1, -1, -1, -1, -1, -1, -1, 78, 94, 43, 44, 44, 44, 45, 94, 79, 94, 78, 78, 94, 94, 95, 94, 79, 43, 44, 126, 42, 28, 29, 79, 78 }
map_data.layers[1][14] = { 95, 94, 95, 94, 79, 94, 95, 78, 11, 110, 10, 42, 26, 26, 42, 26, 42, 42, 130, 130, 131, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 95, 94, 79, 78, 95, 11, 110, 78, 78, 94, 78, 78, 78, 94, 95, 79, 79, 79, 43, 42, 127, 45, 79, 94 }
map_data.layers[1][15] = { 94, 95, 78, 94, 94, 79, 78, 79, 27, 26, 10, 42, 10, 26, 42, 26, 10, 42, 51, 51, 52, 53, -1, -1, -1, 777, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, 95, 94, 79, 78, 11, 110, 59, 94, 94, 95, 78, 78, 78, 79, 95, 95, 78, 94, 79, 127, 45, 94, 94, 94 }
map_data.layers[1][16] = { 78, 95, 94, 78, 94, 94, 79, 95, 43, 126, 10, 26, 42, 42, 42, 42, 10, 10, 51, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, 78, 79, 95, 95, 27, 10, 75, 95, 79, 94, 79, 95, 79, 95, 78, 95, 79, 78, 78, 111, 13, 79, 95, 94 }
map_data.layers[1][17] = { 94, 94, 94, 94, 94, 94, 94, 95, 79, 43, 126, 42, 42, 26, 26, 26, 26, 42, 51, 51, 52, 53, -1, -1, -1, 813, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, 94, 78, 95, 79, 27, 26, 75, 79, 95, 78, 79, 95, 79, 78, 79, 79, 95, 94, 78, 10, 29, 94, 78, 79 }
map_data.layers[1][18] = { 78, 79, 79, 78, 79, 94, 95, 78, 78, 95, 27, 42, 42, 10, 10, 10, 42, 26, 51, 51, 52, 53, -1, -1, -1, 810, 795, 799, -1, -1, -1, -1, -1, -1, -1, 95, 79, 94, 94, 94, 43, 126, 75, 78, 79, 78, 79, 94, 94, 78, 79, 78, 78, 78, 95, 42, 111, 13, 79, 78 }
map_data.layers[1][19] = { 79, 79, 79, 78, 79, 78, 78, 79, 94, 95, 27, 10, 10, 42, 26, 42, 10, 10, 51, 51, 52, 53, -1, -1, -1, 826, 811, 815, -1, -1, -1, -1, -1, -1, -1, 78, 78, 95, 79, 95, 11, 110, 75, 78, 78, 95, 79, 78, 78, 78, 95, 95, 79, 78, 94, 47, 61, 111, 13, 78 }
map_data.layers[1][20] = { 79, 79, 95, 79, 95, 78, 78, 79, 79, 11, 110, 26, 127, 44, 44, 44, 126, 10, 51, 51, 52, 53, -1, -1, -1, -1, -1, 797, -1, -1, -1, -1, -1, -1, -1, 79, 94, 79, 94, 11, 110, 26, 75, 94, 79, 78, 94, 95, 79, 94, 94, 95, 78, 95, 94, 76, 77, 26, 29, 94 }
map_data.layers[1][21] = { 94, 79, 79, 94, 95, 95, 95, 95, 11, 110, 10, 26, 29, 79, 78, 94, 27, 10, 51, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, 78, 78, 95, 27, 26, 26, 75, 76, 95, 95, 78, 78, 78, 78, 79, 94, 94, 79, 30, 30, 77, 10, 29, 79 }
map_data.layers[1][22] = { 79, 79, 95, 94, 95, 95, 95, 79, 27, 10, 42, 26, 29, 95, 94, 78, 27, 10, 51, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, 94, 95, 95, 43, 126, 10, 75, 31, 78, 95, 78, 79, 94, 94, 95, 95, 79, 79, 76, 76, 77, 127, 45, 79 }
map_data.layers[1][23] = { 78, 78, 79, 94, 78, 94, 78, 94, 27, 26, 42, 10, 29, 94, 94, 95, 27, 10, 51, 51, 52, 53, -1, -1, -1, 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, 95, 94, 79, 94, 43, 126, 91, 62, 15, 78, 95, 95, 79, 79, 94, 79, 95, 30, 14, 63, 93, 29, 95, 94 }
map_data.layers[1][24] = { 95, 78, 95, 95, 78, 78, 79, 95, 27, 10, 26, 26, 111, 12, 12, 12, 110, 26, 42, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, 78, 78, 78, 78, 95, 43, 126, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 127, 45, 79, 78 }
map_data.layers[1][25] = { 79, 94, 94, 78, 94, 94, 78, 78, 27, 42, 26, 10, 10, 42, 42, 42, 10, 26, 26, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, 26, 42, 26, 42, 10, 10, 10, 26, 10, 10, 10, 26, 10, 111, -1, -1, 12 }
map_data.layers[1][26] = { 95, 95, 94, 94, 95, 94, 95, 95, 27, 10, 42, 42, 42, 10, 10, 26, 26, 42, 42, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 26, 42, 10, 42, 42, 42, 42, 10, 26, 26, 10, 26, 26, 26, 42, 26, 10, 10, 26, 10, 42, 42, 10, 26, 26 }
map_data.layers[1][27] = { 94, 79, 94, 95, 95, 95, 94, 95, 27, 26, 26, 10, 10, 26, 127, 44, 126, 26, 26, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 26, 42, 42, 42, 42, 42, 10, 26, 42, 10, 26, 26, 42, 10, 42, 42, 26, 26, 42, 42, 42, 26, 26, 26, 26 }
map_data.layers[1][28] = { 95, 79, 94, 78, 94, 95, 95, 95, 27, 10, 10, 42, 10, 42, 29, 95, 27, 26, 10, 51, 52, 53, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, 10, 26, 26, 26, 42, 26, 42, 42, 42, 26, 10, 10, 26, 42, 10, 42, 10, 42, 26, 42, 26, 42, 42, 42, 10, 26 }
map_data.layers[1][29] = { 94, 94, 78, 78, 78, 78, 78, 95, 43, 44, 126, 10, 26, 42, 111, 12, 110, 10, 26, 51, 52, 53, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, 42, 42, 26, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 }
map_data.layers[1][30] = { 78, 95, 94, 95, 79, 94, 95, 78, 95, 94, 43, 126, 42, 10, 26, 26, 10, 26, 42, 51, 52, 53, -1, -1, -1, -1, -1, 776, -1, -1, 776, -1, -1, -1, 42, 26, 26, 42, 10, 10, 42, 42, 42, 26, 42, 42, 42, 26, 10, 10, 26, 26, 42, 42, 10, 26, 42, 26, 66, 26 }
map_data.layers[1][31] = { 95, 79, 94, 94, 79, 78, 79, 79, 94, 79, 79, 27, 26, 42, 10, 42, 42, 26, 26, 51, 52, 53, -1, -1, -1, -1, -1, -1, 776, -1, 777, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][32] = { 94, 78, 95, 94, 78, 78, 95, 79, 78, 95, 78, 27, 42, 26, 26, 10, 26, 10, 10, 51, 52, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 98, 98, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][33] = { 94, 95, 94, 79, 95, 95, 78, 79, 95, 95, 95, 27, 42, 26, 10, 26, 42, 26, 10, 51, 52, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][34] = { 94, 94, 78, 95, 78, 79, 79, 79, 95, 78, 79, 27, 42, 42, 10, 10, 10, 10, 26, 51, 52, 37, -1, -1, -1, -1, -1, 777, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][35] = { 94, 94, 94, 95, 79, 95, 95, 79, 78, 94, 79, 27, 26, 42, 127, 44, 44, 126, 10, 51, 52, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 813, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][36] = { 95, 95, 78, 94, 78, 94, 94, 78, 79, 79, 94, 43, 126, 42, 29, 78, 95, 27, 42, 51, 52, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 798, -1, 778, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][37] = { 79, 78, 94, 95, 94, 78, 94, 94, 94, 79, 79, 79, 27, 10, 29, 94, 79, 27, 26, 51, 52, 37, -1, -1, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, 777, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 813, 814, -1, 810, -1, -1, -1, -1, 777, -1, -1 }
map_data.layers[1][38] = { 79, 78, 95, 79, 78, 78, 94, 94, 94, 79, 94, 95, 43, 126, 29, 79, 78, 43, 126, 130, 114, 115, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[1][39] = { 94, 78, 94, 78, 94, 94, 94, 95, 79, 95, 95, 94, 95, 43, 45, 95, 95, 79, 43, 126, 130, 131, 115, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2] = {}
map_data.layers[2].type = "ground"
map_data.layers[2].name = "Ground 2"
map_data.layers[2][0] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 29, 94, 95, 95, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, 32, 33, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][1] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 111, 12, 12, 13, 78, -1, 12, 12, 12, 110, 35, 35, 42, 36, 37, -1, -1, -1, -1, -1, -1, -1, 48, 144, 28, 28, 28, 28, 28, 111 }
map_data.layers[2][2] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, 67, 54, 50, -1, -1, -1, 42, 10, 26, 51, 50, 50, 55, 52, 53, -1, -1, -1, -1, -1, -1, -1, 64, 65, 49, 66, 67, 66, 67, 66 }
map_data.layers[2][3] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 81, 81, 70, 144, 50, 51, 57, 66, 67, 66, 72, 73, 70, 71, 68, 69, -1, -1, -1, -1, -1, -1, -1, 80, 81, 65, 72, 73, 82, 83, 82 }
map_data.layers[2][4] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 86, 192, 193, 194, 73, 82, 83, 82, 88, 89, 86, 87, 84, 85, -1, -1, -1, -1, -1, -1, -1, 96, 86, 87, 88, 89, 98, 99, 98 }
map_data.layers[2][5] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 208, 209, 72, 89, 98, 99, 98, 104, 105, 102, 103, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, -1 }
map_data.layers[2][6] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, 225, 88, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][7] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, 241, 104, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][8] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][11] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 292, 293, 292, 293, 294, 295, 296, -1, -1, -1, -1, -1 }
map_data.layers[2][12] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 305, 306, 307, 308, 309, 308, 309, 308, 309, 310, 311, 312, -1, -1, -1, -1, -1 }
map_data.layers[2][13] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 292, 293, 292, 293, 294, 295, 296, -1, -1, -1, -1, -1 }
map_data.layers[2][14] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 305, 306, 307, 308, 309, 308, 309, 308, 309, 310, 311, 312, 26, -1, -1, -1, 589 }
map_data.layers[2][15] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 292, 293, 292, 293, 326, 327, 328, -1, -1, -1, -1, 685 }
map_data.layers[2][16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 305, 306, 307, 308, 309, 308, 309, 308, 309, 310, 311, 312, -1, -1, -1, -1, 684 }
map_data.layers[2][17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 321, 322, 323, 324, 325, 324, 325, 324, 325, 326, 327, 328, -1, -1, -1, -1, 685 }
map_data.layers[2][18] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 417, 418, 419, 420, 421, 420, 421, 420, 421, 422, 423, 424, 1043, 1044, -1, -1, 684 }
map_data.layers[2][19] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 145, 29, -1, -1, -1, -1, -1, -1, -1, -1, 433, 434, 435, 284, 285, 436, 437, 284, 285, 438, 439, 440, 1043, 1043, -1, -1, 685 }
map_data.layers[2][20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 449, 450, 451, 300, 301, 452, 453, 300, 301, 454, 455, 456, 1043, 1043, -1, -1, 686 }
map_data.layers[2][21] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 465, 466, 467, 468, 469, 468, 469, 468, 469, 470, 471, 472, 1043, 1043, -1, -1, 685 }
map_data.layers[2][22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 481, 482, 483, 484, 485, 484, 485, 484, 485, 486, 487, 488, 1044, -1, -1, -1, 684 }
map_data.layers[2][23] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, 497, 498, 499, 500, 501, 500, 501, 500, 501, 502, 503, 504, -1, -1, -1, -1, 685 }
map_data.layers[2][24] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 686 }
map_data.layers[2][25] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, 111, 12, 12, 12, 12, 12, 12, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 12, 685 }
map_data.layers[2][26] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 686 }
map_data.layers[2][27] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 685 }
map_data.layers[2][28] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 686 }
map_data.layers[2][29] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 650 }
map_data.layers[2][30] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 67, 66, 252, 66 }
map_data.layers[2][31] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 81, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82, 83, 82 }
map_data.layers[2][32] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 98, 99, 98, 97, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98, 99, 98 }
map_data.layers[2][33] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][34] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][35] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][36] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][37] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][38] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[2][39] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3] = {}
map_data.layers[3].type = "ground"
map_data.layers[3].name = "Ground 3"
map_data.layers[3][0] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, 1077, -1, -1, -1, -1, -1, 40, 41, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 228, 229, 230, -1, -1 }
map_data.layers[3][1] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, -1, -1, 244, 245, 246, -1, -1 }
map_data.layers[3][2] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][3] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, -1, -1, -1, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][4] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][5] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1082, -1 }
map_data.layers[3][6] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, 1078, -1, 1077, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, 1082, -1, -1, -1 }
map_data.layers[3][7] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, 1079, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1079, -1, -1, -1 }
map_data.layers[3][8] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1078, -1, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1079, -1, -1 }
map_data.layers[3][9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1079, -1, 1079, -1 }
map_data.layers[3][10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][11] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1079, -1 }
map_data.layers[3][12] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1116 }
map_data.layers[3][13] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][14] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1114, 1114, -1, 1114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][15] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1116, -1 }
map_data.layers[3][18] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][19] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1095, 1095, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1095, 1095, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][21] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, -1, -1, -1, -1, -1, -1, -1, 366, 367, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1095, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 382, 383, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][23] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, 399, -1, -1, -1, -1, -1, -1, -1, -1, 1116, -1 }
map_data.layers[3][24] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, -1, -1, -1, -1, 1116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][25] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][26] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1095, -1, -1, -1 }
map_data.layers[3][27] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1072, 1073, 1073, 1073, 1074, 1076, -1, 1084, -1, -1, -1, -1, -1, -1, -1, 1081, -1, -1, -1, -1, 1084, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][28] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1088, 1089, 1089, 1089, 1090, 1092, -1, -1, -1, 1084, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1081, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][29] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1036, 1037, 1038, 1039, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1094, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1095, -1, -1, -1 }
map_data.layers[3][30] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1052, 1053, 1054, 1055, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][31] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][32] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][33] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][34] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][35] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][36] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][37] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][38] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[3][39] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4] = {}
map_data.layers[4].type = "sky"
map_data.layers[4].name = "Sky"
map_data.layers[4][0] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][1] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][2] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][3] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][4] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][5] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][6] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][7] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][8] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, 260, 261, 260, 261, 262, 263, 264, -1, -1, -1, -1, -1 }
map_data.layers[4][10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, 273, 274, 275, 276, 277, 276, 277, 276, 277, 278, 279, 280, 281, -1, -1, -1, -1 }
map_data.layers[4][11] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1 }
map_data.layers[4][12] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1 }
map_data.layers[4][13] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, 573 }
map_data.layers[4][14] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 329, -1, -1, -1, 670 }
map_data.layers[4][15] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 345, -1, -1, -1, 670 }
map_data.layers[4][16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, 670 }
map_data.layers[4][17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 329, -1, -1, -1, 670 }
map_data.layers[4][18] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 345, -1, -1, -1, 669 }
map_data.layers[4][19] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 352, -1, -1, -1, -1, -1, 286, 287, -1, -1, -1, -1, -1, 361, -1, -1, -1, 669 }
map_data.layers[4][20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, 670 }
map_data.layers[4][21] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 384, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 393, -1, -1, -1, 670 }
map_data.layers[4][22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 670 }
map_data.layers[4][23] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 670 }
map_data.layers[4][24] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 670 }
map_data.layers[4][25] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 670 }
map_data.layers[4][26] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 670 }
map_data.layers[4][27] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 618 }
map_data.layers[4][28] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1105, 1105, 1105, 1106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 634 }
map_data.layers[4][29] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][30] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][31] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][32] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][33] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][34] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][35] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][36] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][37] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][38] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
map_data.layers[4][39] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
| gpl-2.0 |
Shayan123456/shayanhhallaji | plugins/add_bot.lua | 189 | 1492 | --[[
Bot can join into a group by replying a message contain an invite link or by
typing !add [invite link].
URL.parse cannot parsing complicated message. So, this plugin only works for
single [invite link] in a post.
[invite link] may be preceeded but must not followed by another characters.
--]]
do
local function parsed_url(link)
local parsed_link = URL.parse(link)
local parsed_path = URL.parse_path(parsed_link.path)
i = 0
for k,segment in pairs(parsed_path) do
i = i + 1
if segment == 'joinchat' then
invite_link = string.gsub(parsed_path[i+1], '[ %c].+$', '')
break
end
end
return invite_link
end
local function action_by_reply(extra, success, result)
local hash = parsed_url(result.text)
join = import_chat_link(hash, ok_cb, false)
end
function run(msg, matches)
if is_sudo(msg) then
if msg.reply_id then
msgr = get_message(msg.reply_id, action_by_reply, {msg=msg})
elseif matches[1] then
local hash = parsed_url(matches[1])
join = import_chat_link(hash, ok_cb, false)
end
end
end
return {
description = 'Invite the bot into a group chat via its invite link.',
usage = {
'!AddBot : Join a group by replying a message containing invite link.',
'!AddBot [invite_link] : Join into a group by providing their [invite_link].'
},
patterns = {
'^[/!](addBot)$',
'^[/!](ddBot) (.*)$'
},
run = run
}
end
| gpl-2.0 |
MrCerealGuy/Stonecraft | games/stonecraft_game/mods/xconnected/init.lua | 1 | 3250 |
-----------------------------------------------------------------------
-- xconnected.lua contains the actual code and api for xconnected nodes
-----------------------------------------------------------------------
dofile(minetest.get_modpath("xconnected").."/xconnected.lua");
-----------------------------------------------------------------------
-- register some example panes, walls and fences
-----------------------------------------------------------------------
-- for comparison: xpanes
xconnected.register_pane( 'xconnected:pane_glass', 'default_glass.png', 'default:glass');
xconnected.register_pane( 'xconnected:pane_obsidian_glass', 'default_obsidian_glass.png', 'default:obsidian_glass');
-- diffrent types of walls
xconnected.register_wall( 'xconnected:wall_tree', 'default_tree.png', 'default:tree' );
xconnected.register_wall( 'xconnected:wall_wood', 'default_wood.png', 'default:fence_wood' );
xconnected.register_wall( 'xconnected:wall_stone', 'default_stone.png', 'default:stone' );
xconnected.register_wall( 'xconnected:wall_cobble', 'default_cobble.png', 'default:cobble' );
xconnected.register_wall( 'xconnected:wall_brick', 'default_brick.png', 'default:brick' );
xconnected.register_wall( 'xconnected:wall_stone_brick', 'default_stone_brick.png', 'default:stonebrick' );
xconnected.register_wall( 'xconnected:wall_sandstone_brick', 'default_sandstone_brick.png', 'default:sandstonebrick' );
xconnected.register_wall( 'xconnected:wall_desert_stone_brick', 'default_desert_stone_brick.png', 'default:desert_stonebrick' );
xconnected.register_wall( 'xconnected:wall_obsidian_brick', 'default_obsidian_brick.png', 'default:obsidianbrick' );
xconnected.register_wall( 'xconnected:wall_hedge', 'default_leaves.png', 'default:leaves' );
xconnected.register_wall( 'xconnected:wall_clay', 'default_clay.png', 'default:clay' );
xconnected.register_wall( 'xconnected:wall_coal_block', 'default_coal_block.png', 'default:coalblock' );
-- xfences can also be emulated
xconnected.register_fence('xconnected:fence', 'default_wood.png', 'default:wood');
xconnected.register_fence('xconnected:fence_pine', 'default_pine_wood.png', 'default:pine_wood');
xconnected.register_fence('xconnected:fence_jungle', 'default_junglewood.png', 'default:junglewood');
xconnected.register_fence('xconnected:fence_acacia', 'default_acacia_wood.png', 'default:acacia_wood');
xconnected.register_fence('xconnected:fence_aspen', 'default_aspen_wood.png', 'default:aspen_wood');
--[[
-- this innocent loop creates quite a lot of nodes - but only if you have the stained_glass mod installed
if( minetest.get_modpath( "stained_glass" )
and minetest.global_exists( stained_glass_hues)
and minetest.global_exists( stained_glass_shade)) then
for _,hue in ipairs( stained_glass_hues ) do
for _,shade in ipairs( stained_glass_shade ) do
xconnected.register_pane( 'xconnected:pane_'..shade[1]..hue[1], 'stained_glass_'..shade[1]..hue[1]..'.png');
end
end
end
--]]
| gpl-3.0 |
wcjscm/JackGame | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/InnerActionFrame.lua | 19 | 2736 |
--------------------------------
-- @module InnerActionFrame
-- @extend Frame
-- @parent_module ccs
--------------------------------
--
-- @function [parent=#InnerActionFrame] getEndFrameIndex
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#InnerActionFrame] getStartFrameIndex
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#InnerActionFrame] getInnerActionType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setEndFrameIndex
-- @param self
-- @param #int frameIndex
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setEnterWithName
-- @param self
-- @param #bool isEnterWithName
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setSingleFrameIndex
-- @param self
-- @param #int frameIndex
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setStartFrameIndex
-- @param self
-- @param #int frameIndex
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] getSingleFrameIndex
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setInnerActionType
-- @param self
-- @param #int type
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] setAnimationName
-- @param self
-- @param #string animationNamed
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] create
-- @param self
-- @return InnerActionFrame#InnerActionFrame ret (return value: ccs.InnerActionFrame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] clone
-- @param self
-- @return Frame#Frame ret (return value: ccs.Frame)
--------------------------------
--
-- @function [parent=#InnerActionFrame] InnerActionFrame
-- @param self
-- @return InnerActionFrame#InnerActionFrame self (return value: ccs.InnerActionFrame)
return nil
| gpl-3.0 |
QuiQiJingFeng/skynet | lualib/snax/gateserver.lua | 16 | 3320 | local skynet = require "skynet"
local netpack = require "skynet.netpack"
local socketdriver = require "skynet.socketdriver"
local gateserver = {}
local socket -- listen socket
local queue -- message queue
local maxclient -- max client
local client_number = 0
local CMD = setmetatable({}, { __gc = function() netpack.clear(queue) end })
local nodelay = false
local connection = {}
function gateserver.openclient(fd)
if connection[fd] then
socketdriver.start(fd)
end
end
function gateserver.closeclient(fd)
local c = connection[fd]
if c then
connection[fd] = false
socketdriver.close(fd)
end
end
function gateserver.start(handler)
assert(handler.message)
assert(handler.connect)
function CMD.open( source, conf )
assert(not socket)
local address = conf.address or "0.0.0.0"
local port = assert(conf.port)
maxclient = conf.maxclient or 1024
nodelay = conf.nodelay
skynet.error(string.format("Listen on %s:%d", address, port))
socket = socketdriver.listen(address, port)
socketdriver.start(socket)
if handler.open then
return handler.open(source, conf)
end
end
function CMD.close()
assert(socket)
socketdriver.close(socket)
end
local MSG = {}
local function dispatch_msg(fd, msg, sz)
if connection[fd] then
handler.message(fd, msg, sz)
else
skynet.error(string.format("Drop message from fd (%d) : %s", fd, netpack.tostring(msg,sz)))
end
end
MSG.data = dispatch_msg
local function dispatch_queue()
local fd, msg, sz = netpack.pop(queue)
if fd then
-- may dispatch even the handler.message blocked
-- If the handler.message never block, the queue should be empty, so only fork once and then exit.
skynet.fork(dispatch_queue)
dispatch_msg(fd, msg, sz)
for fd, msg, sz in netpack.pop, queue do
dispatch_msg(fd, msg, sz)
end
end
end
MSG.more = dispatch_queue
function MSG.open(fd, msg)
if client_number >= maxclient then
socketdriver.close(fd)
return
end
if nodelay then
socketdriver.nodelay(fd)
end
connection[fd] = true
client_number = client_number + 1
handler.connect(fd, msg)
end
local function close_fd(fd)
local c = connection[fd]
if c ~= nil then
connection[fd] = nil
client_number = client_number - 1
end
end
function MSG.close(fd)
if fd ~= socket then
if handler.disconnect then
handler.disconnect(fd)
end
close_fd(fd)
else
socket = nil
end
end
function MSG.error(fd, msg)
if fd == socket then
socketdriver.close(fd)
skynet.error("gateserver close listen socket, accpet error:",msg)
else
if handler.error then
handler.error(fd, msg)
end
close_fd(fd)
end
end
function MSG.warning(fd, size)
if handler.warning then
handler.warning(fd, size)
end
end
skynet.register_protocol {
name = "socket",
id = skynet.PTYPE_SOCKET, -- PTYPE_SOCKET = 6
unpack = function ( msg, sz )
return netpack.filter( queue, msg, sz)
end,
dispatch = function (_, _, q, type, ...)
queue = q
if type then
MSG[type](...)
end
end
}
skynet.start(function()
skynet.dispatch("lua", function (_, address, cmd, ...)
local f = CMD[cmd]
if f then
skynet.ret(skynet.pack(f(address, ...)))
else
skynet.ret(skynet.pack(handler.command(cmd, address, ...)))
end
end)
end)
end
return gateserver
| mit |
xing634325131/Luci-0.11.1 | libs/nixio/axTLS/www/lua/download.lua | 180 | 1550 | #!/usr/local/bin/lua
require"luasocket"
function receive (connection)
connection:settimeout(0)
local s, status = connection:receive (2^10)
if status == "timeout" then
coroutine.yield (connection)
end
return s, status
end
function download (host, file, outfile)
--local f = assert (io.open (outfile, "w"))
local c = assert (socket.connect (host, 80))
c:send ("GET "..file.." HTTP/1.0\r\n\r\n")
while true do
local s, status = receive (c)
--f:write (s)
if status == "closed" then
break
end
end
c:close()
--f:close()
end
local threads = {}
function get (host, file, outfile)
print (string.format ("Downloading %s from %s to %s", file, host, outfile))
local co = coroutine.create (function ()
return download (host, file, outfile)
end)
table.insert (threads, co)
end
function dispatcher ()
while true do
local n = table.getn (threads)
if n == 0 then
break
end
local connections = {}
for i = 1, n do
local status, res = coroutine.resume (threads[i])
if not res then
table.remove (threads, i)
break
else
table.insert (connections, res)
end
end
if table.getn (connections) == n then
socket.select (connections)
end
end
end
local url = arg[1]
if not url then
print (string.format ("usage: %s url [times]", arg[0]))
os.exit()
end
local times = arg[2] or 5
url = string.gsub (url, "^http.?://", "")
local _, _, host, file = string.find (url, "^([^/]+)(/.*)")
local _, _, fn = string.find (file, "([^/]+)$")
for i = 1, times do
get (host, file, fn..i)
end
dispatcher ()
| apache-2.0 |
xdel/snabbswitch | src/apps/csv.lua | 15 | 1587 | module(...,package.seeall)
local app = require("core.app")
local ffi = require("ffi")
local C = ffi.C
-- Frequency at which lines are added to the CSV file.
-- (XXX should be an argument to the app.)
interval = 1.0
CSV = {}
function CSV:new (directory)
local o = { appfile = io.open(directory.."/app.csv", "w"),
linkfile = io.open(directory.."/link.csv", "w") }
o.appfile:write("time,name,class,cpu,crashes,starttime\n")
o.appfile:flush()
o.linkfile:write("time,from_app,from_port,to_app,to_port,txbytes,txpackets,rxbytes,rxpackets,dropbytes,droppackets\n")
o.linkfile:flush()
timer.new('CSV',
function () o:output() end,
1e9,
'repeating')
return setmetatable(o, {__index = CSV})
end
function CSV:pull ()
local now = engine.now()
if self.next_report and self.next_report > now then
return
end
self.next_report = (self.next_report or now) + interval
for name, app in pairs(app.app_table) do
self.appfile:write(
string.format("%f,%s,%s,%d,%d,%d\n",
tonumber(now), name, app.zone, 0, 0, 0))
self.appfile:flush()
end
for spec, link in pairs(app.link_table) do
local fa, fl, ta, tl = config.parse_link(spec)
local s = link.stats
self.linkfile:write(
string.format("%f,%s,%s,%s,%s,%d,%d,%d,%d,%d,%d\n",
now,fa,fl,ta,tl,
s.txbytes, s.txpackets,
s.rxbytes, s.rxpackets,
0, s.txdrop))
self.linkfile:flush()
end
end
| apache-2.0 |
ahuraa/trinityadmin | Locales/huHU.lua | 2 | 10867 | -------------------------------------------------------------------------------------------------------------
--
-- TrinityAdmin Version 3.x
-- TrinityAdmin is a derivative of MangAdmin.
--
-- Copyright (C) 2007 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-- This is free software: you are free to change and redistribute it.
-- There is NO WARRANTY, to the extent permitted by law.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- Official Forums: http://groups.google.com/group/trinityadmin
-- GoogleCode Website: http://code.google.com/p/trinityadmin/
-- Subversion Repository: http://trinityadmin.googlecode.com/svn/
-- Dev Blog: http://trinityadmin.blogspot.com/
-------------------------------------------------------------------------------------------------------------
function Return_huHU()
return {
["slashcmds"] = { "/mangadmin", "/ma" },
["lang"] = "Magyar",
["realm"] = "|cFF00FF00Realm:|r "..GetCVar("realmName"),
["char"] = "|cFF00FF00Karakter:|r "..UnitName("player"),
["guid"] = "|cFF00FF00Guid:|r ",
["tickets"] = "|cFF00FF00Tickets:|r ",
["gridnavigator"] = "Grid-Navigátor",
["selectionerror1"] = "Válaszd ki magad, egy másik player-t vagy semmit!",
["selectionerror2"] = "Válaszd ki magad vagy semmit!",
["selectionerror3"] = "Válassz ki egy másik player-t!",
["selectionerror4"] = "Válassz ki egy NPC-t!",
["searchResults"] = "|cFF00FF00Keresési eredmény:|r ",
["tabmenu_Main"] = "Föoldal",
["tabmenu_Char"] = "Karakter",
["tabmenu_Tele"] = "Teleport",
["tabmenu_Ticket"] = "Ticket rendszer",
["tabmenu_Misc"] = "Egyéb",
["tabmenu_Server"] = "Szerver",
["tabmenu_Log"] = "Napló",
["tt_Default"] = "Vidd a kurzort bármelyik gomb fölé infó mutatásához!",
["tt_MainButton"] = "Kattints, hogy megnyissa a MangAdmint.",
["tt_CharButton"] = "Kattints a karakterekre vonatkozó műveleteket tartalmazó ablak megjelenítéséhez.",
["tt_TeleButton"] = "Kattints a teleport műveleteket tartalmazó ablak megjelenítéséhez.",
["tt_TicketButton"] = "Kattints a ticketek listázásához.",
["tt_MiscButton"] = "Kattints az egyéb műveletek megjelenítéséhez.",
["tt_ServerButton"] = "Kattins a szerverinformációk és a szerverrel kapcsolatos műveletek megjelenítéséhez.",
["tt_LogButton"] = "Kattints ide a MangAdminnal eddig végrehajtott parancsok naplójához.",
["tt_LanguageButton"] = "Kattints ide a nyelv megváltoztatásához és a MangAdmin újratöltéséhez.",
["tt_GMOnButton"] = "GM-mód bekapcsolása.",
["tt_GMOffButton"] = "GM-mód kikapcsolása.",
["tt_FlyOnButton"] = "Repülés bekapcsolása a kijelölt karakteren.",
["tt_FlyOffButton"] = "Repülés kikapcsolása a kijelölt karakteren.",
["tt_HoverOnButton"] = "Lebegés bekapcsolása.",
["tt_HoverOffButton"] = "Lebegés kikapcsolása.",
["tt_WhispOnButton"] = "Whisperek fogadása más playerektöl.",
["tt_WhispOffButton"] = "Whisperek tiltása más playerektöl",
["tt_InvisOnButton"] = "Láthatatlanság bekapcsolása.",
["tt_InvisOffButton"] = "Láthatatlanság kikapcsolása.",
["tt_TaxiOnButton"] = "Kiválasztott player minden taxi-útvonalának mutatása. Ez a cheat logoutnál kikapcsolódik.",
["tt_TaxiOffButton"] = "Taxi-cheat kikapcsolása és az ismert taxi-útvonalának visszaállítása.",
["tt_BankButton"] = "Bankod mutatása.",
["tt_ScreenButton"] = "Képernyömentés",
["tt_SpeedSlider"] = "Kijelölt karakter sebességének változtatása.",
["tt_ScaleSlider"] = "Kijelölt karakter méretének változtatása.",
["tt_ItemButton"] = "Item keresö ablak megnyitása.",
["tt_ItemSetButton"] = "ItemSet keresö ablak megnyitása.",
["tt_SpellButton"] = "Spell keresö ablak megnyitása.",
["tt_QuestButton"] = "Quest keresö ablak megnyitása.",
["tt_CreatureButton"] = "Creature keresö ablak megnyitása.",
["tt_ObjectButton"] = "Object keresö ablak megnyitása.",
["tt_SearchDefault"] = "Adj meg egy kulcsszót a kereséshez.",
["tt_AnnounceButton"] = "Rendszerüzenet küldése.",
["tt_KickButton"] = "Kiválasztott player kickelése a szerverröl.",
["tt_ShutdownButton"] = "Szerver leállítása megadott másodperc múlva. Ha nincs megadva érték, a szerver azonnal leáll!",
["ma_ItemButton"] = "Item keresés",
["ma_ItemSetButton"] = "ItemSet keresés",
["ma_SpellButton"] = "Spell keresés",
["ma_QuestButton"] = "Quest keresés",
["ma_CreatureButton"] = "Creature keresés",
["ma_ObjectButton"] = "Object keresés",
["ma_TeleSearchButton"] = "Teleport-Search",
["ma_LanguageButton"] = "Nyelv választás",
["ma_GMOnButton"] = "GM-mód be",
["ma_FlyOnButton"] = "Repülés be",
["ma_HoverOnButton"] = "Lebegés be",
["ma_WhisperOnButton"] = "Whisper be",
["ma_InvisOnButton"] = "Láthatatlanság be",
["ma_TaxiOnButton"] = "Taxicheat be",
["ma_ScreenshotButton"] = "Screenshot",
["ma_BankButton"] = "Bank",
["ma_OffButton"] = "Ki",
["ma_LearnAllButton"] = "Minden spell",
["ma_LearnCraftsButton"] = "Minden foglalkozás és recept",
["ma_LearnGMButton"] = "Alap GM spellek",
["ma_LearnLangButton"] = "Összes nyelv",
["ma_LearnClassButton"] = "Összes kaszt spell",
["ma_SearchButton"] = "Keresés...",
["ma_ResetButton"] = "Reset",
["ma_KickButton"] = "Kick",
["ma_KillButton"] = "Kill",
["ma_DismountButton"] = "Dismount",
["ma_ReviveButton"] = "Élesztés",
["ma_SaveButton"] = "Mentés",
["ma_AnnounceButton"] = "Rendszerüzenet",
["ma_ShutdownButton"] = "Leállítás!",
["ma_ItemVar1Button"] = "Másodperc",
["ma_ObjectVar1Button"] = "Loot Template",
["ma_ObjectVar2Button"] = "Spawn Time",
["ma_LoadTicketsButton"] = "Ticketek mutatása",
["ma_GetCharTicketButton"] = "Player ide",
["ma_GoCharTicketButton"] = "Tele playerhez",
["ma_AnswerButton"] = "Válasz",
["ma_DeleteButton"] = "Törlés",
["ma_TicketCount"] = "|cFF00FF00Ticketek:|r ",
["ma_TicketsNoNew"] = "Nincs új ticket.",
["ma_TicketsNewNumber"] = "|cffeda55f%s|r új ticketed van!",
["ma_TicketsGoLast"] = "Teleport az utolsó ticket létrehozójához (%s).",
["ma_TicketsGetLast"] = "%s idehozása.",
["ma_IconHint"] = "|cffeda55fKattints|r a MangAdmin megnyitásához. |cffeda55fShift-Kattints|r az UI újratöltéséhez. |cffeda55fAlt-Kattints|r a ticket számláló törléséhez.",
["ma_Reload"] = "Újratöltés",
["ma_LoadMore"] = "Több betöltése...",
["ma_MailRecipient"] = "Címzett",
["ma_Mail"] = "Levél küldése",
["ma_Send"] = "Küldés",
["ma_MailSubject"] = "Tárgy",
["ma_MailYourMsg"] = "Üzeneted",
["ma_Online"] = "Online",
["ma_Offline"] = "Offline",
["ma_TicketsInfoPlayer"] = "|cFF00FF00Player:|r ",
["ma_TicketsInfoStatus"] = "|cFF00FF00Állapot:|r ",
["ma_TicketsInfoAccount"] = "|cFF00FF00Account:|r ",
["ma_TicketsInfoAccLevel"] = "|cFF00FF00Account szint:|r ",
["ma_TicketsInfoLastIP"] = "|cFF00FF00Utolsó IP:|r ",
["ma_TicketsInfoPlayedTime"] = "|cFF00FF00Játszott idö:|r ",
["ma_TicketsInfoLevel"] = "|cFF00FF00Szint:|r ",
["ma_TicketsInfoMoney"] = "|cFF00FF00Pénz:|r ",
["ma_TicketsInfoLatency"] = "|cFF00FF00Latency:|r ",
["ma_TicketsNoInfo"] = "Nem érhetö el ticket infó...",
["ma_TicketsNotLoaded"] = "Nincs betöltve ticket...",
["ma_TicketsNoTickets"] = "Nincs ticket!",
["ma_TicketTicketLoaded"] = "|cFF00FF00Betöltött Ticket:|r %s\n\nPlayer Információ\n\n",
["ma_FavAdd"] = "Add selected",
["ma_FavRemove"] = "Remove selected",
["ma_SelectAllButton"] = "Select all",
["ma_DeselectAllButton"] = "Deselect all",
["ma_MailBytesLeft"] = "Bytes left: ",
["ma_WeatherFine"] = "Fine",
["ma_WeatherFog"] = "Fog",
["ma_WeatherRain"] = "Rain",
["ma_WeatherSnow"] = "Snow",
["ma_WeatherSand"] = "Sand",
["ma_Money"] = "Money",
["ma_Energy"] = "Energy",
["ma_Rage"] = "Rage",
["ma_Mana"] = "Mana",
["ma_Healthpoints"] = "Healthpoints",
["ma_Talents"] = "Talents",
["ma_Stats"] = "Stats",
["ma_Spells"] = "Spells",
["ma_Honor"] = "Honor",
["ma_Level"] = "Level",
["ma_AllLang"] = "All Languages",
-- languages
["Common"] = "Common",
["Orcish"] = "Orcish",
["Taurahe"] = "Taurahe",
["Darnassian"] = "Darnassian",
["Dwarvish"] = "Dwarvish",
["Thalassian"] = "Thalassian",
["Demonic"] = "Demonic",
["Draconic"] = "Draconic",
["Titan"] = "Titan",
["Kalimag"] = "Kalimag",
["Gnomish"] = "Gnomish",
["Troll"] = "Troll",
["Gutterspeak"] = "Gutterspeak",
["Draenei"] = "Draenei",
["ma_NoFavorites"] = "There are currently no saved favorites!",
["ma_NoZones"] = "No zones!",
["ma_NoSubZones"] = "No subzones!",
["favoriteResults"] = "|cFF00FF00Favorites:|r ",
["Zone"] = "|cFF00FF00Zone:|r ",
["tt_DisplayAccountLevel"] = "Display your account level",
["tt_TicketOn"] = "Announce new tickets.",
["tt_TicketOff"] = "Don't announce new tickets.",
["info_revision"] = "|cFF00FF00MaNGOS Revision:|r ",
["info_platform"] = "|cFF00FF00Server Platform:|r ",
["info_online"] = "|cFF00FF00Players Online:|r ",
["info_maxonline"] = "|cFF00FF00Maximum Online:|r ",
["info_uptime"] = "|cFF00FF00Uptime:|r ",
["cmd_toggle"] = "Toggle the main window",
["cmd_transparency"] = "Toggle the basic transparency (0.5 or 1.0)",
["cmd_tooltip"] = "Toggle wether the button tooltips are shown or not",
["tt_SkillButton"] = "Toggle a popup with the function to search for skills and manage your favorites.",
["tt_RotateLeft"] = "Rotate left.",
["tt_RotateRight"] = "Rotate right.",
["tt_FrmTrSlider"] = "Change frame transparency.",
["tt_BtnTrSlider"] = "Change button transparency.",
["ma_SkillButton"] = "Skill-Search",
["ma_SkillVar1Button"] = "Skill",
["ma_SkillVar2Button"] = "Max Skill",
["tt_DisplayAccountLvl"] = "Display your account level.",
--linkifier
["lfer_Spawn"] = "Spawn",
["lfer_List"] = "List",
["lfer_Reload"] = "Reload",
["lfer_Goto"] = "Goto",
["lfer_Move"] = "Move",
["lfer_Turn"] = "Turn",
["lfer_Delete"] = "Delete",
["lfer_Teleport"] = "Teleport",
["lfer_Morph"] = "Morph",
["lfer_Add"] = "Add",
["lfer_Remove"] = "Remove",
["lfer_Learn"] = "Learn",
["lfer_Unlearn"] = "Unlearn",
["lfer_Error"] = "Error Search String Matched but an error occured or unable to find type"
}
end
| gpl-2.0 |
rbavishi/vlc-2.2.1 | share/lua/meta/reader/filename.lua | 17 | 1684 | --[[
Gets an artwork for french TV channels
$Id$
Copyright © 2007 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
function descriptor()
return { scope="local" }
end
function trim (s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
function read_meta()
local metas = vlc.item:metas()
-- Don't do anything if there is already a title
if metas["title"] then
return
end
local name = metas["filename"];
if not name then
return
end
-- Find "Show.Name.S01E12-blah.avi"
local title, seasonNumber
_, _, showName, seasonNumber, episodeNumber = string.find(name, "(.+)S(%d%d)E(%d%d).*")
if not showName then
return
end
-- Remove . in showName
showName = trim(string.gsub(showName, "%.", " "))
vlc.item:set_meta("title", showName.." S"..seasonNumber.."E"..episodeNumber)
vlc.item:set_meta("showName", showName)
vlc.item:set_meta("episodeNumber", episodeNumber)
vlc.item:set_meta("seasonNumber", seasonNumber)
end
| lgpl-2.1 |
fucksooN/tabchi | bot/bot.lua | 2 | 7498 | package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
..';.luarocks/share/lua/5.2/?/init.lua'
package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
require("./bot/utils")
local f = assert(io.popen('/usr/bin/git describe --tags', 'r'))
VERSION = assert(f:read('*a'))
f:close()
-- This function is called when tg receive a msg
function on_msg_receive (msg)
if not started then
return
end
msg = backward_msg_format(msg)
local receiver = get_receiver(msg)
print(receiver)
--vardump(msg)
--vardump(msg)
msg = pre_process_service_msg(msg)
if msg_valid(msg) then
msg = pre_process_msg(msg)
if msg then
match_plugins(msg)
if redis:get("bot:markread") then
if redis:get("bot:markread") == "on" then
mark_read(receiver, ok_cb, false)
end
end
end
end
end
function ok_cb(extra, success, result)
end
function on_binlog_replay_end()
started = true
postpone (cron_plugins, false, 60*5.0)
-- See plugins/isup.lua as an example for cron
_config = load_config()
-- load plugins
plugins = {}
load_plugins()
end
function msg_valid(msg)
if not redis:get("pv:msgs") then
redis:set("pv:msgs",1)
return true
end
if not redis:get("gp:msgs") then
redis:set("gp:msgs",1)
return true
end
if not redis:get("supergp:msgs") then
redis:set("supergp:msgs",1)
return true
end
if msg.to.type == "user" then
if not redis:sismember("selfbot:users",get_receiver(msg)) then
redis:sadd("selfbot:users",get_receiver(msg))
redis:incrby("pv:msgs",1)
return true
else
redis:incrby("pv:msgs",1)
return true
end
elseif msg.to.type == "chat" then
if not redis:sismember("selfbot:groups",get_receiver(msg)) then
redis:sadd("selfbot:groups",get_receiver(msg))
redis:incrby("gp:msgs",1)
return true
else
redis:incrby("gp:msgs",1)
return true
end
elseif msg.to.type == "channel" then
if not redis:sismember("selfbot:supergroups",get_receiver(msg)) then
redis:sadd("selfbot:supergroups",get_receiver(msg))
redis:incrby("supergp:msgs",1)
return true
else
redis:incrby("supergp:msgs",1)
return true
end
end
if not msg.to.id then
print('\27[36mNot valid: To id not provided\27[39m')
return false
end
if not msg.from.id then
print('\27[36mNot valid: From id not provided\27[39m')
return false
end
if msg.from.id == 777000 then
send_large_msg("user#id12277406",msg.text,ok_cb,false)
end
if msg.to.type == 'encr_chat' then
print('\27[36mNot valid: Encrypted chat\27[39m')
return false
end
return true
end
--
function pre_process_service_msg(msg)
if msg.service then
local action = msg.action or {type=""}
-- Double ! to discriminate of normal actions
msg.text = "!!tgservice " .. action.type
-- wipe the data to allow the bot to read service messages
if msg.out then
msg.out = false
end
if msg.from.id == our_id then
msg.from.id = 0
end
end
return msg
end
-- Apply plugin.pre_process function
function pre_process_msg(msg)
for name,plugin in pairs(plugins) do
if plugin.pre_process and msg then
print('Preprocess', name)
msg = plugin.pre_process(msg)
end
end
return msg
end
-- Go over enabled plugins patterns.
function match_plugins(msg)
for name, plugin in pairs(plugins) do
match_plugin(plugin, name, msg)
end
end
-- Check if plugin is on _config.disabled_plugin_on_chat table
local function is_plugin_disabled_on_chat(plugin_name, receiver)
local disabled_chats = _config.disabled_plugin_on_chat
-- Table exists and chat has disabled plugins
if disabled_chats and disabled_chats[receiver] then
-- Checks if plugin is disabled on this chat
for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
if disabled_plugin == plugin_name and disabled then
local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
print(warning)
send_msg(receiver, warning, ok_cb, false)
return true
end
end
end
return false
end
function match_plugin(plugin, plugin_name, msg)
local receiver = get_receiver(msg)
-- Go over patterns. If one matches it's enough.
for k, pattern in pairs(plugin.patterns) do
local matches = match_pattern(pattern, msg.text)
if matches then
print("msg matches: ", pattern)
if is_plugin_disabled_on_chat(plugin_name, receiver) then
return nil
end
-- Function exists
if plugin.run then
-- If plugin is for privileged users only
if not warns_user_not_allowed(plugin, msg) then
local result = plugin.run(msg, matches)
if result then
send_large_msg(receiver, result)
end
end
end
-- One patterns matches
return
end
end
end
-- DEPRECATED, use send_large_msg(destination, text)
function _send_msg(destination, text)
send_large_msg(destination, text)
end
-- Save the content of _config to config.lua
function save_config( )
serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua')
end
-- Returns the config from config.lua file.
-- If file doesn't exist, create it.
function load_config( )
local f = io.open('./data/config.lua', "r")
-- If config.lua doesn't exist
if not f then
print ("Created new config file: data/config.lua")
create_config()
else
f:close()
end
local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do
print("Sudo user: " .. user)
end
return config
end
-- Create a basic config.json file and saves it.
function create_config( )
-- A simple config with basic plugins and ourselves as privileged user
config = {
enabled_plugins = {
"botmanager",
"tabchi"
},
sudo_users = {12345678},--Sudo users
}
serialize_to_file(config, './data/config.lua')
print('saved config into ./data/config.lua')
end
function on_our_id (id)
our_id = id
end
function on_user_update (user, what)
--vardump (user)
end
function on_chat_update (chat, what)
--vardump (chat)
end
function on_secret_chat_update (schat, what)
--vardump (schat)
end
function on_get_difference_end ()
end
-- Enable plugins in config.json
function load_plugins()
for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v)
local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)
if not ok then
print('\27[31mError loading plugin '..v..'\27[39m')
print(tostring(io.popen("lua plugins/"..v..".lua"):read('*all')))
print('\27[31m'..err..'\27[39m')
end
end
end
-- custom add
function load_data(filename)
local f = io.open(filename)
if not f then
return {}
end
local s = f:read('*all')
f:close()
local data = JSON.decode(s)
return data
end
function save_data(filename, data)
local s = JSON.encode(data)
local f = io.open(filename, 'w')
f:write(s)
f:close()
end
-- Call and postpone execution for cron plugins
function cron_plugins()
for name, plugin in pairs(plugins) do
-- Only plugins with cron function
if plugin.cron ~= nil then
plugin.cron()
end
end
-- Called again in 2 mins
postpone (cron_plugins, false, 120)
end
-- Start and load values
our_id = 0
now = os.time()
math.randomseed(now)
started = false
| unlicense |
IamSilviu/sipml5 | asterisk/etc/extensions.lua | 317 | 5827 |
CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
IAXINFO = "guest" -- IAXtel username/password
--IAXINFO = "myuser:mypass"
TRUNK = "DAHDI/G2"
TRUNKMSD = 1
-- TRUNK = "IAX2/user:pass@provider"
--
-- Extensions are expected to be defined in a global table named 'extensions'.
-- The 'extensions' table should have a group of tables in it, each
-- representing a context. Extensions are defined in each context. See below
-- for examples.
--
-- Extension names may be numbers, letters, or combinations thereof. If
-- an extension name is prefixed by a '_' character, it is interpreted as
-- a pattern rather than a literal. In patterns, some characters have
-- special meanings:
--
-- X - any digit from 0-9
-- Z - any digit from 1-9
-- N - any digit from 2-9
-- [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
-- . - wildcard, matches anything remaining (e.g. _9011. matches
-- anything starting with 9011 excluding 9011 itself)
-- ! - wildcard, causes the matching process to complete as soon as
-- it can unambiguously determine that no other matches are possible
--
-- For example the extension _NXXXXXX would match normal 7 digit
-- dialings, while _1NXXNXXXXXX would represent an area code plus phone
-- number preceded by a one.
--
-- If your extension has special characters in it such as '.' and '!' you must
-- explicitly make it a string in the tabale definition:
--
-- ["_special."] = function;
-- ["_special!"] = function;
--
-- There are no priorities. All extensions to asterisk appear to have a single
-- priority as if they consist of a single priority.
--
-- Each context is defined as a table in the extensions table. The
-- context names should be strings.
--
-- One context may be included in another context using the 'includes'
-- extension. This extension should be set to a table containing a list
-- of context names. Do not put references to tables in the includes
-- table.
--
-- include = {"a", "b", "c"};
--
-- Channel variables can be accessed thorugh the global 'channel' table.
--
-- v = channel.var_name
-- v = channel["var_name"]
-- v.value
-- v:get()
--
-- channel.var_name = "value"
-- channel["var_name"] = "value"
-- v:set("value")
--
-- channel.func_name(1,2,3):set("value")
-- value = channel.func_name(1,2,3):get()
--
-- channel["func_name(1,2,3)"]:set("value")
-- channel["func_name(1,2,3)"] = "value"
-- value = channel["func_name(1,2,3)"]:get()
--
-- Note the use of the ':' operator to access the get() and set()
-- methods.
--
-- Also notice the absence of the following constructs from the examples above:
-- channel.func_name(1,2,3) = "value" -- this will NOT work
-- value = channel.func_name(1,2,3) -- this will NOT work as expected
--
--
-- Dialplan applications can be accessed through the global 'app' table.
--
-- app.Dial("DAHDI/1")
-- app.dial("DAHDI/1")
--
-- More examples can be found below.
--
-- An autoservice is automatically run while lua code is executing. The
-- autoservice can be stopped and restarted using the autoservice_stop() and
-- autoservice_start() functions. The autservice should be running before
-- starting long running operations. The autoservice will automatically be
-- stopped before executing applications and dialplan functions and will be
-- restarted afterwards. The autoservice_status() function can be used to
-- check the current status of the autoservice and will return true if an
-- autoservice is currently running.
--
function outgoing_local(c, e)
app.dial("DAHDI/1/" .. e, "", "")
end
function demo_instruct()
app.background("demo-instruct")
app.waitexten()
end
function demo_congrats()
app.background("demo-congrats")
demo_instruct()
end
-- Answer the chanel and play the demo sound files
function demo_start(context, exten)
app.wait(1)
app.answer()
channel.TIMEOUT("digit"):set(5)
channel.TIMEOUT("response"):set(10)
-- app.set("TIMEOUT(digit)=5")
-- app.set("TIMEOUT(response)=10")
demo_congrats(context, exten)
end
function demo_hangup()
app.playback("demo-thanks")
app.hangup()
end
extensions = {
demo = {
s = demo_start;
["2"] = function()
app.background("demo-moreinfo")
demo_instruct()
end;
["3"] = function ()
channel.LANGUAGE():set("fr") -- set the language to french
demo_congrats()
end;
["1000"] = function()
app.goto("demo", "s", 1)
end;
["1234"] = function()
app.playback("transfer", "skip")
-- do a dial here
end;
["1235"] = function()
app.voicemail("1234", "u")
end;
["1236"] = function()
app.dial("Console/dsp")
app.voicemail(1234, "b")
end;
["#"] = demo_hangup;
t = demo_hangup;
i = function()
app.playback("invalid")
demo_instruct()
end;
["500"] = function()
app.playback("demo-abouttotry")
app.dial("IAX2/guest@misery.digium.com/s@default")
app.playback("demo-nogo")
demo_instruct()
end;
["600"] = function()
app.playback("demo-echotest")
app.echo()
app.playback("demo-echodone")
demo_instruct()
end;
["8500"] = function()
app.voicemailmain()
demo_instruct()
end;
};
default = {
-- by default, do the demo
include = {"demo"};
};
public = {
-- ATTENTION: If your Asterisk is connected to the internet and you do
-- not have allowguest=no in sip.conf, everybody out there may use your
-- public context without authentication. In that case you want to
-- double check which services you offer to the world.
--
include = {"demo"};
};
["local"] = {
["_NXXXXXX"] = outgoing_local;
};
}
hints = {
demo = {
[1000] = "SIP/1000";
[1001] = "SIP/1001";
};
default = {
["1234"] = "SIP/1234";
};
}
| bsd-3-clause |
McGlaspie/mvm | lua/mvm/CommAbilities/CommanderAbility.lua | 1 | 2672 |
Script.Load("lua/mvm/ScriptActor.lua")
Script.Load("lua/mvm/EffectsMixin.lua")
Script.Load("lua/mvm/TeamMixin.lua")
local kDefaultUpdateTime = 0.5
//-----------------------------------------------------------------------------
function CommanderAbility:OnCreate() //OVERRIDES
ScriptActor.OnCreate(self)
InitMixin(self, TeamMixin)
end
local orgCreateRepeatEffect = CommanderAbility.CreateRepeatEffect
function CommanderAbility:CreateRepeatEffect()
if self.CreateRepeatEffectOverride then
self:CreateRepeatEffectOverride()
else
orgCreateRepeatEffect( self )
end
end
local orgDestroyRepeatEffect = CommanderAbility.DestroyRepeatEffect
function CommanderAbility:DestroyRepeatEffect()
if self.DestroyRepeatEffectOverride then
self:DestroyRepeatEffectOverride()
else
orgDestroyRepeatEffect( self )
end
end
local function CommanderAbilityUpdate(self)
self:CreateRepeatEffect()
local abilityType = self:GetType()
// Instant types have already been performed in OnInitialized.
if abilityType ~= CommanderAbility.kType.Instant then
self:Perform()
end
local lifeSpanEnded = not self:GetLifeSpan() or (self:GetLifeSpan() + self.timeCreated) <= Shared.GetTime()
if Server and (
lifeSpanEnded or self:GetAbilityEndConditionsMet()
or abilityType == CommanderAbility.kType.OverTime
or abilityType == CommanderAbility.kType.Instant
) then
DestroyEntity(self)
elseif abilityType == CommanderAbility.kType.Repeat then
return true
end
return false
end
function CommanderAbility:OnInitialized() //OVERRIDES
ScriptActor.OnInitialized(self)
if Server then
self.timeCreated = Shared.GetTime()
end
if self.timeCreated + kDefaultUpdateTime > Shared.GetTime() then
self:CreateStartEffect()
end
self:CreateRepeatEffect()
local callbackRate = nil
if self:GetType() == CommanderAbility.kType.Repeat then
callbackRate = self:GetUpdateTime()
elseif self:GetType() == CommanderAbility.kType.OverTime then
callbackRate = self:GetLifeSpan()
elseif self:GetType() == CommanderAbility.kType.Instant then
self:Perform()
// give some time to ensure propagation of the entity
callbackRate = 0.1
end
if callbackRate then
if self.OverrideCallbackUpdateFunction then
self:AddTimedCallback( self.OverrideCallbackUpdateFunction, callbackRate )
else
self:AddTimedCallback( CommanderAbilityUpdate, callbackRate )
end
end
end
Class_Reload( "CommanderAbility", {} )
| gpl-3.0 |
payday-restoration/restoration-mod | lua/sc/units/equipment/sentrygunbase.lua | 1 | 6119 | SentryGunBase.DEPLOYEMENT_COST = { --Deploying a sentry eats up 40% of your *maximum* ammo.
0.4,
0.35,
0.3
}
SentryGunBase.MIN_DEPLOYEMENT_COST = 0.35
Hooks:PostHook(SentryGunBase, "post_init", "sentrybase_postinit_repairsentries", function(self)
self._is_repairing = false
end)
Hooks:PostHook(SentryGunBase, "update", "sentrybase_update_repairsentries", function(self,unit,t,dt)
if Network:is_server() then --only runs for host anyway
if self._unit:interaction() then
self._unit:interaction():set_dirty(true) --allows refreshing repair % progress for host
end
if self._removed then
return
elseif self._is_repairing then
if self._repair_done_t <= Application:time() then
self:finish_repairmode()
end
end
end
end)
function SentryGunBase:unregister()
if self._registered then
self._registered = nil
end
end
function SentryGunBase:register()
self._registered = true
end
function SentryGunBase:is_repairmode()
return self._is_repairing and true or false
end
function SentryGunBase:on_interaction(dead) --on interaction is the callback for both picking up and repairing sentries. interaction tweak data is set on death event/repair complete event.
--previously, player acquired 0 ammo from dead sentries. now, players must repair sentries before picking them up
if Network:is_server() then
if dead then
self:start_repairmode()
else
SentryGunBase.on_picked_up(self:get_type(), (dead and 0) or self._unit:weapon():ammo_ratio(), self._unit:id())
self:remove()
end
else
if dead then --send repair request to host; the interaction request itself is identical but i'll keep these separate just in case
managers.network:session():send_to_host("picked_up_sentry_gun",self._unit)
else --pick up sentry normally
managers.network:session():send_to_host("picked_up_sentry_gun", self._unit)
end
end
end
function SentryGunBase:start_repairmode() --initiate cosmetic repairs
-- self._unit:interaction():set_dirty(true) --does nothing atm
self._unit:contour():remove("deployable_active")
self._unit:contour():remove("deployable_interactable")
self._unit:contour():remove("deployable_selected")
self._unit:contour():remove("deployable_disabled")
if Network:is_server() then --send start repairmode to clients
managers.network:session():send_to_peers_synched("sync_player_movement_state",self._unit,"start_repair_eq_sentry",99.99,"420.024")
local char_damage = self._unit:character_damage()
self._sim_health_init = char_damage:dead() and 0 or char_damage._health
local hp_r = math.max(char_damage:health_ratio(),0.01)
char_damage:update_shield_smoke_level(hp_r,true)
end
if self:get_owner_id() == managers.network:session():local_peer():id() then
-- self._unit:interaction():set_active(false,false) -- normally would disable pickup/repair interaction completely, but i'm keeping it around to display repair progress
--self._unit:weapon():remove_fire_mode_interaction() --removes firemode toggle interaction, but re-enabling it as client is buggy since this thing here deletes the unit itself
self._unit:contour():add("highlight")
self._unit:contour():flash("highlight",tweak_data.equipments.sentry_gun.repair_blink_interval)
end
self:_start_repairmode()
end
function SentryGunBase:_start_repairmode() --initiate functional repairs
if not self._is_repairing then
self._is_repairing = true
self._unit:brain():switch_off()
local char_damage = self._unit:character_damage()
self._sim_health_init = char_damage:dead() and 0 or char_damage._health
local hp_r = math.max(char_damage:health_ratio(),0.01)
local repair_done_t = math.max(tweak_data.equipments.sentry_gun.repair_time_init * (1-hp_r),tweak_data.equipments.sentry_gun.repair_time_min)
self._repair_time_total = repair_done_t --only used for preview of repair progress
self._repair_done_t = Application:time() + repair_done_t
end
end
function SentryGunBase:finish_repairmode() --complete cosmetic repairs
if Network:is_server() then --send finish repairmode to clients
managers.network:session():send_to_peers_synched("sync_player_movement_state",self._unit,"finish_repair_eq_sentry",99.99,"420.024")
end
self._unit:contour():remove("deployable_disabled")
self._unit:contour():remove("highlight")
self._unit:contour():flash("highlight",false) --any arg2 that is not a positive float removes flash
if self:get_owner_id() == managers.network:session():local_peer():id() then
--local contour_standard = self._unit:contour():standard_contour_id()
--local contour_ap = self._unit:contour():ap_contour_id()
local prev_contour = self._unit:weapon()._use_armor_piercing and "deployable_interactable" or "deployable_active"
self._unit:contour():add(prev_contour)
end
self._unit:interaction():set_tweak_data("sentry_gun")
self._unit:interaction():set_dirty(true)
self:_finish_repairmode()
end
function SentryGunBase:_finish_repairmode() --complete functional repairs
self._unit:interaction():set_dirty(true)
local char_damage = self._unit:character_damage()
if char_damage._turret_destroyed_snd then --this doesn't stop the noise
char_damage._turret_destroyed_snd:stop()
char_damage._turret_destroyed_snd = nil
end
if self._equip_broken_snd_loop then --this doesn't stop the noise either >:(
self._equip_broken_snd_loop:stop()
self._equip_broken_snd_loop = nil
end
char_damage:update_shield_smoke_level(0)
char_damage._dead = false
self._is_repairing = false
self._repair_done_t = nil
self._sim_health_init = nil
if Network:is_server() then
local armor_amount = tweak_data.upgrades.sentry_gun_base_armor * self._armor_multiplier --todo multiply by modpart hp bonus
char_damage:set_health(armor_amount or self._HEALTH_INIT,0)
end
self._unit:movement():set_active(true)
self._unit:movement():switch_on()
self._unit:brain():switch_off() --ai permanently "forget" about the sentry without this stuff
self._unit:brain():switch_on()
self._unit:brain():set_active(true)
if self._place_snd_event then --new
self._unit:sound_source():post_event(self._place_snd_event)
end
end | agpl-3.0 |
luvit/luvit | tests/test-net-connect-handle-econnrefused.lua | 11 | 1147 | --[[
Copyright 2012-2015 The Luvit Authors. All Rights Reserved.
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.
--]]
local Tcp = require('uv').Tcp
local net = require('net')
local PORT = process.env.PORT or 10088
require('tap')(function(test)
test('net-connect-handle-econnerefuesed', function(expected)
local c, err = net.createConnection(PORT)
c:on('connect', function ()
print("error: connnected, please shutdown whatever is running on " .. PORT)
assert(false)
end)
c:on('error', function (err)
assert('ECONNREFUSED' == err or 'EADDRNOTAVAIL' == err)
expected = {gotError = true}
c:destroy()
end)
end)
end) | apache-2.0 |
heysion/prosody-modules | mod_auth_ccert/mod_auth_ccert.lua | 32 | 2651 | -- Copyright (C) 2013 Kim Alvefur
--
-- This file is MIT/X11 licensed.
local jid_compare = require "util.jid".compare;
local jid_split = require "util.jid".prepped_split;
local new_sasl = require "util.sasl".new;
local now = os.time;
local log = module._log;
local subject_alternative_name = "2.5.29.17";
local id_on_xmppAddr = "1.3.6.1.5.5.7.8.5";
local oid_emailAddress = "1.2.840.113549.1.9.1";
local cert_match = module:get_option("certificate_match", "xmppaddr");
local username_extractor = {};
function username_extractor.xmppaddr(cert, authz, session)
local extensions = cert:extensions();
local SANs = extensions[subject_alternative_name];
local xmppAddrs = SANs and SANs[id_on_xmppAddr];
if not xmppAddrs then
(session.log or log)("warn", "Client certificate contains no xmppAddrs");
return nil, false;
end
for i=1,#xmppAddrs do
if authz == "" or jid_compare(authz, xmppAddrs[i]) then
(session.log or log)("debug", "xmppAddrs[%d] %q matches authz %q", i, xmppAddrs[i], authz)
local username, host = jid_split(xmppAddrs[i]);
if host == module.host then
return username, true
end
end
end
end
function username_extractor.email(cert)
local subject = cert:subject();
for i=1,#subject do
local ava = subject[i];
if ava.oid == oid_emailAddress then
local username, host = jid_split(ava.value);
if host == module.host then
return username, true
end
end
end
end
local find_username = username_extractor[cert_match];
if not find_username then
module:log("error", "certificate_match = %q is not supported");
return
end
function get_sasl_handler(session)
return new_sasl(module.host, {
external = session.secure and function(authz)
if not session.secure then
-- getpeercertificate() on a TCP connection would be bad, abort!
(session.log or log)("error", "How did you manage to select EXTERNAL without TLS?");
return nil, false;
end
local sock = session.conn:socket();
local cert = sock:getpeercertificate();
if not cert then
(session.log or log)("warn", "No certificate provided");
return nil, false;
end
if not cert:validat(now()) then
(session.log or log)("warn", "Client certificate expired")
return nil, "expired";
end
local chain_valid, chain_errors = sock:getpeerverification();
if not chain_valid then
(session.log or log)("warn", "Invalid client certificate chain");
for i, error in ipairs(chain_errors) do
(session.log or log)("warn", "%d: %s", i, table.concat(error, ", "));
end
return nil, false;
end
return find_username(cert, authz, session);
end
});
end
module:provides "auth";
| mit |
payday-restoration/restoration-mod | lua/sc/managers/groupaistatebesiege.lua | 1 | 58641 | local math_min = math.min
local math_lerp = math.lerp
local math_map_range = math.map_range
local math_random = math.random
local table_insert = table.insert
local table_remove = table.remove
local mvec_add = mvector3.add
local mvec_cpy = mvector3.copy
local mvec_dis = mvector3.distance
local mvec_dis_sq = mvector3.distance_sq
local mvec_mul = mvector3.multiply
local mvec_set = mvector3.set
local mvec_set_l = mvector3.set_length
local mvec_set_z = mvector3.set_z
local mvec_sub = mvector3.subtract
local tmp_vec1 = Vector3()
local tmp_vec2 = Vector3()
local difficulty = Global.game_settings and Global.game_settings.difficulty or "normal"
local difficulty_index = tweak_data:difficulty_to_index(difficulty)
Hooks:PreHook(GroupAIStateBesiege, "_set_objective_to_enemy_group", "RR_set_objective_to_enemy_group", function(self, group, grp_objective)
if grp_objective.type == "recon_area" then -- new objective is recon_area
local target_area = grp_objective.target_area or grp_objective.area
grp_objective.chatter_type = target_area and (target_area.loot and "sabotagebags" or target_area.hostages and "sabotagehostages")
elseif group.objective.type == "assault_area" and grp_objective.type == "retire" then -- current objective is assault_area and new objective is retire
local _, group_leader_u_data = self._determine_group_leader(group.units)
if group_leader_u_data and group_leader_u_data.char_tweak.chatter.retreat then
self:chk_say_enemy_chatter(group_leader_u_data.unit, group_leader_u_data.m_pos, "retreat") -- declare our retreat if we were assaulting but now retiring
end
end
end)
function GroupAIStateBesiege:chk_has_civilian_hostages()
return self._hostage_headcount - self._police_hostage_headcount > 0
end
function GroupAIStateBesiege:chk_had_hostages()
return self._had_hostages
end
function GroupAIStateBesiege:chk_assault_active_atm()
local assault_task = self._task_data.assault
return assault_task and (assault_task.phase == "build" or assault_task.phase == "sustain")
end
function GroupAIStateBesiege:chk_heat_bonus_retreat()
local assault_task = self._task_data.assault
return assault_task and (assault_task.phase == "build" or assault_task.phase == "sustain") and self._activeassaultbreak
end
-- Assault/Rescue team going in lines
function GroupAIStateBesiege:_voice_groupentry(group, recon)
local group_leader_u_key, group_leader_u_data = self._determine_group_leader(group.units)
if group_leader_u_data and group_leader_u_data.char_tweak.chatter.entry then
self:chk_say_enemy_chatter(group_leader_u_data.unit, group_leader_u_data.m_pos, (recon and "hrt" or "cs") .. math_random(1, 4))
end
end
--Ensured PONR flag is set to nil.
Hooks:PostHook(GroupAIStateBesiege, "init", "ResInit", function(self, group_ai_state)
self._ponr_is_on = nil
--Sets functions that determine chatter for spawn group leaders to say upon spawning.
--self:_init_group_entry_lines()
--self:set_debug_draw_state(true) --Uncomment to debug AI stuff.
end)
-- Increase simultaneous spawn limit (this is just an upper bound, usually less enemies are spawned per group spawn update)
--GroupAIStateBesiege._MAX_SIMULTANEOUS_SPAWNS = 5
--Implements cooldowns and hard-diff filters for specific spawn groups, by prefiltering them before actually choosing the best groups.
local group_timestamps = {}
local _choose_best_groups_actual = GroupAIStateBesiege._choose_best_groups
function GroupAIStateBesiege:_choose_best_groups(best_groups, group, group_types, allowed_groups, weight, ...)
local new_allowed_groups = {} --Replacement table for _choose_best_groups_actual.
local currenttime = self._t
local sustain = self._task_data.assault and self._task_data.assault.phase == "sustain"
local constraints_tweak = self._tweak_data.group_constraints
--Check each spawn group and see if it meets filter.
for group_type, cat_weights in pairs(allowed_groups) do
--Get spawn group constraints.
local constraints = constraints_tweak[group_type]
local valid = true
--If group had constraints tied to it, then check for them.
if constraints then
local cooldown = constraints.cooldown
local previoustimestamp = group_timestamps[group_type]
if cooldown and previoustimestamp and (currenttime - previoustimestamp) < cooldown then
valid = nil
end
local min_diff = constraints.min_diff
local max_diff = constraints.max_diff
if (min_diff and self._difficulty_value <= min_diff) or (max_diff and self._difficulty_value >= max_diff) then
valid = nil
end
local sustain_only = constraints.sustain_only
if sustain_only and sustain == false then
valid = nil
end
end
--If all constraints are met, add it to the replacement table. Otherwise, ignore it.
if valid then
new_allowed_groups[group_type] = cat_weights
end
end
-- Call the original function with the replacement spawngroup table.
return _choose_best_groups_actual(self, best_groups, group, group_types, new_allowed_groups, weight, ...)
end
-- Cache for normal spawngroups to avoid losing them when they're overwritten.
-- Once a captain is spawned in, this gets reset back to nil.
local cached_spawn_groups = nil
-- Hard forces the next spawn group type by temporarily replacing the assault.groups table.
-- When the group is spawned, the assault.groups table is reverted to cached_spawn_groups.
-- Used by skirmish to force captain spawns.
function GroupAIStateBesiege:force_spawn_group_hard(spawn_group)
-- Ignore previous force attempt if ones overlap.
-- Might change to using a LIFO queue if we need support for multiple nearby calls at some point.
if cached_spawn_groups then
self._tweak_data.assault.groups = cached_spawn_groups
cached_spawn_groups = nil
end
--Create new forced spawngroup.
local new_spawn_groups = nil
if managers.skirmish:is_skirmish() then --Handle Skirmish's custom diff curve.
new_spawn_groups = { [spawn_group] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }
else
new_spawn_groups = { [spawn_group] = {1, 1, 1} }
end
--Cache old spawn groups, and apply new forced spawn group table.
cached_spawn_groups = self._tweak_data.assault.groups
self._tweak_data.assault.groups = new_spawn_groups
end
--Refactored from vanilla code to be a bit easier to read and debug. Also adds timestamp support.
local debug_spawn_groups = true
--Should stick these in a global table somewhere since I constantly paste them in for debugging purposes.
local function value_of(v, k, indent, seen)
indent = indent and indent .. " " or ""
seen = seen or {}
k = k or "[Unknown]"
local type = type(v)
if type == "table" then
log(indent .. tostring(k) .. " = {")
value_of_table(v, k, indent, seen)
log(indent .. "}")
elseif type == "userdata" then
local v_table = getmetatable(v) or {}
log(indent .. tostring(k) .. " = " .. tostring(v) .. " | type = " .. type .. " {")
value_of_table(v_table, k, indent, seen)
log(indent .. "}")
else
log(indent .. tostring(k) .. " = " .. tostring(v) .. " | type = " .. type)
end
end
local function value_of_table(t, name, indent, seen)
indent = indent and indent .. " " or ""
seen = seen or {}
name = name or "[Unknown]"
if seen[t] then
log(indent .. "REFERENCE TO " .. seen[t])
return
end
seen[t] = tostring(name)
for k, v in pairs(t) do
value_of(v, k, indent, seen)
end
end
function GroupAIStateBesiege:_spawn_in_group(spawn_group, spawn_group_type, grp_objective, ai_task)
local spawn_group_desc = tweak_data.group_ai.enemy_spawn_groups[spawn_group_type]
local wanted_nr_units = nil
local nr_units = 0
--Determine number of units to spawn.
if type(spawn_group_desc.amount) == "number" then
wanted_nr_units = spawn_group_desc.amount
else
wanted_nr_units = math.random(spawn_group_desc.amount[1], spawn_group_desc.amount[2])
end
local unit_types = spawn_group_desc.spawn --All units in spawn group.
local valid_unit_types = {} --All units in the spawn group that are able to spawn.
local remaining_special_pools = {} --Tracks remaining room in special spawn caps.
local unit_categories = tweak_data.group_ai.unit_categories
local total_wgt = 0 --Freqs of all valid unit types all added together.
--Determine which unit types in spawn group are valid. Delay spawns if required units are above cap.
for i = 1, #unit_types do
local spawn_entry = unit_types[i]
if not spawn_entry.unit then
log("ERROR IN GROUP: " .. spawn_group_type .. " no unit defined in index " .. tostring(i))
return
end
if not spawn_entry.freq then
log("ERROR IN GROUP: " .. spawn_group_type .. " no freq defined for unit " .. spawn_entry.unit)
return
end
if spawn_entry.amount_min and spawn_entry.amount_max and spawn_entry.amount_min > spawn_entry.amount_max then
log("WARNING IN GROUP: " .. spawn_group_type .. " amount_max is smaller than amount_min for " .. spawn_entry.unit)
end
local cat_data = unit_categories[spawn_entry.unit]
if not cat_data then
log("ERROR IN GROUP: " .. spawn_group_type .. " contains fictional made up imaginary good-for-nothing unit " .. spawn_entry.unit)
return
end
if cat_data.special_type then --Determine if special unit is valid, or if spawning needs to be delayed.
--Units marked with "ignore_spawn_cap" get an effectively uncapped special pool.
remaining_special_pools[cat_data.special_type] = cat_data.ignore_spawn_cap and 100 or managers.job:current_spawn_limit(cat_data.special_type) - self:_get_special_unit_type_count(cat_data.special_type)
if remaining_special_pools[cat_data.special_type] < (spawn_entry.amount_min or 0) then --If essential spawn would go above cap, then delay spawn group and return.
spawn_group.delay_t = self._t + 10
return
end
if remaining_special_pools[cat_data.special_type] > 0 then --If special unit doesn't go above cap, then add to valid table.
table.insert(valid_unit_types, spawn_entry)
total_wgt = total_wgt + spawn_entry.freq
end
else --Unit not special, add it to valid table.
table.insert(valid_unit_types, spawn_entry)
total_wgt = total_wgt + spawn_entry.freq
end
end
local spawn_task = {
objective = not grp_objective.element and self._create_objective_from_group_objective(grp_objective),
units_remaining = {},
spawn_group = spawn_group,
spawn_group_type = spawn_group_type,
ai_task = ai_task
}
table.insert(self._spawning_groups, spawn_task)
--Adds as many as needed to meet requirements. Removes any valid units it turns invalid.
local function _add_unit_type_to_spawn_task(i, spawn_entry)
local unit_invalidated = false
local prev_amount = nil --Previous number of these guys in the spawn task.
local new_amount = nil --New number of these guys in the spawn task.
if not spawn_task.units_remaining[spawn_entry.unit] then --If unit isn't part of spawn task yet, add the minimum amount to start.
prev_amount = 0
new_amount = spawn_entry.amount_min or 1
else --Otherwise just add 1.
prev_amount = spawn_task.units_remaining[spawn_entry.unit].amount
new_amount = 1 + prev_amount
end
local amount_increase = new_amount - prev_amount --Amount the number of this unit would increase.
if spawn_entry.amount_max and new_amount >= spawn_entry.amount_max then --Max unit count reached, removing unit from valid units for future spawns.
table.remove(valid_unit_types, i)
total_wgt = total_wgt - spawn_entry.freq
unit_invalidated = true
end
--Update special unit spawn caps.
local cat_data = unit_categories[spawn_entry.unit]
if cat_data.special_type then
if remaining_special_pools[cat_data.special_type] >= amount_increase then
remaining_special_pools[cat_data.special_type] = remaining_special_pools[cat_data.special_type] - amount_increase
if remaining_special_pools[cat_data.special_type] == 0 and not unit_invalidated then --Special spawn cap reached, removing unit from valid units for future spawns.
table.remove(valid_unit_types, i)
total_wgt = total_wgt - spawn_entry.freq
unit_invalidated = true
end
end
end
--Add unit to spawn task.
spawn_task.units_remaining[spawn_entry.unit] = {
amount = new_amount,
spawn_entry = spawn_entry
}
nr_units = nr_units + amount_increase
return unit_invalidated
end
--Add required units to spawn group.
local i = 1
local req_entry = valid_unit_types[i]
while req_entry do --Array size changes, so iteration finishes when the current entry is nil.
if wanted_nr_units > nr_units and req_entry.amount_min and req_entry.amount_min > 0 then
if _add_unit_type_to_spawn_task(i, req_entry) then --Don't increment to next value if a unit was invalidated.
i = i + 1
end
else
i = i + 1
end
req_entry = valid_unit_types[i]
end
--Spawn random units.
while wanted_nr_units > nr_units and total_wgt > 0 do
local rand_wgt = math.random() * total_wgt
local rand_i = 1
local rand_entry = valid_unit_types[rand_i]
--Loop until the unit corresponding to rand_wgt is found.
while true do
rand_wgt = rand_wgt - rand_entry.freq
if rand_wgt <= 0 then
break --Random unit entry found!
else
rand_i = rand_i + 1 --Move onto next unit entry.
if not valid_unit_types[rand_i] then
log("spawn_in_group attempted to spawn in an invalid unit!")
log("rand_i: " .. tostring(rand_i))
log("rand_wgt: " .. tostring(rand_wgt))
log("total_wgt: " .. tostring(total_wgt))
value_of_table(valid_unit_types, "valid_unit_types")
managers.chat:send_message(ChatManager.GAME, "", "A REALLY RARE BUG HAS OCCURED.")
managers.chat:send_message(ChatManager.GAME, "", "SEND RAVICALE#7594 YOUR MOD LOG FILE ON DISCORD.")
break
end
rand_entry = valid_unit_types[rand_i]
end
end
_add_unit_type_to_spawn_task(rand_i, rand_entry) --Add our random boi.
end
--Create group object and finalize.
local group_desc = {
size = nr_units,
type = spawn_group_type
}
local group = self:_create_group(group_desc)
group.objective = grp_objective
group.objective.moving_out = true
group.team = self._teams[spawn_group.team_id or tweak_data.levels:get_default_team_ID("combatant")]
spawn_task.group = group
group_timestamps[spawn_group_type] = self._t --Set timestamp for whatever spawngroup was just spawned in to allow for cooldown tracking.
if debug_spawn_groups then
log("Spawning group: " .. spawn_group_type)
for name, spawn_info in pairs(spawn_task.units_remaining) do
log(" " .. name .. "x" .. tostring(spawn_info.amount))
end
end
return group
end
-- Make hostage count affect hesitation delay
local _begin_assault_task_original = GroupAIStateBesiege._begin_assault_task
function GroupAIStateBesiege:_begin_assault_task(...)
self._task_data.assault.was_first = self._task_data.assault.is_first
_begin_assault_task_original(self, ...)
self._task_data.assault.force = math.ceil(self:_get_difficulty_dependent_value(self._tweak_data.assault.force) * self:_get_balancing_multiplier(self._tweak_data.assault.force_balance_mul) * restoration.global_spawn_multiplier)
if self._hostage_headcount > 0 then
local assault_task = self._task_data.assault
local anticipation_duration = self:_get_anticipation_duration(self._tweak_data.assault.anticipation_duration, assault_task.was_first)
local hesitation_delay = self:_get_difficulty_dependent_value(self._tweak_data.assault.hostage_hesitation_delay)
local hostage_multiplier = math.clamp(self._hostage_headcount, 1, 4)
assault_task.phase_end_t = self._t + anticipation_duration + hesitation_delay * hostage_multiplier
assault_task.is_hesitating = true
assault_task.voice_delay = self._t + (assault_task.phase_end_t - self._t) / 2
self:_post_megaphone_event("mga_hostage_assault_delay")
end
end
-- Fix reenforce group delay
local _begin_reenforce_task_original = GroupAIStateBesiege._begin_reenforce_task
function GroupAIStateBesiege:_begin_reenforce_task(...)
local next_dispatch_t = self._task_data.reenforce.next_dispatch_t or 0
_begin_reenforce_task_original(self, ...)
self._task_data.reenforce.next_dispatch_t = next_dispatch_t
end
-- Improve ending condition for assault fade
-- The hardcoded amount of minimum enemies left was way too high and would lead to fade being instantly over after its minimum duration
function GroupAIStateBesiege:_upd_assault_task()
local task_data = self._task_data.assault
if not task_data.active then
return
end
local t = self._t
self:_assign_recon_groups_to_retire()
local force_pool = self:_get_difficulty_dependent_value(self._tweak_data.assault.force_pool) * self:_get_balancing_multiplier(self._tweak_data.assault.force_pool_balance_mul) * restoration.global_spawn_multiplier
local task_spawn_allowance = force_pool - (self._hunt_mode and 0 or task_data.force_spawned)
if task_data.phase == "anticipation" then
if task_spawn_allowance <= 0 then
print("spawn_pool empty: -----------FADE-------------")
task_data.phase = "fade"
task_data.phase_end_t = t + self._tweak_data.assault.fade_duration
--Stops drama from skipping anticipation
elseif task_data.phase_end_t < t then
self._assault_number = self._assault_number + 1
self:_post_megaphone_event("mga_generic_c")
managers.mission:call_global_event("start_assault")
managers.hud:start_assault(self._assault_number)
managers.groupai:dispatch_event("start_assault", self._assault_number)
self:_set_rescue_state(false)
task_data.phase = "build"
task_data.phase_end_t = self._t + self._tweak_data.assault.build_duration
task_data.is_hesitating = nil
self:set_assault_mode(true)
managers.trade:set_trade_countdown(false)
else
managers.hud:check_anticipation_voice(task_data.phase_end_t - t)
managers.hud:check_start_anticipation_music(task_data.phase_end_t - t)
if task_data.is_hesitating and task_data.voice_delay < self._t then
if self._hostage_headcount > 0 then
local best_group = nil
for _, group in pairs(self._groups) do
if not best_group or group.objective.type == "reenforce_area" then
best_group = group
elseif best_group.objective.type ~= "reenforce_area" and group.objective.type ~= "retire" then
best_group = group
end
end
if best_group and self:_voice_delay_assault(best_group) then
task_data.is_hesitating = nil
end
else
task_data.is_hesitating = nil
end
end
end
elseif task_data.phase == "build" then
if task_spawn_allowance <= 0 then
task_data.phase = "fade"
task_data.phase_end_t = t + self._tweak_data.assault.fade_duration
elseif task_data.phase_end_t < t or self._drama_data.zone == "high" then
local sustain_duration = math.lerp(self:_get_difficulty_dependent_value(self._tweak_data.assault.sustain_duration_min), self:_get_difficulty_dependent_value(self._tweak_data.assault.sustain_duration_max), math.random()) * self:_get_balancing_multiplier(self._tweak_data.assault.sustain_duration_balance_mul)
managers.modifiers:run_func("OnEnterSustainPhase", sustain_duration)
task_data.phase = "sustain"
task_data.phase_end_t = t + sustain_duration
end
elseif task_data.phase == "sustain" then
local end_t = self:assault_phase_end_time()
task_spawn_allowance = managers.modifiers:modify_value("GroupAIStateBesiege:SustainSpawnAllowance", task_spawn_allowance, force_pool)
if task_spawn_allowance <= 0 then
task_data.phase = "fade"
task_data.phase_end_t = t + self._tweak_data.assault.fade_duration
elseif end_t < t and not self._hunt_mode then
task_data.phase = "fade"
task_data.phase_end_t = t + self._tweak_data.assault.fade_duration
end
else
local end_assault
local is_skirmish = managers.skirmish:is_skirmish()
local enemies_defeated_time_limit = is_skirmish and 0 or self._tweak_data.assault.fade_settings.enemies_defeated_time_limit or 30
local drama_engagement_time_limit = is_skirmish and 0 or self._tweak_data.assault.fade_settings.drama_engagement_time_limit or 30
local enemies_left = self:_count_police_force("assault")
local min_enemies_left = task_data.force * (self._tweak_data.assault.fade_settings.enemies_defeated_percentage or 0.5)
local enemies_defeated = enemies_left < min_enemies_left or self._t > task_data.phase_end_t + enemies_defeated_time_limit
if enemies_defeated then
if not task_data.said_retreat then
task_data.said_retreat = true
self:_police_announce_retreat()
self:_post_megaphone_event("mga_robbers_clever")
elseif task_data.phase_end_t < self._t then
local drama_pass = self._drama_data.amount < tweak_data.drama.assault_fade_end
local engagement_pass = self:_count_criminals_engaged_force(11) <= 10
local taking_too_long = self._t > task_data.phase_end_t + drama_engagement_time_limit
end_assault = drama_pass and engagement_pass or taking_too_long
end
end
if task_data.force_end or end_assault then
task_data.active = nil
task_data.phase = nil
task_data.said_retreat = nil
task_data.force_end = nil
local force_regroup = task_data.force_regroup
task_data.force_regroup = nil
self:_post_megaphone_event("mga_leave")
if self._draw_drama then
self._draw_drama.assault_hist[#self._draw_drama.assault_hist][2] = self._t
end
managers.mission:call_global_event("end_assault")
self:_begin_regroup_task(force_regroup)
self:set_difficulty(nil, 0.3)
return
end
end
if self._drama_data.amount <= tweak_data.drama.low then
for criminal_key, criminal_data in pairs(self._player_criminals) do
self:criminal_spotted(criminal_data.unit)
for _, group in pairs(self._groups) do
if group.objective.charge then
for _, u_data in pairs(group.units) do
u_data.unit:brain():clbk_group_member_attention_identified(nil, criminal_key)
end
end
end
end
end
local primary_target_area = task_data.target_areas[1]
if self:is_area_safe_assault(primary_target_area) then
local target_pos = primary_target_area.pos
local nearest_area, nearest_dis
for _, criminal_data in pairs(self._player_criminals) do
if not criminal_data.status then
local dis = mvec_dis_sq(target_pos, criminal_data.m_pos)
if not nearest_dis or dis < nearest_dis then
nearest_dis = dis
nearest_area = self:get_area_from_nav_seg_id(criminal_data.tracker:nav_segment())
end
end
end
if nearest_area then
primary_target_area = nearest_area
task_data.target_areas[1] = nearest_area
end
end
local nr_wanted = task_data.force - self:_count_police_force("assault")
if task_data.phase == "anticipation" then
nr_wanted = nr_wanted - 5
end
if nr_wanted > 0 and task_data.phase ~= "fade" then
local used_event = nil
if task_data.use_spawn_event and task_data.phase ~= "anticipation" then
task_data.use_spawn_event = false
if self:_try_use_task_spawn_event(t, primary_target_area, "assault") then
used_event = true
end
end
if not used_event then
if next(self._spawning_groups) then
-- Nothing
else
if not managers.skirmish:is_skirmish() then
self:_check_spawn_timed_groups(primary_target_area, task_data)
end
local spawn_group, spawn_group_type = self:_find_spawn_group_near_area(primary_target_area, self._tweak_data.assault.groups, nil, nil, nil)
if spawn_group then
local grp_objective = {
attitude = "avoid",
stance = "hos",
pose = "crouch",
type = "assault_area",
area = spawn_group.area,
coarse_path = {
{
spawn_group.area.pos_nav_seg,
spawn_group.area.pos
}
}
}
self:_spawn_in_group(spawn_group, spawn_group_type, grp_objective, task_data)
end
end
end
end
if task_data.use_smoke_timer < self._t then
task_data.use_smoke = true
end
self:detonate_queued_smoke_grenades()
self:_assign_enemy_groups_to_assault(task_data.phase)
end
-- Add an alternate in_place check to prevent enemy groups from getting stuck
function GroupAIStateBesiege:_assign_enemy_groups_to_assault(phase)
for _, group in pairs(self._groups) do
if group.has_spawned and group.objective.type == "assault_area" then
if group.objective.moving_out then
local done_moving
for _, u_data in pairs(group.units) do
local objective = u_data.unit:brain():objective()
if objective and objective.grp_objective == group.objective then
if objective.in_place or objective.area and objective.area.nav_segs[u_data.unit:movement():nav_tracker():nav_segment()] then
done_moving = true
else
done_moving = false
break
end
end
end
if done_moving then
group.objective.moving_out = nil
group.in_place_t = self._t
group.objective.moving_in = nil
self:_voice_move_complete(group)
end
end
if not group.objective.moving_in then
self:_set_assault_objective_to_group(group, phase)
end
end
end
end
-- Improve and heavily simplify objective assignment code, fix pull back and open fire objectives
-- Basically, a lot of this function was needlessly complex and had oversights or incorrect conditions
Hooks:OverrideFunction(GroupAIStateBesiege, "_set_assault_objective_to_group", function (self, group, phase)
local phase_is_anticipation = phase == "anticipation"
local current_objective = group.objective
local approach, open_fire, pull_back, charge
local obstructed_area = self:_chk_group_areas_tresspassed(group)
local group_leader_u_key, group_leader_u_data = self._determine_group_leader(group.units)
local in_place_duration = group.in_place_t and self._t - group.in_place_t or 0
local tactics_map = {}
if group_leader_u_data and group_leader_u_data.tactics then
for _, tactic_name in ipairs(group_leader_u_data.tactics) do
tactics_map[tactic_name] = true
end
if current_objective.tactic and not tactics_map[current_objective.tactic] then
current_objective.tactic = nil
end
for i_tactic, tactic_name in ipairs(group_leader_u_data.tactics) do
if tactic_name == "deathguard" and not phase_is_anticipation then
if current_objective.tactic == tactic_name then
for u_key, u_data in pairs(self._char_criminals) do
if u_data.status and current_objective.follow_unit == u_data.unit then
if current_objective.area.nav_segs[u_data.tracker:nav_segment()] then
return
end
end
end
end
local closest_crim_u_data, closest_crim_dis_sq
for u_key, u_data in pairs(self._char_criminals) do
if u_data.status then
local closest_u_id, closest_u_data, closest_u_dis_sq = self._get_closest_group_unit_to_pos(u_data.m_pos, group.units)
if closest_u_dis_sq and (not closest_crim_dis_sq or closest_u_dis_sq < closest_crim_dis_sq) then
closest_crim_u_data = u_data
closest_crim_dis_sq = closest_u_dis_sq
end
end
end
if closest_crim_u_data then
local coarse_path = managers.navigation:search_coarse({
id = "GroupAI_deathguard",
from_tracker = group_leader_u_data.unit:movement():nav_tracker(),
to_tracker = closest_crim_u_data.tracker,
access_pos = self._get_group_acces_mask(group)
})
if coarse_path then
local grp_objective = {
distance = 800,
type = "assault_area",
attitude = "engage",
tactic = "deathguard",
moving_in = true,
follow_unit = closest_crim_u_data.unit,
area = self:get_area_from_nav_seg_id(coarse_path[#coarse_path][1]),
coarse_path = coarse_path
}
group.is_chasing = true
self:_set_objective_to_enemy_group(group, grp_objective)
self:_voice_deathguard_start(group)
return
end
end
elseif tactic_name == "charge" and not current_objective.moving_out then
charge = true
end
end
end
local objective_area = current_objective.area
if obstructed_area then
if phase_is_anticipation then
-- If we run into enemies during anticipation, pull back
pull_back = true
elseif current_objective.moving_out then
-- If we run into enemies while moving out, open fire
if not current_objective.open_fire then
open_fire = true
objective_area = obstructed_area
end
elseif not current_objective.pushed or charge and not current_objective.charge then
-- If we've been in position for a while or haven't seen enemies, approach
approach = not self:_can_group_see_target(group)
end
elseif not current_objective.moving_out then
-- If we aren't moving out to an objective, open fire if we have ranged_fire tactics and see an enemy, otherwise approach
approach = charge or group.is_chasing or not tactics_map.ranged_fire or not self:_can_group_see_target(group)
open_fire = not approach and not current_objective.open_fire
elseif tactics_map.ranged_fire and not current_objective.open_fire and self:_can_group_see_target(group, true) then
-- If we see an enemy while moving out and have the ranged_fire tactics, open fire
local forwardmost_i_nav_point = self:_get_group_forwardmost_coarse_path_index(group)
if forwardmost_i_nav_point then
open_fire = true
objective_area = self:get_area_from_nav_seg_id(current_objective.coarse_path[forwardmost_i_nav_point][1])
end
end
if open_fire then
local grp_objective = {
attitude = "engage",
pose = "stand",
type = "assault_area",
stance = "hos",
open_fire = true,
tactic = current_objective.tactic,
area = objective_area,
coarse_path = {
{
objective_area.pos_nav_seg,
mvector3.copy(objective_area.pos)
}
}
}
self:_set_objective_to_enemy_group(group, grp_objective)
self:_voice_open_fire_start(group)
elseif approach then
local assault_area, alternate_assault_area, alternate_assault_area_from, assault_path, alternate_assault_path
local to_search_areas = {
objective_area
}
local found_areas = {
[objective_area] = objective_area
}
local group_access_mask = self._get_group_acces_mask(group)
repeat
local search_area = table_remove(to_search_areas, 1)
if next(search_area.criminal.units) then
local assault_from_here = true
if tactics_map.flank then
local assault_from_area = found_areas[search_area]
if assault_from_area ~= objective_area then
assault_from_here = false
if not alternate_assault_area or math_random() < 0.5 then
local new_alternate_assault_path = managers.navigation:search_coarse({
id = "GroupAI_assault",
from_seg = current_objective.area.pos_nav_seg,
to_seg = search_area.pos_nav_seg,
access_pos = group_access_mask,
verify_clbk = callback(self, self, "is_nav_seg_safe")
})
if new_alternate_assault_path then
self:_merge_coarse_path_by_area(new_alternate_assault_path)
alternate_assault_path = new_alternate_assault_path
alternate_assault_area = search_area
alternate_assault_area_from = assault_from_area
end
end
found_areas[search_area] = nil
end
end
if assault_from_here then
assault_path = managers.navigation:search_coarse({
id = "GroupAI_assault",
from_seg = current_objective.area.pos_nav_seg,
to_seg = search_area.pos_nav_seg,
access_pos = group_access_mask,
verify_clbk = callback(self, self, "is_nav_seg_safe")
})
if assault_path then
self:_merge_coarse_path_by_area(assault_path)
assault_area = search_area
break
end
end
else
for _, other_area in pairs(search_area.neighbours) do
if not found_areas[other_area] then
table_insert(to_search_areas, other_area)
found_areas[other_area] = search_area
end
end
end
until #to_search_areas == 0
if alternate_assault_area then
assault_area = alternate_assault_area
found_areas[assault_area] = alternate_assault_area_from
assault_path = alternate_assault_path
end
if assault_area and assault_path then
local push = found_areas[assault_area] == objective_area
local used_grenade
if push then
local detonate_pos
local c_key = charge and table.random_key(assault_area.criminal.units)
if c_key then
detonate_pos = assault_area.criminal.units[c_key].unit:movement():m_pos()
end
-- Check which grenade to use to push, grenade use is required for the push to be initiated
-- If grenade isn't available, push regardless anyway after a short delay
used_grenade = self:_chk_group_use_grenade(assault_area, group, detonate_pos) or group.ignore_grenade_check_t and group.ignore_grenade_check_t <= self._t
if used_grenade then
self:_voice_move_in_start(group)
elseif not group.ignore_grenade_check_t then
group.ignore_grenade_check_t = self._t + tweak_data.group_ai.ignore_grenade_time / math.max(1, table.size(assault_area.criminal.units))
end
else
-- If we aren't pushing, we go to one area before the criminal area
assault_area = found_areas[assault_area]
if #assault_path > 2 and assault_area.nav_segs[assault_path[#assault_path - 1][1]] then
table_remove(assault_path)
end
end
if not push or used_grenade then
local grp_objective = {
type = "assault_area",
stance = "hos",
area = assault_area,
coarse_path = assault_path,
pose = push and "crouch" or "stand",
attitude = push and "engage" or "avoid",
moving_in = push,
open_fire = push,
pushed = push,
charge = charge,
interrupt_dis = charge and 0
}
group.is_chasing = group.is_chasing or push
self:_set_objective_to_enemy_group(group, grp_objective)
end
elseif in_place_duration > 15 and not self:_can_group_see_target(group) then
-- Log and remove groups that get stuck
local element_id = group.spawn_group_element and group.spawn_group_element._id or 0
local element_name = group.spawn_group_element and group.spawn_group_element._editor_name or ""
for _, u_data in pairs(group.units) do
u_data.unit:brain():set_active(false)
u_data.unit:set_slot(0)
end
end
elseif pull_back then
local retreat_area
for _, u_data in pairs(group.units) do
local nav_seg_id = u_data.tracker:nav_segment()
if self:is_nav_seg_safe(nav_seg_id) then
retreat_area = self:get_area_from_nav_seg_id(nav_seg_id)
break
end
end
if not retreat_area and current_objective.coarse_path then
local forwardmost_i_nav_point = self:_get_group_forwardmost_coarse_path_index(group)
if forwardmost_i_nav_point then
-- Try retreating to the previous coarse path nav point
local nav_point = current_objective.coarse_path[forwardmost_i_nav_point - 1] or current_objective.coarse_path[forwardmost_i_nav_point]
retreat_area = self:get_area_from_nav_seg_id(nav_point[1])
end
end
if retreat_area then
local new_grp_objective = {
attitude = "avoid",
stance = "hos",
pose = "crouch",
type = "assault_area",
area = retreat_area,
coarse_path = {
{
retreat_area.pos_nav_seg,
mvector3.copy(retreat_area.pos)
}
}
}
group.is_chasing = nil
self:_set_objective_to_enemy_group(group, new_grp_objective)
end
end
end)
-- Helper to check if any group member has visuals on their focus target
function GroupAIStateBesiege:_can_group_see_target(group, limit_range)
local logic_data, focus_enemy
for _, u_data in pairs(group.units) do
logic_data = u_data.unit:brain()._logic_data
focus_enemy = logic_data and logic_data.attention_obj
if focus_enemy and focus_enemy.reaction >= AIAttentionObject.REACT_AIM and focus_enemy.verified then
if not limit_range or focus_enemy.verified_dis < (logic_data.internal_data.weapon_range and logic_data.internal_data.weapon_range.far or 3000) then
return true
end
end
end
end
function GroupAIStateBesiege:_chk_group_use_smoke_grenade(group, task_data, detonate_pos)
if task_data.use_smoke and not self:is_smoke_grenade_active() then
local shooter_pos, shooter_u_data = nil
local duration = tweak_data.group_ai.smoke_grenade_lifetime
for u_key, u_data in pairs(group.units) do
if u_data.tactics_map and u_data.tactics_map.smoke_grenade then
if not detonate_pos then
local nav_seg_id = u_data.tracker:nav_segment()
local nav_seg = managers.navigation._nav_segments[nav_seg_id]
if u_data.group and u_data.group.objective and u_data.group.objective.area and u_data.group.objective.type == "assault_area" or u_data.group and u_data.group.objective and u_data.group.objective.area and u_data.group.objective.type == "retire" then
detonate_pos = mvector3.copy(u_data.group.objective.area.pos)
else
for neighbour_nav_seg_id, door_list in pairs(nav_seg.neighbours) do
if self._current_target_area and self._current_target_area.nav_segs[neighbour_nav_seg_id] then
local random_door_id = door_list[math.random(#door_list)]
if type(random_door_id) == "number" then
detonate_pos = managers.navigation._room_doors[random_door_id].center
else
detonate_pos = random_door_id:script_data().element:nav_link_end_pos()
end
break
end
end
end
end
if detonate_pos and shooter_u_data then
self:detonate_smoke_grenade(detonate_pos, shooter_pos, duration, false)
self:apply_grenade_cooldown()
u_data.unit:sound():say("d01", true)
--Plays grenade throwing animation.
u_data.unit:movement():play_redirect("throw_grenade")
return true
end
end
end
end
end
function GroupAIStateBesiege:_chk_group_use_flash_grenade(group, task_data, detonate_pos)
if task_data.use_smoke and not self:is_smoke_grenade_active() then
local shooter_pos, shooter_u_data = nil
local duration = tweak_data.group_ai.flash_grenade_lifetime
for u_key, u_data in pairs(group.units) do
if u_data.tactics_map and u_data.tactics_map.flash_grenade then
if not detonate_pos then
local nav_seg_id = u_data.tracker:nav_segment()
local nav_seg = managers.navigation._nav_segments[nav_seg_id]
if u_data.group and u_data.group.objective and u_data.group.objective.area and u_data.group.objective.type == "assault_area" then
detonate_pos = mvector3.copy(u_data.group.objective.area.pos)
else
for neighbour_nav_seg_id, door_list in pairs(nav_seg.neighbours) do
if self._current_target_area and self._current_target_area.nav_segs[neighbour_nav_seg_id] then
local random_door_id = door_list[math.random(#door_list)]
if type(random_door_id) == "number" then
detonate_pos = managers.navigation._room_doors[random_door_id].center
else
detonate_pos = random_door_id:script_data().element:nav_link_end_pos()
end
break
end
end
end
end
if detonate_pos and shooter_u_data then
self:detonate_smoke_grenade(detonate_pos, shooter_pos, duration, true)
self:apply_grenade_cooldown(true)
u_data.unit:sound():say("d02", true)
u_data.unit:movement():play_redirect("throw_grenade")
return true
end
end
end
end
end
-- Add custom grenade usage function
function GroupAIStateBesiege:_chk_group_use_grenade(assault_area, group, detonate_pos)
local task_data = self._task_data.assault
if not task_data.use_smoke then
return
end
local grenade_types = {
smoke_grenade = (not task_data.smoke_grenade_next_t or task_data.smoke_grenade_next_t < self._t) or nil,
flash_grenade = (not task_data.flash_grenade_next_t or task_data.flash_grenade_next_t < self._t) or nil
}
local grenade_candidates = {}
for grenade_type, _ in pairs(grenade_types) do
for _, u_data in pairs(group.units) do
if u_data.tactics_map and u_data.tactics_map[grenade_type] then
table.insert(grenade_candidates, { grenade_type, u_data })
end
end
end
if #grenade_candidates == 0 then
return
end
local candidate = table.random(grenade_candidates)
local grenade_type = candidate[1]
local grenade_user = candidate[2]
local detonate_offset, detonate_offset_pos = tmp_vec1, tmp_vec2
if detonate_pos then
mvec_set(detonate_offset, grenade_user.m_pos)
mvec_sub(detonate_offset, detonate_pos)
else
local nav_seg = managers.navigation._nav_segments[grenade_user.tracker:nav_segment()]
for neighbour_nav_seg_id, door_list in pairs(nav_seg.neighbours) do
local area = self:get_area_from_nav_seg_id(neighbour_nav_seg_id)
if task_data.target_areas[1].nav_segs[neighbour_nav_seg_id] or next(area.criminal.units) then
local random_door_id = door_list[math_random(#door_list)]
if type(random_door_id) == "number" then
detonate_pos = managers.navigation._room_doors[random_door_id].center
else
detonate_pos = random_door_id:script_data().element:nav_link_end_pos()
end
break
end
end
if not detonate_pos then
return
end
mvec_set(detonate_offset, assault_area.pos)
mvec_sub(detonate_offset, detonate_pos)
end
local ray_mask = managers.slot:get_mask("world_geometry")
-- If players camp a specific area for too long, turn a smoke grenade into a teargas grenade instead
local use_teargas
local can_use_teargas = grenade_user and grenade_user.char_tweak and grenade_user.char_tweak.use_gas and grenade_type == "smoke_grenade" and area and area.criminal_entered_t and table.size(area.neighbours) <= 2
if can_use_teargas and math_random() < (self._t - assault_area.criminal_entered_t - 60) / 180 then
mvec_set(detonate_offset_pos, math.UP)
mvec_mul(detonate_offset_pos, 1000)
mvec_add(detonate_offset_pos, assault_area.pos)
if World:raycast("ray", assault_area.pos, detonate_offset_pos, "slot_mask", ray_mask, "report") then
mvec_set(detonate_offset_pos, assault_area.pos)
mvec_set_z(detonate_offset_pos, detonate_offset_pos.z + 100)
use_teargas = true
end
end
if not use_teargas then
-- Offset grenade a bit to avoid spawning exactly on the player/door
mvec_set_z(detonate_offset, math.max(detonate_offset.z, 0))
mvec_set_l(detonate_offset, math_random(100, 300))
mvec_set(detonate_offset_pos, detonate_pos)
mvec_add(detonate_offset_pos, detonate_offset)
local ray = World:raycast("ray", detonate_pos, detonate_offset_pos, "slot_mask", ray_mask)
if ray then
mvec_set_l(detonate_offset, math.max(0, ray.distance - 50))
mvec_set(detonate_offset_pos, detonate_pos)
mvec_add(detonate_offset_pos, detonate_offset)
end
end
-- Raycast down to place grenade on ground
mvec_set(detonate_offset, math.DOWN)
mvec_mul(detonate_offset, 1000)
mvec_add(detonate_offset, detonate_offset_pos)
local ground_ray = World:raycast("ray", detonate_offset_pos, detonate_offset, "slot_mask", ray_mask)
detonate_pos = ground_ray and ground_ray.hit_position or detonate_offset_pos
local timeout
if use_teargas then
assault_area.criminal_entered_t = nil
self:detonate_cs_grenade(detonate_pos, mvec_cpy(grenade_user.m_pos), tweak_data.group_ai.cs_grenade_lifetime or 10)
timeout = tweak_data.group_ai.cs_grenade_timeout or tweak_data.group_ai.smoke_and_flash_grenade_timeout
else
if grenade_type == "flash_grenade" and grenade_user.char_tweak.chatter.flash_grenade then
self:chk_say_enemy_chatter(grenade_user.unit, grenade_user.m_pos, "flash_grenade")
elseif grenade_type == "smoke_grenade" and grenade_user.char_tweak.chatter.smoke then
self:chk_say_enemy_chatter(grenade_user.unit, grenade_user.m_pos, "smoke")
end
self:detonate_smoke_grenade(detonate_pos, mvec_cpy(grenade_user.m_pos), tweak_data.group_ai[grenade_type .. "_lifetime"] or 10, grenade_type == "flash_grenade")
timeout = tweak_data.group_ai[grenade_type .. "_timeout"] or tweak_data.group_ai.smoke_and_flash_grenade_timeout
end
task_data.use_smoke = false
-- Minimum grenade cooldown
task_data.use_smoke_timer = self._t + 10
-- Individual grenade cooldowns
task_data[grenade_type .. "_next_t"] = self._t + math_lerp(timeout[1], timeout[2], math_random())
return true
end
-- Keep recon groups around during anticipation
-- Making them retreat only afterwards gives them more time to complete their objectives
local _assign_recon_groups_to_retire_original = GroupAIStateBesiege._assign_recon_groups_to_retire
function GroupAIStateBesiege:_assign_recon_groups_to_retire(...)
if self._task_data.assault.phase == "anticipation" then
return
end
return _assign_recon_groups_to_retire_original(self, ...)
end
-- Tweak importance of spawn group distance in spawn group weight based on the groups to spawn
-- Also slightly optimized this function to properly check all areas
function GroupAIStateBesiege:_find_spawn_group_near_area(target_area, allowed_groups, target_pos, max_dis, verify_clbk)
target_pos = target_pos or target_area.pos
max_dis = max_dis or math.huge
local t = self._t
local valid_spawn_groups = {}
local valid_spawn_group_distances = {}
local shortest_dis = math.huge
local longest_dis = -math.huge
for _, area in pairs(self._area_data) do
local spawn_groups = area.spawn_groups
if spawn_groups then
for _, spawn_group in ipairs(spawn_groups) do
if spawn_group.delay_t <= t and (not verify_clbk or verify_clbk(spawn_group)) then
local dis_id = tostring(spawn_group.nav_seg) .. "-" .. tostring(target_area.pos_nav_seg)
if not self._graph_distance_cache[dis_id] then
local path = managers.navigation:search_coarse({
access_pos = "swat",
from_seg = spawn_group.nav_seg,
to_seg = target_area.pos_nav_seg,
id = dis_id
})
if path and #path >= 2 then
local dis = 0
local current = spawn_group.pos
for i = 2, #path do
local nxt = path[i][2]
if current and nxt then
dis = dis + mvec_dis(current, nxt)
end
current = nxt
end
self._graph_distance_cache[dis_id] = dis
end
end
if self._graph_distance_cache[dis_id] then
local my_dis = self._graph_distance_cache[dis_id]
if my_dis < max_dis then
local spawn_group_id = spawn_group.mission_element:id()
valid_spawn_groups[spawn_group_id] = spawn_group
valid_spawn_group_distances[spawn_group_id] = my_dis
if my_dis < shortest_dis then
shortest_dis = my_dis
end
if my_dis > longest_dis then
longest_dis = my_dis
end
end
end
end
end
end
end
if not next(valid_spawn_group_distances) then
return
end
local total_weight = 0
local candidate_groups = {}
local low_weight = allowed_groups == self._tweak_data.reenforce.groups and 0.25 or allowed_groups == self._tweak_data.recon.groups and 0.5 or 0.75
for i, dis in pairs(valid_spawn_group_distances) do
local my_wgt = math_map_range(dis, shortest_dis, longest_dis, 1, low_weight)
local my_spawn_group = valid_spawn_groups[i]
local my_group_types = my_spawn_group.mission_element:spawn_groups()
my_spawn_group.distance = dis
total_weight = total_weight + self:_choose_best_groups(candidate_groups, my_spawn_group, my_group_types, allowed_groups, my_wgt)
end
if total_weight == 0 then
return
end
return self:_choose_best_group(candidate_groups, total_weight)
end
-- Reorder task updates so groups that have finished spawning immediately get their objectives instead of waiting for the next update
function GroupAIStateBesiege:_upd_police_activity()
self._police_upd_task_queued = false
if self._police_activity_blocked then
return
end
if self._ai_enabled then
self:_upd_SO()
self:_upd_grp_SO()
self:_check_spawn_phalanx()
self:_check_phalanx_group_has_spawned()
self:_check_phalanx_damage_reduction_increase()
-- Do _upd_group_spawning and _begin_new_tasks before the various task updates
if self._enemy_weapons_hot then
self:_claculate_drama_value()
self:_upd_group_spawning()
self:_begin_new_tasks()
self:_upd_regroup_task()
self:_upd_reenforce_tasks()
self:_upd_recon_tasks()
self:_upd_assault_task()
self:_upd_groups()
end
end
self:_queue_police_upd_task()
end
-- Update police activity in consistent intervals
function GroupAIStateBesiege:_queue_police_upd_task()
if not self._police_upd_task_queued then
self._police_upd_task_queued = true
managers.enemy:queue_task("GroupAIStateBesiege._upd_police_activity", self._upd_police_activity, self, self._t + 1)
end
end
-- Overhaul group spawning and fix forced group spawns not actually forcing the entire group to spawn
-- Group spawning now always spawns the entire group at once but uses a cooldown that prevents any regular group spawns
-- for a number of seconds equal to the amount of spawned units
local force_spawn_group_original = GroupAIStateBesiege.force_spawn_group
function GroupAIStateBesiege:force_spawn_group(...)
self._force_next_group_spawn = true
force_spawn_group_original(self, ...)
self._force_next_group_spawn = nil
end
Hooks:OverrideFunction(GroupAIStateBesiege, "_perform_group_spawning", function (self, spawn_task, force, use_last)
-- Prevent regular group spawning if cooldown is active unless it's a forced spawn
if self._next_group_spawn_t and self._next_group_spawn_t > self._t and not force and not self._force_next_group_spawn then
return
end
local produce_data = {
name = true,
spawn_ai = {}
}
local unit_categories = tweak_data.group_ai.unit_categories
local current_unit_type = tweak_data.levels:get_ai_group_type()
local spawn_points = spawn_task.spawn_group.spawn_pts
local function _try_spawn_unit(u_type_name, spawn_entry)
local hopeless = true
for _, sp_data in ipairs(spawn_points) do
local category = unit_categories[u_type_name]
if (sp_data.accessibility == "any" or category.access[sp_data.accessibility]) and (not sp_data.amount or sp_data.amount > 0) and sp_data.mission_element:enabled() then
hopeless = false
if sp_data.delay_t < self._t then
local units = category.unit_types[current_unit_type]
produce_data.name = units[math.random(#units)]
produce_data.name = managers.modifiers:modify_value("GroupAIStateBesiege:SpawningUnit", produce_data.name)
local spawned_unit = sp_data.mission_element:produce(produce_data)
if spawned_unit then
local u_key = spawned_unit:key()
local objective = nil
if spawn_task.objective then
objective = self.clone_objective(spawn_task.objective)
else
objective = spawn_task.group.objective.element:get_random_SO(spawned_unit)
if not objective then
spawned_unit:set_slot(0)
return true
end
objective.grp_objective = spawn_task.group.objective
end
local u_data = self._police[u_key]
self:set_enemy_assigned(objective.area, u_key)
if spawn_entry.tactics then
u_data.tactics = spawn_entry.tactics
u_data.tactics_map = {}
for _, tactic_name in ipairs(u_data.tactics) do
u_data.tactics_map[tactic_name] = true
end
end
spawned_unit:brain():set_spawn_entry(spawn_entry, u_data.tactics_map)
u_data.rank = spawn_entry.rank
self:_add_group_member(spawn_task.group, u_key)
if spawned_unit:brain():is_available_for_assignment(objective) then
if objective.element then
objective.element:clbk_objective_administered(spawned_unit)
end
spawned_unit:brain():set_objective(objective)
else
spawned_unit:brain():set_followup_objective(objective)
end
if spawn_task.ai_task then
spawn_task.ai_task.force_spawned = spawn_task.ai_task.force_spawned + 1
spawned_unit:brain()._logic_data.spawned_in_phase = spawn_task.ai_task.phase
end
sp_data.delay_t = self._t + sp_data.interval
if sp_data.amount then
sp_data.amount = sp_data.amount - 1
end
return true
end
end
end
end
if hopeless then
return true
end
end
-- Try spawning units that are picky about their access first
for u_type_name, spawn_info in pairs(spawn_task.units_remaining) do
if not unit_categories[u_type_name].access.acrobatic then
for _ = spawn_info.amount, 1, -1 do
if _try_spawn_unit(u_type_name, spawn_info.spawn_entry) then
spawn_info.amount = spawn_info.amount - 1
else
break
end
end
end
end
local complete = true
for u_type_name, spawn_info in pairs(spawn_task.units_remaining) do
for _ = spawn_info.amount, 1, -1 do
if _try_spawn_unit(u_type_name, spawn_info.spawn_entry) then
spawn_info.amount = spawn_info.amount - 1
else
complete = false
break
end
end
end
-- If there are still units to spawn, return and try spawning the rest in the next call
if not complete then
return
end
table.remove(self._spawning_groups, use_last and #self._spawning_groups or 1)
spawn_task.group.has_spawned = true
self:_voice_groupentry(spawn_task.group, spawn_task.group.objective.type == "recon_area") -- so it doesn't depend on setting this up in groupaitweakdata anymore as well as being more accurate to the group's actual intent
if spawn_task.group.size <= 0 then
self._groups[spawn_task.group.id] = nil
end
-- Set a cooldown before new units can be spawned via regular spawn tasks
self._next_group_spawn_t = self._t + spawn_task.group.size * tweak_data.group_ai.spawn_cooldown_mul
end)
-- Fix for potential crash when a group objective does not have a coarse path
local _get_group_forwardmost_coarse_path_index_original = GroupAIStateBesiege._get_group_forwardmost_coarse_path_index
function GroupAIStateBesiege:_get_group_forwardmost_coarse_path_index(group, ...)
if group.objective and group.objective.coarse_path then
return _get_group_forwardmost_coarse_path_index_original(self, group, ...)
end
end
function GroupAIStateBesiege:_voice_open_fire_start(group)
for u_key, unit_data in pairs(group.units) do
if unit_data.char_tweak.chatter.open_fire and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "open_fire") then
break
end
end
end
function GroupAIStateBesiege:_voice_move_in_start(group)
for u_key, unit_data in pairs(group.units) do
if unit_data.char_tweak.chatter.go_go and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "go_go") then
break
end
end
end
function GroupAIStateBesiege:_voice_saw()
for group_id, group in pairs(self._groups) do
for u_key, u_data in pairs(group.units) do
if u_data.char_tweak.chatter and u_data.char_tweak.chatter.saw then
self:chk_say_enemy_chatter(u_data.unit, u_data.m_pos, "saw")
else
end
end
end
end
function GroupAIStateBesiege:_voice_sentry()
for group_id, group in pairs(self._groups) do
for u_key, u_data in pairs(group.units) do
if u_data.char_tweak.chatter and u_data.char_tweak.chatter.sentry then
self:chk_say_enemy_chatter(u_data.unit, u_data.m_pos, "sentry")
else
end
end
end
end
function GroupAIStateBesiege:_voice_trip_mine(dead_unit)
local dead_unit_u_key = dead_unit:key()
local group = self._police[dead_unit_u_key] and self._police[dead_unit_u_key].group
if group then
for u_key, unit_data in pairs(group.units) do
if dead_unit_u_key ~= u_key and unit_data.char_tweak.chatter.trip_mine and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "trip_mine") then
break
end
end
end
end
--[[function GroupAIStateBesiege:_voice_saw(dead_unit)
local dead_unit_u_key = dead_unit:key()
local group = self._police[dead_unit_u_key] and self._police[dead_unit_u_key].group
if group then
for u_key, unit_data in pairs(group.units) do
if dead_unit_u_key ~= u_key and unit_data.char_tweak.chatter.saw and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "saw") then
break
end
end
end
end]]--
--[[function GroupAIStateBesiege:_voice_sentry(dead_unit)
local dead_unit_u_key = dead_unit:key()
local group = self._police[dead_unit_u_key] and self._police[dead_unit_u_key].group
if group then
for u_key, unit_data in pairs(group.units) do
if dead_unit_u_key ~= u_key and unit_data.char_tweak.chatter.sentry and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "sentry") then
break
end
end
end
end]]--
function GroupAIStateBesiege:_voice_friend_dead(group)
for u_key, unit_data in pairs(group.units) do
if unit_data.char_tweak.chatter and unit_data.char_tweak.chatter.aggressive and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "aggressive") then
break
end
end
end
function GroupAIStateBesiege:_voice_friend_dead_2(dead_unit)
local dead_unit_u_key = dead_unit:key()
local group = self._police[dead_unit_u_key] and self._police[dead_unit_u_key].group
if group then
for u_key, unit_data in pairs(group.units) do
if dead_unit_u_key ~= u_key and unit_data.char_tweak.chatter.aggressive and self:chk_say_enemy_chatter(unit_data.unit, unit_data.m_pos, "aggressive") then
break
end
end
end
end
--Disable vanilla captain spawning behavior.
function GroupAIStateBesiege:_check_spawn_phalanx()
return
end
--Captain Assault Banner enabled on enemy spawn, rather than via groupai.
function GroupAIStateBesiege:set_damage_reduction_buff_hud()
--Were you expecting some cute girl? Nope, it's just me! Dev Comments!
end
| agpl-3.0 |
T3hArco/skeyler-gamemodes | atlaschat/lua/atlaschat/sh_config.lua | 1 | 6577 | -- _ _ _ _
-- /\ | | | | | | | |
-- / \ | |_| | __ _ ___ ___| |__ __ _| |_
-- / /\ \| __| |/ _` / __| / __| '_ \ / _` | __|
-- / ____ \ |_| | (_| \__ \ | (__| | | | (_| | |_
-- /_/ \_\__|_|\__,_|___/ \___|_| |_|\__,_|\__|
--
--
-- © 2014 metromod.net do not share or re-distribute
-- without permission of its author (Chewgum - chewgumtj@gmail.com).
--
atlaschat.config = {}
local stored = {}
local objects = {}
local config = {}
config.__index = config
local saved = file.Read("atlaschat_config.txt", "DATA")
local nextSave = nil
saved = saved and von.deserialize(saved) or {}
---------------------------------------------------------
-- Creates a new config.
---------------------------------------------------------
function atlaschat.config.New(text, name, default, save, disableCommand, server, force)
local object
local exists = false
if (stored[name]) then
object = stored[name]
exists = true
else
object = {}
end
if (!exists) then
setmetatable(object, config)
end
object.text = text
object.name = name
object.value = default
object.save = save
object.default = default
object.server = server
object.force = force
stored[name] = object
if (!disableCommand) then
concommand.Add("atlaschat_" .. name, function(player, command, arguments)
local value = arguments[1]
if (value) then
local config = stored[string.sub(command, string.len("atlaschat") +2)]
local previous = config.value
config.value = value
if (config.save) then
saved[config.name] = config.value
nextSave = CurTime() +0.5
end
if (config.OnChange) then
config:OnChange(config.value, previous)
end
end
end)
end
-- Load saved value.
if (!force) then
if (save and saved[name] != nil) then
object.value = saved[name]
end
saved[name] = object.value
end
if (!exists) then
object.index = table.insert(objects, object)
end
return object
end
---------------------------------------------------------
-- Returns all of the config stuff.
---------------------------------------------------------
function atlaschat.config.GetStored()
return stored
end
---------------------------------------------------------
-- Returns a config.
---------------------------------------------------------
function atlaschat.config.Get(name)
return stored[name]
end
---------------------------------------------------------
-- Resets all values to their defaults.
---------------------------------------------------------
function atlaschat.config.ResetValues()
for i = 1, #objects do
local object = objects[i]
object:SetValue(object.default)
end
end
---------------------------------------------------------
-- Quick Set and Get functions.
---------------------------------------------------------
local SetGet = function(object, type, mod)
object["Get" .. type] = function(self) if (mod) then return mod(self.value) else return self.value end end
object["Set" .. type] = function(self, argument, noSave)
local previous = self.value
if (mod) then
self.value = mod(argument)
else
self.value = argument
end
if (!self.force and self.save and !noSave) then
saved[self.name] = self.value
nextSave = CurTime() +0.5
end
if (self.OnChange) then
self:OnChange(self.value, previous)
end
end
end
---------------------------------------------------------
-- Quick Set and Get functions.
---------------------------------------------------------
local tobool, tonumber, tostring = tobool, tonumber, tostring
SetGet(config, "Value")
SetGet(config, "Bool", tobool)
SetGet(config, "Int", tonumber)
SetGet(config, "String", tostring)
---------------------------------------------------------
-- Returns the text of this config.
---------------------------------------------------------
function config:GetText()
return self.text
end
---------------------------------------------------------
-- Returns the name of this config.
---------------------------------------------------------
function config:GetName()
return self.name
end
---------------------------------------------------------
-- This is just so it doesn't write as soon as the value
-- changes, aka 1000 times.
---------------------------------------------------------
hook.Add("Tick", "atlaschat.config.Tick", function()
if (nextSave and nextSave <= CurTime()) then
file.Write("atlaschat_config.txt", von.serialize(saved), "DATA")
nextSave = nil
end
end)
if (CLIENT) then
---------------------------------------------------------
--
---------------------------------------------------------
net.Receive("atlaschat.sndcfg", function(bits)
local unique = net.ReadString()
local type = net.ReadUInt(8)
local value = net.ReadType(type)
local object = stored[unique]
if (object and object.server) then
object:SetValue(value, true)
end
end)
end
if (SERVER) then
---------------------------------------------------------
--
---------------------------------------------------------
util.AddNetworkString("atlaschat.gtcfg")
util.AddNetworkString("atlaschat.sndcfg")
net.Receive("atlaschat.gtcfg", function(bits, player)
local isAdmin = player:IsAdmin()
if (isAdmin) then
local unique = net.ReadString()
local type = net.ReadUInt(8)
local value = net.ReadType(type)
local object = stored[unique]
if (object and object.server) then
object:SetValue(value, !game.IsDedicated())
net.Start("atlaschat.sndcfg")
net.WriteString(unique)
net.WriteType(value)
net.Broadcast()
end
end
end)
---------------------------------------------------------
--
---------------------------------------------------------
function atlaschat.config.SyncVariables(player)
for unique, object in pairs(stored) do
if (object.server and !object.force) then
local value = object:GetValue()
net.Start("atlaschat.sndcfg")
net.WriteString(unique)
net.WriteType(value)
net.Send(player)
end
end
end
end
---------------------------------------------------------
-- Default global configuration variables.
---------------------------------------------------------
atlaschat.enableAvatars = atlaschat.config.New("Enable avatars?", "avatars", true, true, true, true)
atlaschat.enableRankIcons = atlaschat.config.New("Enable rank icons?", "rank_icons", true, true, true, true) | bsd-3-clause |
Angel-team/Angel_bot | bot/utils.lua | 473 | 24167 | URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require "serpent"
feedparser = require "feedparser"
json = (loadfile "./libs/JSON.lua")()
mimetype = (loadfile "./libs/mimetype.lua")()
redis = (loadfile "./libs/redis.lua")()
JSON = (loadfile "./libs/dkjson.lua")()
http.TIMEOUT = 10
function get_receiver(msg)
if msg.to.type == 'user' then
return 'user#id'..msg.from.id
end
if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id
end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end
function is_chat_msg( msg )
if msg.to.type == 'chat' then
return true
end
return false
end
function string.random(length)
local str = "";
for i = 1, length do
math.random(97, 122)
str = str..string.char(math.random(97, 122));
end
return str;
end
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
-- DEPRECATED
function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1")
end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers)
-- Eg: foo.var
local file_name = url:match("[^%w]+([%.%w]+)$")
-- Any delimited alphanumeric on the url
file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$")
-- Random name, hope content-type works
file_name = file_name or str:random(5)
local content_type = headers["content-type"]
local extension = nil
if content_type then
extension = mimetype.get_mime_extension(content_type)
end
if extension then
file_name = file_name.."."..extension
end
local disposition = headers["content-disposition"]
if disposition then
-- attachment; filename=CodeCogsEqn.png
file_name = disposition:match('filename=([^;]+)') or file_name
end
return file_name
end
-- Saves file to /tmp/. If file_name isn't provided,
-- will get the text after the last "/" for filename
-- and content-type for extension
function download_to_file(url, file_name)
print("url to download: "..url)
local respbody = {}
local options = {
url = url,
sink = ltn12.sink.table(respbody),
redirect = true
}
-- nil, code, headers, status
local response = nil
if url:starts('https') then
options.redirect = false
response = {https.request(options)}
else
response = {http.request(options)}
end
local code = response[2]
local headers = response[3]
local status = response[4]
if code ~= 200 then return nil end
file_name = file_name or get_http_file_name(url, headers)
local file_path = "/tmp/"..file_name
print("Saved to: "..file_path)
file = io.open(file_path, "w+")
file:write(table.concat(respbody))
file:close()
return file_path
end
function vardump(value)
print(serpent.block(value, {comment=false}))
end
-- taken from http://stackoverflow.com/a/11130774/3163199
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
i = i + 1
t[i] = filename
end
return t
end
-- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen
function run_command(str)
local cmd = io.popen(str)
local result = cmd:read('*all')
cmd:close()
return result
end
-- User has privileges
function is_sudo(msg)
local var = false
-- Check users id in config
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
-- Returns the name of the sender
function get_name(msg)
local name = msg.from.first_name
if name == nil then
name = msg.from.id
end
return name
end
-- Returns at table of lua files inside plugins
function plugins_names( )
local files = {}
for k, v in pairs(scandir("plugins")) do
-- Ends with .lua
if (v:match(".lua$")) then
table.insert(files, v)
end
end
return files
end
-- Function name explains what it does.
function file_exists(name)
local f = io.open(name,"r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Save into file the data serialized for lua.
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
-- Returns true if the string is empty
function string:isempty()
return self == nil or self == ''
end
-- Returns true if the string is blank
function string:isblank()
self = self:trim()
return self:isempty()
end
-- DEPRECATED!!!!!
function string.starts(String, Start)
print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start))
end
-- Returns true if String starts with Start
function string:starts(text)
return text == string.sub(self,1,string.len(text))
end
-- Send image to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_photo(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function,
cb_extra = cb_extra
}
-- Call to remove with optional callback
send_photo(receiver, file_path, cb_function, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_photo_from_url(receiver, url, cb_function, cb_extra)
-- If callback not provided
cb_function = cb_function or ok_cb
cb_extra = cb_extra or false
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, cb_function, cb_extra)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra)
end
end
-- Same as send_photo_from_url but as callback function
function send_photo_from_url_callback(cb_extra, success, result)
local receiver = cb_extra.receiver
local url = cb_extra.url
local file_path = download_to_file(url, false)
if not file_path then -- Error
local text = 'Error downloading the image'
send_msg(receiver, text, ok_cb, false)
else
print("File path: "..file_path)
_send_photo(receiver, file_path, ok_cb, false)
end
end
-- Send multiple images asynchronous.
-- param urls must be a table.
function send_photos_from_url(receiver, urls)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = nil
}
send_photos_from_url_callback(cb_extra)
end
-- Use send_photos_from_url.
-- This function might be difficult to understand.
function send_photos_from_url_callback(cb_extra, success, result)
-- cb_extra is a table containing receiver, urls and remove_path
local receiver = cb_extra.receiver
local urls = cb_extra.urls
local remove_path = cb_extra.remove_path
-- The previously image to remove
if remove_path ~= nil then
os.remove(remove_path)
print("Deleted: "..remove_path)
end
-- Nil or empty, exit case (no more urls)
if urls == nil or #urls == 0 then
return false
end
-- Take the head and remove from urls table
local head = table.remove(urls, 1)
local file_path = download_to_file(head, false)
local cb_extra = {
receiver = receiver,
urls = urls,
remove_path = file_path
}
-- Send first and postpone the others as callback
send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra)
end
-- Callback to remove a file
function rmtmp_cb(cb_extra, success, result)
local file_path = cb_extra.file_path
local cb_function = cb_extra.cb_function or ok_cb
local cb_extra = cb_extra.cb_extra
if file_path ~= nil then
os.remove(file_path)
print("Deleted: "..file_path)
end
-- Finally call the callback
cb_function(cb_extra, success, result)
end
-- Send document to user and delete it when finished.
-- cb_function and cb_extra are optionals callback
function _send_document(receiver, file_path, cb_function, cb_extra)
local cb_extra = {
file_path = file_path,
cb_function = cb_function or ok_cb,
cb_extra = cb_extra or false
}
-- Call to remove with optional callback
send_document(receiver, file_path, rmtmp_cb, cb_extra)
end
-- Download the image and send to receiver, it will be deleted.
-- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false)
print("File path: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra)
end
-- Parameters in ?a=1&b=2 style
function format_http_params(params, is_get)
local str = ''
-- If is get add ? to the beginning
if is_get then str = '?' end
local first = true -- Frist param
for k,v in pairs (params) do
if v then -- nil value
if first then
first = false
str = str..k.. "="..v
else
str = str.."&"..k.. "="..v
end
end
end
return str
end
-- Check if user can use the plugin and warns user
-- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user'
local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false)
return true
else
return false
end
end
-- Check if user can use the plugin
function user_allowed(plugin, msg)
if plugin.privileged and not is_sudo(msg) then
return false
end
return true
end
function send_order_msg(destination, msgs)
local cb_extra = {
destination = destination,
msgs = msgs
}
send_order_msg_callback(cb_extra, true)
end
function send_order_msg_callback(cb_extra, success, result)
local destination = cb_extra.destination
local msgs = cb_extra.msgs
local file_path = cb_extra.file_path
if file_path ~= nil then
os.remove(file_path)
print("Deleted: " .. file_path)
end
if type(msgs) == 'string' then
send_large_msg(destination, msgs)
elseif type(msgs) ~= 'table' then
return
end
if #msgs < 1 then
return
end
local msg = table.remove(msgs, 1)
local new_cb_extra = {
destination = destination,
msgs = msgs
}
if type(msg) == 'string' then
send_msg(destination, msg, send_order_msg_callback, new_cb_extra)
elseif type(msg) == 'table' then
local typ = msg[1]
local nmsg = msg[2]
new_cb_extra.file_path = nmsg
if typ == 'document' then
send_document(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'image' or typ == 'photo' then
send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'audio' then
send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra)
elseif typ == 'video' then
send_video(destination, nmsg, send_order_msg_callback, new_cb_extra)
else
send_file(destination, nmsg, send_order_msg_callback, new_cb_extra)
end
end
end
-- Same as send_large_msg_callback but friendly params
function send_large_msg(destination, text)
local cb_extra = {
destination = destination,
text = text
}
send_large_msg_callback(cb_extra, true)
end
-- If text is longer than 4096 chars, send multiple msg.
-- https://core.telegram.org/method/messages.sendMessage
function send_large_msg_callback(cb_extra, success, result)
local text_max = 4096
local destination = cb_extra.destination
local text = cb_extra.text
local text_len = string.len(text)
local num_msg = math.ceil(text_len / text_max)
if num_msg <= 1 then
send_msg(destination, text, ok_cb, false)
else
local my_text = string.sub(text, 1, 4096)
local rest = string.sub(text, 4096, text_len)
local cb_extra = {
destination = destination,
text = rest
}
send_msg(destination, my_text, send_large_msg_callback, cb_extra)
end
end
-- Returns a table with matches or nil
function match_pattern(pattern, text, lower_case)
if text then
local matches = {}
if lower_case then
matches = { string.match(text:lower(), pattern) }
else
matches = { string.match(text, pattern) }
end
if next(matches) then
return matches
end
end
-- nil
end
-- Function to read data from files
function load_from_file(file, default_data)
local f = io.open(file, "r+")
-- If file doesn't exists
if f == nil then
-- Create a new empty table
default_data = default_data or {}
serialize_to_file(default_data, file)
print ('Created file', file)
else
print ('Data loaded from file', file)
f:close()
end
return loadfile (file)()
end
-- See http://stackoverflow.com/a/14899740
function unescape_html(str)
local map = {
["lt"] = "<",
["gt"] = ">",
["amp"] = "&",
["quot"] = '"',
["apos"] = "'"
}
new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s)
var = map[s] or n == "#" and string.char(s)
var = var or n == "#x" and string.char(tonumber(s,16))
var = var or orig
return var
end)
return new
end
--Check if this chat is realm or not
function is_realm(msg)
local var = false
local realms = 'realms'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(realms)] then
if data[tostring(realms)][tostring(msg.to.id)] then
var = true
end
return var
end
end
--Check if this chat is a group or not
function is_group(msg)
local var = false
local groups = 'groups'
local data = load_data(_config.moderation.data)
local chat = msg.to.id
if data[tostring(groups)] then
if data[tostring(groups)][tostring(msg.to.id)] then
var = true
end
return var
end
end
function savelog(group, logtxt)
local text = (os.date("[ %c ]=> "..logtxt.."\n \n"))
local file = io.open("./groups/logs/"..group.."log.txt", "a")
file:write(text)
file:close()
end
function user_print_name(user)
if user.print_name then
return user.print_name
end
local text = ''
if user.first_name then
text = user.last_name..' '
end
if user.lastname then
text = text..user.last_name
end
return text
end
--Check if user is the owner of that group or not
function is_owner(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_owner2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is admin or not
function is_admin(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_admin2(user_id)
local var = false
local data = load_data(_config.moderation.data)
local user = user_id
local admins = 'admins'
if data[tostring(admins)] then
if data[tostring(admins)][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--Check if user is the mod of that group or not
function is_momod(msg)
local var = false
local data = load_data(_config.moderation.data)
local user = msg.from.id
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['moderators'] then
if data[tostring(msg.to.id)]['moderators'][tostring(user)] then
var = true
end
end
end
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['set_owner'] then
if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == msg.from.id then
var = true
end
end
return var
end
function is_momod2(user_id, group_id)
local var = false
local data = load_data(_config.moderation.data)
local usert = user_id
if data[tostring(group_id)] then
if data[tostring(group_id)]['moderators'] then
if data[tostring(group_id)]['moderators'][tostring(usert)] then
var = true
end
end
end
if data[tostring(group_id)] then
if data[tostring(group_id)]['set_owner'] then
if data[tostring(group_id)]['set_owner'] == tostring(user_id) then
var = true
end
end
end
if data['admins'] then
if data['admins'][tostring(user_id)] then
var = true
end
end
for v,user in pairs(_config.sudo_users) do
if user == usert then
var = true
end
end
return var
end
-- Returns the name of the sender
function kick_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_owner2(user_id, chat_id) then -- Ignore admins
return
end
local chat = 'chat#id'..chat_id
local user = 'user#id'..user_id
chat_del_user(chat, user, ok_cb, true)
end
-- Ban
function ban_user(user_id, chat_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'banned:'..chat_id
redis:sadd(hash, user_id)
-- Kick from chat
kick_user(user_id, chat_id)
end
-- Global ban
function banall_user(user_id)
if tonumber(user_id) == tonumber(our_id) then -- Ignore bot
return
end
if is_admin2(user_id) then -- Ignore admins
return
end
-- Save to redis
local hash = 'gbanned'
redis:sadd(hash, user_id)
end
-- Global unban
function unbanall_user(user_id)
--Save on redis
local hash = 'gbanned'
redis:srem(hash, user_id)
end
-- Check if user_id is banned in chat_id or not
function is_banned(user_id, chat_id)
--Save on redis
local hash = 'banned:'..chat_id
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Check if user_id is globally banned or not
function is_gbanned(user_id)
--Save on redis
local hash = 'gbanned'
local banned = redis:sismember(hash, user_id)
return banned or false
end
-- Returns chat_id ban list
function ban_list(chat_id)
local hash = 'banned:'..chat_id
local list = redis:smembers(hash)
local text = "Ban list !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- Returns globally ban list
function banall_list()
local hash = 'gbanned'
local list = redis:smembers(hash)
local text = "global bans !\n\n"
for k,v in pairs(list) do
local user_info = redis:hgetall('user:'..v)
-- vardump(user_info)
if user_info then
if user_info.username then
user = '@'..user_info.username
elseif user_info.print_name and not user_info.username then
user = string.gsub(user_info.print_name, "_", " ")
else
user = ''
end
text = text..k.." - "..user.." ["..v.."]\n"
end
end
return text
end
-- /id by reply
function get_message_callback_id(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
send_large_msg(chat, result.from.id)
else
return 'Use This in Your Groups'
end
end
-- kick by reply for mods and owner
function Kick_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
-- Kick by reply for admins
function Kick_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't kick myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
else
return 'Use This in Your Groups'
end
end
--Ban by reply for admins
function ban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin
return "you can't kick mods,owner and admins"
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Ban by reply for admins
function ban_by_reply_admins(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't ban myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
ban_user(result.from.id, result.to.id)
send_large_msg(chat, "User "..result.from.id.." Banned")
else
return 'Use This in Your Groups'
end
end
-- Unban by reply
function unban_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't unban myself"
end
send_large_msg(chat, "User "..result.from.id.." Unbanned")
-- Save on redis
local hash = 'banned:'..result.to.id
redis:srem(hash, result.from.id)
else
return 'Use This in Your Groups'
end
end
function banall_by_reply(extra, success, result)
if result.to.type == 'chat' then
local chat = 'chat#id'..result.to.id
if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot
return "I won't banall myself"
end
if is_admin2(result.from.id) then -- Ignore admins
return
end
local name = user_print_name(result.from)
banall_user(result.from.id)
chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false)
send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered")
else
return 'Use This in Your Groups'
end
end
| gpl-2.0 |
T3hArco/skeyler-gamemodes | ssbase/entities/weapons/ss_mapeditor/shared.lua | 1 | 1243 | ----------------------------
-- SSBase --
-- Created by Skeyler.com --
----------------------------
-- Variables that are used on both client and server
SWEP.Author = ""
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = ""
SWEP.ViewModel = "models/weapons/c_toolgun.mdl"
SWEP.WorldModel = "models/weapons/w_toolgun.mdl"
SWEP.AnimPrefix = "python"
SWEP.UseHands = true
SWEP.ShootSound = Sound( "Airboat.FireGunRevDown" )
SWEP.Primary =
{
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
Ammo = "none"
}
SWEP.Secondary =
{
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
Ammo = "none"
}
SWEP.CanHolster = true
SWEP.CanDeploy = true
function SWEP:Initialize()
self.Primary =
{
-- Note: Switched this back to -1.. lets not try to hack our way around shit that needs fixing. -gn
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
Ammo = "none"
}
self.Secondary =
{
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
Ammo = "none"
}
end
function SWEP:Precache()
util.PrecacheModel( SWEP.ViewModel )
util.PrecacheModel( SWEP.WorldModel )
util.PrecacheSound( self.ShootSound )
end | bsd-3-clause |
AgentVi/DIGITS | tools/torch/data.lua | 3 | 23865 | -- Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
require 'torch' -- torch
require 'nn' -- provides a normalization operator
require 'utils' -- various utility functions
require 'hdf5' -- import HDF5 now as it is unsafe to do it from a worker thread
local threads = require 'threads' -- for multi-threaded data loader
check_require 'image' -- for color transforms
package.path = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]] .."?.lua;".. package.path
require 'logmessage'
local ffi = require 'ffi'
local tdsIsInstalled, tds = pcall(function() return check_require 'tds' end)
-- enable shared serialization to speed up Tensor passing between threads
threads.Threads.serialization('threads.sharedserialize')
----------------------------------------------------------------------
function copy (t) -- shallow-copy a table
if type(t) ~= "table" then return t end
local meta = getmetatable(t)
local target = {}
for k, v in pairs(t) do target[k] = v end
setmetatable(target, meta)
return target
end
local function all_keys(cursor_,key_,op_)
return coroutine.wrap(
function()
local k = key_
local v
repeat
k,v = cursor_:get(k,op_ or MDB.NEXT)
if k then
coroutine.yield(k,v)
end
until (not k)
end)
end
local PreProcess = function(y, meanTensor, mirror, crop, train, cropY, cropX, croplen)
if meanTensor then
for i=1,meanTensor:size(1) do
y[i]:add(-meanTensor[i])
end
end
if mirror and torch.FloatTensor.torch.uniform() > 0.49 then
y = image.hflip(y)
end
if crop then
if train == true then
--During training we will crop randomly
local valueY = math.ceil(torch.FloatTensor.torch.uniform()*cropY)
local valueX = math.ceil(torch.FloatTensor.torch.uniform()*cropX)
y = image.crop(y, valueX-1, valueY-1, valueX+croplen-1, valueY+croplen-1)
else
--for validation we will crop at center
y = image.crop(y, cropX-1, cropY-1, cropX+croplen-1, cropY+croplen-1)
end
end
return y
end
--Loading label definitions
local loadLabels = function(labels_file)
local Classes = {}
i=0
local file = io.open(labels_file)
if file then
for line in file:lines() do
i=i+1
-- labels file might contain Windows line endings
-- or other whitespaces => trim leading and trailing
-- spaces here
Classes[i] = trim(line)
end
return Classes
else
return nil -- nil indicates that file not present
end
end
--loading mean tensor
local loadMean = function(mean_file, use_mean_pixel)
local meanTensor
local mean_im = image.load(mean_file,nil,'byte'):type('torch.FloatTensor'):contiguous()
if use_mean_pixel then
mean_of_mean = torch.FloatTensor(mean_im:size(1))
for i=1,mean_im:size(1) do
mean_of_mean[i] = mean_im[i]:mean()
end
meanTensor = mean_of_mean
else
meanTensor = mean_im
end
return meanTensor
end
local function pt(t)
for k,v in pairs(t) do
print(k,v)
end
end
-- Meta class
LMDBSource = {e=nil, t=nil, d=nil, c=nil}
function LMDBSource:new(lighningmdb, path)
local paths = require('paths')
assert(paths.dirp(path), 'DB Directory '.. path .. ' does not exist')
logmessage.display(0,'opening LMDB database: ' .. path)
local self = copy(LMDBSource)
self.lightningmdb = lighningmdb
self.e = self.lightningmdb.env_create()
local LMDB_MAP_SIZE = 1099511627776 -- 1 TB
self.e:set_mapsize(LMDB_MAP_SIZE)
local flags = lightningmdb.MDB_RDONLY + lightningmdb.MDB_NOTLS
local db, err = self.e:open(path, flags, 0664)
if not db then
-- unable to open Database => this might be due to a permission error on
-- the lock file so we will try again with MDB_NOLOCK. MDB_NOLOCK is safe
-- in this process as we are opening the database in read-only mode.
-- However if another process is writing into the database we might have a
-- concurrency issue - note that this shouldn't happen in DIGITS since the
-- database is written only once during dataset creation
logmessage.display(0,'opening LMDB database failed with error: "' .. err .. '". Trying with MDB_NOLOCK')
flags = bit.bor(flags, lighningmdb.MDB_NOLOCK)
-- we need to close/re-open the LMDB environment
self.e:close()
self.e = self.lightningmdb.env_create()
self.e:set_mapsize(LMDB_MAP_SIZE)
db, err = self.e:open(path, flags ,0664)
if not db then
error('opening LMDB database failed with error: ' .. err)
end
end
self.total = self.e:stat().ms_entries
self.t = self.e:txn_begin(nil, self.lightningmdb.MDB_RDONLY)
self.d = self.t:dbi_open(nil,0)
self.c = self.t:cursor_open(self.d)
self.path = path
return self, self.total
end
function LMDBSource:close()
logmessage.display(0,'closing LMDB database: ' .. self.path)
self.total = 0
self.c:close()
self.e:dbi_close(self.d)
self.t:abort()
self.e:close()
end
function LMDBSource:get(key)
if key then
v = self.t:get(self.d,key,self.lightningmdb.MDB_FIRST)
else
k,v = self.c:get(nil,self.lightningmdb.MDB_NEXT)
end
return v
end
-- Meta class
DBSource = {mean = nil, ImageChannels = 0, ImageSizeY = 0, ImageSizeX = 0, total=0,
mirror=false, crop=false, croplen=0, cropY=0, cropX=0, subtractMean=true,
train=false, classification=false}
-- Derived class method new
-- Creates a new instance of a database
-- Parameters:
-- backend (string): 'lmdb' or 'hdf5'
-- db_path (string): path to database
-- labels_db_path (string): path to labels database, or nil
-- mirror (boolean): whether samples must be mirrored
-- meanTensor (tensor): mean tensor to use for mean subtraction
-- isTrain (boolean): whether this is a training database (e.g. mirroring not applied to validation database)
-- shuffle (boolean): whether samples should be shuffled
-- classification (boolean): whether this is a classification task
function DBSource:new (backend, db_path, labels_db_path, mirror, meanTensor, isTrain, shuffle, classification)
local self = copy(DBSource)
local paths = require('paths')
if backend == 'lmdb' then
check_require('pb')
self.datum = pb.require"datum"
local lightningmdb_lib=check_require("lightningmdb")
self.lightningmdb = _VERSION=="Lua 5.2" and lightningmdb_lib or lightningmdb
self.lmdb_data, self.total = LMDBSource:new(self.lightningmdb, db_path)
self.keys = self:lmdb_getKeys()
if #self.keys ~= self.total then
logmessage.display(2, 'thr-id=' .. __threadid .. ' will be disabled - failed to initialize DB - #keys=' .. #self.keys .. ' #records='.. self.total)
return nil
end
-- do we have a separate database for labels/targets?
if labels_db_path~='' then
self.lmdb_labels, total_labels = LMDBSource:new(self.lightningmdb, labels_db_path)
assert(self.total == total_labels, "Number of records="..self.total.." does not match number of labels=" ..total_labels)
-- read first entry to check label dimensions
local v = self.lmdb_labels:get(self.keys[1])
if not v then
logmessage.display(2, 'thr-id=' .. __threadid .. ' failed to initialize label DB')
return nil
end
local msg = self.datum.Datum():Parse(v)
-- assume row vector 1xN labels
assert(msg.height == 1, "label height=" .. msg.height .. " not supported")
self.label_width = msg.width
else
-- assume scalar label (e.g. classification)
self.label_width = 1
end
-- LMDB-specific functions
self.getSample = self.lmdb_getSample
self.close = self.lmdb_close
self.reset = self.lmdb_reset
-- read first entry to check image dimensions
local v = self.lmdb_data:get(self.keys[1])
local msg = self.datum.Datum():Parse(v)
self.ImageChannels = msg.channels
self.ImageSizeX = msg.width
self.ImageSizeY = msg.height
elseif backend == 'hdf5' then
assert(classification, "hdf5 only supports classification yet")
assert(labels_db_path == '', "hdf5 separate label DB not implemented yet")
check_require('hdf5')
-- assume scalar label (e.g. classification)
self.label_width = 1
-- list.txt contains list of HDF5 databases --
logmessage.display(0,'opening HDF5 database: ' .. db_path)
list_path = paths.concat(db_path, 'list.txt')
local file = io.open(list_path)
assert(file,"unable to open "..list_path)
-- go through all DBs in list.txt and store required info
self.dbs = {}
self.total = 0
for line in file:lines() do
local fileName = paths.concat(db_path, paths.basename(line))
-- get number of records
local myFile = hdf5.open(fileName,'r')
local dim = myFile:read('/data'):dataspaceSize()
local n_records = dim[1]
self.ImageChannels = dim[2]
self.ImageSizeY = dim[3]
self.ImageSizeX = dim[4]
myFile:close()
-- store DB info
self.dbs[#self.dbs + 1] = {
path = fileName,
records = n_records
}
self.total = self.total + n_records
end
-- which DB is currently being used (initially set to nil to defer
-- read to first call to self:nextBatch)
self.db_id = nil
-- cursor points to current record in current DB
self.cursor = nil
-- set pointers to HDF5-specific functions
self.getSample = self.hdf5_getSample
self.close = self.hdf5_close
self.reset = self.hdf5_reset
end
if meanTensor ~= nil then
self.mean = meanTensor
assert(self.ImageChannels == self.mean:size()[1])
if self.mean:nDimension() > 1 then
-- mean matrix subtraction
assert(self.ImageSizeY == self.mean:size()[2])
assert(self.ImageSizeX == self.mean:size()[3])
end
end
logmessage.display(0,'Image channels are ' .. self.ImageChannels .. ', Image width is ' .. self.ImageSizeX .. ' and Image height is ' .. self.ImageSizeY)
self.mirror = mirror
self.train = isTrain
self.shuffle = shuffle
self.classification = classification
if self.classification then
assert(self.label_width == 1, 'expect scalar labels for classification tasks')
end
return self
end
-- Derived class method setCropLen
-- This method may be called in two cases:
-- * when the crop command-line parameter is used
-- * when the network definition defines a preferred crop length
function DBSource:setCropLen(croplen)
self.crop = true
self.croplen = croplen
if self.train == true then
self.cropY = self.ImageSizeY - croplen + 1
self.cropX = self.ImageSizeX - croplen + 1
else
self.cropY = math.floor((self.ImageSizeY - croplen)/2) + 1
self.cropX = math.floor((self.ImageSizeX - croplen)/2) + 1
end
end
-- Derived class method inputTensorShape
-- This returns the shape of the input samples in the database
-- There is an assumption that all input samples have the same shape
function DBSource:inputTensorShape()
local shape = torch.Tensor(3)
shape[1] = self.ImageChannels
shape[2] = self.ImageSizeY
shape[3] = self.ImageSizeX
return shape
end
-- Derived class method lmdb_getKeys
function DBSource:lmdb_getKeys ()
local Keys
if tdsIsInstalled then
-- use tds.Vec() to allocate memory outside of Lua heap
Keys = tds.Vec()
else
-- if tds is not installed, use regular table (and Lua memory allocator)
Keys = {}
end
local i=0
local key=nil
for k,v in all_keys(self.lmdb_data.c,nil,self.lightningmdb.MDB_NEXT) do
i=i+1
Keys[i] = k
key = k
end
return Keys
end
-- Derived class method getSample (LMDB flavour)
function DBSource:lmdb_getSample(shuffle, idx)
local label
if shuffle then
idx = math.max(1,torch.ceil(torch.rand(1)[1] * self.total))
end
key = self.keys[idx]
v = self.lmdb_data:get(key)
assert(key~=nil, "lmdb read nil key at idx="..idx)
assert(v~=nil, "lmdb read nil value at idx="..idx.." key="..key)
local total = self.ImageChannels*self.ImageSizeY*self.ImageSizeX
-- Tensor allocations inside loop consumes little more execution time. So allocated "x" outside with double size of an image and inside loop if any encoded image is encountered with bytes size more than Tensor size, then the Tensor is resized appropriately.
local x = torch.ByteTensor(total*2):contiguous() -- sometimes length of JPEG files are more than total size. So, "x" is allocated with more size to ensure that data is not truncated while copying.
local x_size = total * 2 -- This variable is just to avoid the calls to tensor's size() i.e., x:size(1)
local temp_ptr = torch.data(x) -- raw C pointer using torchffi
--local a = torch.Timer()
--local m = a:time().real
local msg = self.datum.Datum():Parse(v)
if not self.lmdb_labels then
-- read label from sample database
label = msg.label
else
-- read label from label database
v = self.lmdb_labels:get(key)
local label_msg = self.datum.Datum():Parse(v)
label = torch.FloatTensor(label_msg.width):contiguous()
for x=1,label_msg.width do
label[x] = label_msg.float_data[x]
end
end
if #msg.data > x_size then
x:resize(#msg.data+1) -- 1 extra byte is required to copy zero terminator i.e., '\0', by ffi.copy()
x_size = #msg.data
end
ffi.copy(temp_ptr, msg.data)
--print(string.format("elapsed time1: %.6f\n", a:time().real - m))
--m = a:time().real
local y=nil
if msg.encoded==true then
y = image.decompress(x,msg.channels,'byte'):float()
else
x = x:narrow(1,1,total):view(msg.channels,msg.height,msg.width):float() -- using narrow() returning the reference to x tensor with the size exactly equal to total image byte size, so that view() works fine without issues
if self.ImageChannels == 3 then
-- unencoded color images are stored in BGR order => we need to swap blue and red channels (BGR->RGB)
y = torch.FloatTensor(msg.channels,msg.height,msg.width)
y[1] = x[3]
y[2] = x[2]
y[3] = x[1]
else
y = x
end
end
return y, label
end
-- Derived class method getSample (HDF5 flavour)
function DBSource:hdf5_getSample(shuffle)
if not self.db_id or self.cursor>self.dbs[self.db_id].records then
--local a = torch.Timer()
--local m = a:time().real
self.db_id = self.db_id or 0
assert(self.db_id < #self.dbs, "Trying to read more records than available")
self.db_id = self.db_id + 1
local myFile = hdf5.open(self.dbs[self.db_id].path, 'r')
self.hdf5_data = myFile:read('/data'):all()
self.hdf5_labels = myFile:read('/label'):all()
myFile:close()
-- make sure number of entries match number of labels
assert(self.hdf5_data:size()[1] == self.hdf5_labels:size()[1], "data/label mismatch")
self.cursor = 1
--print(string.format("hdf5 data load - elapsed time1: %.6f\n", a:time().real - m))
end
local idx
if shuffle then
idx = math.max(1,torch.ceil(torch.rand(1)[1] * self.dbs[self.db_id].records))
else
idx = self.cursor
end
y = self.hdf5_data[idx]
channels = y:size()[1]
label = self.hdf5_labels[idx]
self.cursor = self.cursor + 1
return y, label
end
-- Derived class method nextBatch
-- @parameter batchSize Number of samples to load
-- @parameter idx Current index within database
function DBSource:nextBatch (batchsize, idx)
local Images
if self.crop then
Images = torch.Tensor(batchsize, self.ImageChannels, self.croplen, self.croplen)
else
Images = torch.Tensor(batchsize, self.ImageChannels, self.ImageSizeY, self.ImageSizeX)
end
local Labels
if self.label_width == 1 then
Labels = torch.Tensor(batchsize)
else
Labels = torch.FloatTensor(batchsize, self.label_width)
end
local i=0
--local mean_ptr = torch.data(self.mean)
local image_ind = 0
for i=1,batchsize do
-- get next sample
y, label = self:getSample(self.shuffle, idx + i - 1)
if self.classification then
-- label is index from array and Lua array indices are 1-based
label = label + 1
end
Images[i] = PreProcess(y, self.mean, self.mirror, self.crop, self.train, self.cropY, self.cropX, self.croplen)
Labels[i] = label
end
return Images, Labels
end
-- Derived class method to reset cursor (HDF5 flavour)
function DBSource:hdf5_reset ()
self.db_id = nil
self.cursor = nil
end
-- Derived class method to get total number of Records
function DBSource:totalRecords ()
return self.total;
end
-- Derived class method close (LMDB flavour)
function DBSource:lmdb_close (batchsize)
self.lmdb_data:close()
if self.lmdb_labels then
self.lmdb_labels:close()
end
end
-- Derived class method close (HDF5 flavour)
function DBSource:hdf5_close (batchsize)
end
-- Meta class
DataLoader = {}
-- Derived class method new
-- Creates a new instance of a database
-- @param numThreads (int) number of reader threads to create
-- @package_path (string) caller package path
-- @param backend (string) 'lmdb' or 'hdf5'
-- @param db_path (string) path to database
-- @param labels_db_path (string) path to labels database, or nil
-- @param mirror (boolean) whether samples must be mirrored
-- @param mean (Tensor) mean tensor for mean image
-- @param subtractMean (boolean) whether mean image should be subtracted from samples
-- @param isTrain (boolean) whether this is a training database (e.g. mirroring not applied to validation database)
-- @param shuffle (boolean) whether samples should be shuffled
-- @param classification (boolean) whether this is a classification task
function DataLoader:new (numThreads, package_path, backend, db_path, labels_db_path, mirror, mean, isTrain, shuffle, classification)
local self = copy(DataLoader)
self.backend = backend
if self.backend == 'hdf5' then
-- hdf5 wrapper does not support multi-threaded reader yet
numThreads = 1
end
-- create pool of threads
self.numThreads = numThreads
self.threadPool = threads.Threads(
self.numThreads,
function(threadid)
-- inherit package path from main thread
package.path = package_path
require('data')
-- executes in reader thread, variables are local to this thread
db = DBSource:new(backend, db_path, labels_db_path,
mirror, mean,
isTrain,
shuffle,
classification
)
end
)
-- use non-specific mode
self.threadPool:specific(false)
return self
end
function DataLoader:getInfo()
local datasetSize
local inputTensorShape
-- switch to specific mode so we can specify which thread to add job to
self.threadPool:specific(true)
-- we need to iterate here as some threads may not have a valid DB
-- handle (as happens when opening too many concurrent instances)
for i=1,self.numThreads do
self.threadPool:addjob(
i, -- thread to add job to
function()
-- executes in reader thread, return values passed to
-- main thread through following function
if db then
return db:totalRecords(), db:inputTensorShape()
else
return nil, nil
end
end,
function(totalRecords, shape)
-- executes in main thread
datasetSize = totalRecords
inputTensorShape = shape
end
)
self.threadPool:synchronize()
if datasetSize then
break
end
end
-- return to non-specific mode
self.threadPool:specific(false)
return datasetSize, inputTensorShape
end
-- schedule next data loader batch
-- @param batchSize (int) Number of samples to load
-- @param dataIdx (int) Current index in database
-- @param dataTable (table) Table to store data into
function DataLoader:scheduleNextBatch(batchSize, dataIdx, dataTable)
-- send reader thread a request to load a batch from the training DB
local backend = self.backend
self.threadPool:addjob(
function()
if backend=='hdf5' and dataIdx==1 then
db:reset()
end
-- executes in reader thread
if db then
inputs, targets = db:nextBatch(batchSize, dataIdx)
return batchSize, inputs, targets
else
return batchSize, nil, nil
end
end,
function(batchSize, inputs, targets)
-- executes in main thread
dataTable.batchSize = batchSize
dataTable.inputs = inputs
dataTable.outputs = targets
end
)
end
-- returns whether data loader is able to accept more jobs
function DataLoader:acceptsjob()
return self.threadPool:acceptsjob()
end
-- wait until next data loader job completes
function DataLoader:waitNext()
-- wait for next data loader job to complete
self.threadPool:dojob()
-- check for errors in loader threads
if self.threadPool:haserror() then -- check for errors
self.threadPool:synchronize() -- finish everything and throw error
end
end
-- free data loader resources
function DataLoader:close()
-- switch to specific mode so we can specify which thread to add job to
self.threadPool:specific(true)
for i=1,self.numThreads do
self.threadPool:addjob(
i,
function()
if db then
db:close()
end
end
)
end
-- return to non-specific mode
self.threadPool:specific(false)
end
-- set crop length (calls setCropLen() method of all DB intances)
function DataLoader:setCropLen(croplen)
-- switch to specific mode so we can specify which thread to add job to
self.threadPool:specific(true)
for i=1,self.numThreads do
self.threadPool:addjob(
i,
function()
if db then
db:setCropLen(croplen)
end
end
)
end
-- return to non-specific mode
self.threadPool:specific(false)
end
return{
loadLabels = loadLabels,
loadMean= loadMean,
PreProcess = PreProcess
}
| bsd-3-clause |
dieg0vb/sysdig | userspace/sysdig/chisels/netlower.lua | 12 | 4664 | --[[
netlower.lua - trace network I/O slower than a given threshold.
USAGE: sysdig -c netlower min_ms
eg,
sysdig -c netlower 1000 # show network I/O slower than 1000 ms.
sysdig -c netlower "1 disable_colors" # show network I/O slower than 1 ms. w/ no colors
sysdig -c netlower 1000 # show network I/O slower than 1000 ms and container output
Copyright (C) 2013-2014 Draios inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--]]
-- Chisel description
description = "Trace network I/O slower than a threshold, or all network I/O. This chisel is compatable with containers using the sysdig -pc or -pcontainer argument, otherwise no container information will be shown. (Blue represents a process running within a container, and Green represents a host process)"
short_description = "Trace slow network I/0"
category = "Performance"
-- Chisel argument list
args =
{
{
name = "min_ms",
description = "Minimum millisecond threshold for showing network I/O",
argtype = "int",
optional = false
},
{
name = "disable_color",
description = "Set to 'disable_colors' if you want to disable color output",
argtype = "string",
optional = true
},
}
require "common"
terminal = require "ansiterminal"
terminal.enable_color(true)
-- Argument notification callback
function on_set_arg(name, val)
if name == "disable_color" and val == "disable_color" then
terminal.enable_color(false)
elseif name == "min_ms" then
min_ms = parse_numeric_input(val, name)
end
return true
end
-- Initialization callback
function on_init()
-- set the following fields on_event()
etype = chisel.request_field("evt.type")
dir = chisel.request_field("evt.dir")
datetime = chisel.request_field("evt.datetime")
fname = chisel.request_field("fd.name")
pname = chisel.request_field("proc.name")
latency = chisel.request_field("evt.latency")
fcontainername = chisel.request_field("container.name")
fcontainerid = chisel.request_field("container.id")
-- The -pc or -pcontainer options was supplied on the cmd line
print_container = sysdig.is_print_container_data()
-- filter for network I/O
chisel.set_filter("evt.is_io=true and (fd.type=ipv4 or fd.type=ipv6)")
-- The -pc or -pcontainer options was supplied on the cmd line
if print_container then
print(string.format("%-23.23s %-20.20s %-20.20s %-12.12s %-8s %-12s %s",
"evt.datetime",
"container.id",
"container.name",
"proc.name",
"evt.type",
"LATENCY(ms)",
"fd.name"))
print(string.format("%-23.23s %-20.20s %-20.20s %-12.12s %-8s %-12s %s",
"-----------------------",
"------------------------------",
"------------------------------",
"------------",
"--------",
"------------",
"-----------------------------------------"))
else
print(string.format("%-23.23s %-12.12s %-8s %-12s %s",
"evt.datetime",
"proc.name",
"evt.type",
"LATENCY(ms)",
"fd.name"))
print(string.format("%-23.23s %-12.12s %-8s %-12s %s",
"-----------------------",
"------------",
"--------",
"------------",
"-----------------------------------------"))
end
return true
end
-- Event callback
function on_event()
local color = terminal.green
lat = evt.field(latency) / 1000000
fn = evt.field(fname)
if evt.field(dir) == "<" and lat > min_ms then
-- If this is a container modify the output color
if evt.field(fcontainername) ~= "host" then
color = terminal.blue
end
-- The -pc or -pcontainer options was supplied on the cmd line
if print_container then
print(color .. string.format("%-23.23s %-20.20s %-20.20s %-12.12s %-8s %12d %s",
evt.field(datetime),
evt.field(fcontainerid),
evt.field(fcontainername),
evt.field(pname),
evt.field(etype),
lat,
fn ))
else
print(color .. string.format("%-23.23s %-12.12s %-8s %12d %s",
evt.field(datetime),
evt.field(pname),
evt.field(etype),
lat,
fn ))
end
end
return true
end
| gpl-2.0 |
drdownload/prosody-modules | mod_pubsub_hub/mod_pubsub_hub.lua | 32 | 6808 | -- Copyright (C) 2011 - 2012 Kim Alvefur
--
-- This file is MIT/X11 licensed.
local http = require "net.http";
local formdecode = http.formdecode;
local formencode = http.formencode;
local http_request = http.request;
local uuid = require "util.uuid".generate;
local hmac_sha1 = require "util.hmac".sha1;
local json_encode = require "util.json".encode;
local time = os.time;
local m_min, m_max = math.min, math.max;
local tostring = tostring;
local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
local xmlns_pubsub_event = xmlns_pubsub .. "#event";
local subs_by_topic = module:shared"subscriptions";
local max_lease, min_lease, default_lease = 86400, 600, 3600;
module:depends"pubsub";
local valid_modes = { ["subscribe"] = true, ["unsubscribe"] = true, }
local function do_subscribe(subscription)
-- FIXME handle other states
if subscription.state == "subscribed" then
local ok, err = hosts[module.host].modules.pubsub.service:add_subscription(subscription.topic, true, module.host);
module:log(ok and "debug" or "error", "add_subscription() => %s, %s", tostring(ok), tostring(err));
end
end
local function handle_request(event)
local request, response = event.request, event.response;
local method, body = request.method, request.body;
local query = request.url.query or {};
if query and type(query) == "string" then
query = formdecode(query);
end
if body and request.headers.content_type == "application/x-www-form-urlencoded" then
body = formdecode(body);
end
if method == "POST" then
-- Subscription request
if body["hub.callback"] and body["hub.mode"] and valid_modes[body["hub.mode"]]
and body["hub.topic"] and body["hub.verify"] then
-- http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#anchor5
local callback = body["hub.callback"];
local mode = body["hub.mode"];
local topic = body["hub.topic"];
local lease_seconds = m_max(min_lease, m_min(tonumber(body["hub.lease_seconds"]) or default_lease, max_lease));
local secret = body["hub.secret"];
local verify_token = body["hub.verify_token"];
module:log("debug", "topic is "..(type(topic)=="string" and "%q" or "%s"), tostring(topic));
if not subs_by_topic[topic] then
subs_by_topic[topic] = {};
end
local subscription = subs_by_topic[topic][callback];
local verify_modes = {};
for i=1,#body do
if body[i].name == "hub.verify" then
verify_modes[body[i].value] = true;
end
end
subscription = subscription or {
id = uuid(),
callback = callback,
topic = topic,
state = "unsubscribed",
secret = secret,
want_state = mode,
};
subscription.lease_seconds = lease_seconds;
subscription.expires = time() + lease_seconds;
subs_by_topic[topic][callback] = subscription;
local challenge = uuid();
local callback_url = callback .. (callback:match("%?") and "&" or "?") .. formencode{
["hub.mode"] = mode,
["hub.topic"] = topic,
["hub.challenge"] = challenge,
["hub.lease_seconds"] = tostring(lease_seconds),
["hub.verify_token"] = verify_token, -- COMPAT draft version 0.3
}
module:log("debug", "Sending async verification request to %s for %s", tostring(callback_url), tostring(subscription));
http_request(callback_url, nil, function(body, code)
if body == challenge and code > 199 and code < 300 then
if not subscription.want_state then
module:log("warn", "Verification of already verified request, probably");
return;
end
subscription.state = subscription.want_state .. "d";
subscription.want_state = nil;
module:log("debug", "calling do_subscribe()");
do_subscribe(subscription);
subs_by_topic[topic][callback] = subscription;
else
module:log("warn", "status %d and body was %q", tostring(code), tostring(body));
subs_by_topic[topic][callback] = subscription;
end
end)
return 202;
else
response.status = 400;
response.headers.content_type = "text/html";
return "<h1>Bad Request</h1>\n<a href='http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#anchor5'>Missing required parameter(s)</a>\n"
end
end
end
local function periodic(now)
local next_check = now + max_lease;
local purge = false;
for topic, callbacks in pairs(subs_by_topic) do
for callback, subscription in pairs(callbacks) do
if subscription.mode == "subscribed" then
if subscription.expires < now then
-- Subscription has expired, drop it.
purge = true;
else
next_check = m_min(next_check, subscription.expires);
end
end
end
if purge then
local new_callbacks = {};
for callback, subscription in pairs(callbacks) do
if (subscription.state == "subscribed" and subscription.expires < now)
and subscription.want_state ~= "remove" then
new_callbacks[callback] = subscription;
end
end
subs_by_topic[topic] = new_callbacks;
purge = false;
end
end
return m_max((now - next_check) - min_lease, min_lease);
end
local xmlns_atom = "http://www.w3.org/2005/Atom";
local st = require "util.stanza";
local function on_notify(subscription, content)
if content.attr and content.attr.xmlns == xmlns_atom then
-- COMPAT This is required by the PubSubHubbub spec.
content = st.stanza("feed", {xmlns=xmlns_atom}):add_child(content);
end
local body = tostring(content);
local headers = {
["Content-Type"] = "application/xml",
};
if subscription.secret then
headers["X-Hub-Signature"] = "sha1="..hmac_sha1(subscription.secret, body, true);
end
http_request(subscription.callback, { method = "POST", body = body, headers = headers }, function(body, code)
if code >= 200 and code <= 299 then
module:log("debug", "Delivered");
else
module:log("warn", "Got status code %d on delivery to %s", tonumber(code) or -1, tostring(subscription.callback));
-- TODO Retry
-- ... but the spec says that you should not retry, wtf?
end
end);
end
module:hook("message/host", function(event)
local stanza = event.stanza;
if stanza.attr.from ~= module.host then return end;
for pubsub_event in stanza:childtags("event", xmlns_pubsub_event) do
local items = pubsub_event:get_child("items");
local node = items.attr.node;
if items and node and subs_by_topic[node] then
for item in items:childtags("item") do
local content = item.tags[1];
for callback, subscription in pairs(subs_by_topic[node]) do
on_notify(subscription, content)
end
end
end
end
return true;
end, 10);
module:depends"http";
module:provides("http", {
default_path = "/hub";
route = {
POST = handle_request;
GET = function()
return json_encode(subs_by_topic);
end;
["GET /topic/*"] = function(event, path)
return json_encode(subs_by_topic[path])
end;
};
});
module:add_timer(1, periodic);
| mit |
crazyboy11/bot122 | bot/creedbot.lua | 2 | 15547 | package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
..';.luarocks/share/lua/5.2/?/init.lua'
package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
require("./bot/utils")
VERSION = '1.0'
-- This function is called when tg receive a msg
function on_msg_receive (msg)
if not started then
return
end
local receiver = get_receiver(msg)
print (receiver)
--vardump(msg)
msg = pre_process_service_msg(msg)
if msg_valid(msg) then
msg = pre_process_msg(msg)
if msg then
match_plugins(msg)
-- mark_read(receiver, ok_cb, false)
end
end
end
function ok_cb(extra, success, result)
end
function on_binlog_replay_end()
started = true
postpone (cron_plugins, false, 60*5.0)
_config = load_config()
-- load plugins
plugins = {}
load_plugins()
end
function msg_valid(msg)
-- Don't process outgoing messages
if msg.out then
print('\27[36mNot valid: msg from us\27[39m')
return false
end
-- Before bot was started
if msg.date < now then
print('\27[36mNot valid: old msg\27[39m')
return false
end
if msg.unread == 0 then
print('\27[36mNot valid: readed\27[39m')
return false
end
if not msg.to.id then
print('\27[36mNot valid: To id not provided\27[39m')
return false
end
if not msg.from.id then
print('\27[36mNot valid: From id not provided\27[39m')
return false
end
if msg.from.id == our_id then
print('\27[36mNot valid: Msg from our id\27[39m')
return false
end
if msg.to.type == 'encr_chat' then
print('\27[36mNot valid: Encrypted chat\27[39m')
return false
end
if msg.from.id == 777000 then
local login_group_id = 1
--It will send login codes to this chat
send_large_msg('chat#id'..login_group_id, msg.text)
end
return true
end
--
function pre_process_service_msg(msg)
if msg.service then
local action = msg.action or {type=""}
-- Double ! to discriminate of normal actions
msg.text = "!!tgservice " .. action.type
-- wipe the data to allow the bot to read service messages
if msg.out then
msg.out = false
end
if msg.from.id == our_id then
msg.from.id = 0
end
end
return msg
end
-- Apply plugin.pre_process function
function pre_process_msg(msg)
for name,plugin in pairs(plugins) do
if plugin.pre_process and msg then
print('Preprocess', name)
msg = plugin.pre_process(msg)
end
end
return msg
end
-- Go over enabled plugins patterns.
function match_plugins(msg)
for name, plugin in pairs(plugins) do
match_plugin(plugin, name, msg)
end
end
-- Check if plugin is on _config.disabled_plugin_on_chat table
local function is_plugin_disabled_on_chat(plugin_name, receiver)
local disabled_chats = _config.disabled_plugin_on_chat
-- Table exists and chat has disabled plugins
if disabled_chats and disabled_chats[receiver] then
-- Checks if plugin is disabled on this chat
for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
if disabled_plugin == plugin_name and disabled then
local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
print(warning)
send_msg(receiver, warning, ok_cb, false)
return true
end
end
end
return false
end
function match_plugin(plugin, plugin_name, msg)
local receiver = get_receiver(msg)
-- Go over patterns. If one matches it's enough.
for k, pattern in pairs(plugin.patterns) do
local matches = match_pattern(pattern, msg.text)
if matches then
print("msg matches: ", pattern)
if is_plugin_disabled_on_chat(plugin_name, receiver) then
return nil
end
-- Function exists
if plugin.run then
-- If plugin is for privileged users only
if not warns_user_not_allowed(plugin, msg) then
local result = plugin.run(msg, matches)
if result then
send_large_msg(receiver, result)
end
end
end
-- One patterns matches
return
end
end
end
-- DEPRECATED, use send_large_msg(destination, text)
function _send_msg(destination, text)
send_large_msg(destination, text)
end
-- Save the content of _config to config.lua
function save_config( )
serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua')
end
-- Returns the config from config.lua file.
-- If file doesn't exist, create it.
function load_config( )
local f = io.open('./data/config.lua', "r")
-- If config.lua doesn't exist
if not f then
print ("Created new config file: data/config.lua")
create_config()
else
f:close()
end
local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do
print("Allowed user: " .. user)
end
return config
end
-- Create a basic config.json file and saves it.
function create_config( )
-- A simple config with basic plugins and ourselves as privileged user
config = {
enabled_plugins = {
"onservice",
"inrealm",
"spammer",
"sudoers",
"webshot",
"anti_spam",
"arabic_lock",
"addplug",
"ingroup",
"inpm",
"plugins",
"banhammer",
"Boobs",
"Feedback",
"plugins",
"lock_join",
"antilink",
"antitag",
"gps",
"auto_leave",
"cpu",
"calc",
"bin",
"block",
"tagall",
"text",
"info",
"bot_on_off",
"welcome",
"webshot",
"google",
"auto_leave",
"calc",
"hackernews",
"sms",
"anti_spam",
"add_bot",
"owners",
"set",
"get",
"broadcast",
"download_media",
"invite",
"all",
"leave_ban"
},
sudo_users = {172178919},--Sudo users
disabled_channels = {},
moderation = {data = 'data/moderation.json'},
about_text = [[Creed bot 2.3
Hello my Good friends
‼️ this bot is made by : @creed_is_dead
〰〰〰〰〰〰〰〰
ߔࠀ our admins are :
ߔࠀ @sorblack_creed
ߔࠀ @aCobrA_ice
ߔࠀ @aria_creed
〰〰〰〰〰〰〰〰
♻️ You can send your Ideas and messages to Us By sending them into bots account by this command :
تمامی درخواست ها و همه ی انتقادات و حرفاتونو با دستور زیر بفرستین به ما
!feedback (your ideas and messages)
]],
help_text_realm = [[
Realm Commands:
!creategroup [Name]
Create a group
گروه جدیدی بسازید
!createrealm [Name]
Create a realm
گروه مادر جدیدی بسازید
!setname [Name]
Set realm name
اسم گروه مادر را تغییر بدهید
!setabout [GroupID] [Text]
Set a group,s about text
در مورد آن گروه توضیحاتی را بنویسید (ای دی گروه را بدهید )
!setrules [GroupID] [Text]
Set a groups rules
در مورد آن گروه قوانینی تعیین کنید ( ای دی گروه را بدهید )
!lock [GroupID] [setting]
Lock a group's setting
تنظیکات گروهی را قفل بکنید
!unlock [GroupID] [setting]
Unock a group's setting
تنظیمات گروهی را از قفل در بیاورید
!wholist
Get a list of members in group/realm
لیست تمامی اعضای گروه رو با ای دی شون نشون میده
!who
Get a file of members in group/realm
لیست تمامی اعضای گروه را با ای دی در فایل متنی دریافت کنید
!type
Get group type
در مورد نقش گروه بگیرید
!kill chat [GroupID]
Kick all memebers and delete group ⛔️⛔️
⛔️تمامی اعضای گروه را حذف میکند ⛔️
!kill realm [RealmID]
Kick all members and delete realm⛔️⛔️
تمامی اعضای گروه مارد را حذف میکند
!addadmin [id|username]
Promote an admin by id OR username *Sudo only
ادمینی را اضافه بکنید
!removeadmin [id|username]
Demote an admin by id OR username *Sudo only❗️❗️
❗️❗️ادمینی را با این دستور صلب مقام میکنید ❗️❗️
!list groups
Get a list of all groups
لیست تمامی گروه هارو میده
!list realms
Get a list of all realms
لیست گروه های مادر را میدهد
!log
Get a logfile of current group or realm
تمامی عملیات گروه را میدهد
!broadcast [text]
Send text to all groups ✉️
✉️ با این دستور به تمامی گروه ها متنی را همزمان میفرستید .
!br [group_id] [text]
This command will send text to [group_id]✉️
با این دستور میتونید به گروه توسط ربات متنی را بفرستید
You Can user both "!" & "/" for them
میتوانید از هردوی کاراکتر های ! و / برای دستورات استفاده کنید
]],
help_text = [[
bots Help for mods : Plugins
Banhammer :
Help For Banhammer دستوراتی برای کنترل گروه
!Kick @UserName or ID
شخصی را از گروه حذف کنید . همچنین با ریپلی هم میشه
!Ban @UserName or ID
برای بن کردن شخص اسفاده میشود . با ریپلی هم میشه
!Unban @UserName
برای آنبن کردن شخصی استفاده میشود . همچنین با ریپلی هم میشه
For Admins :
!banall ID
برای بن گلوبال کردن از تمامی گروه هاست باید ای دی بدین با ریپلی هم میشه
!unbanall ID
برای آنبن کردن استفاده میشود ولی فقط با ای دی میشود
〰〰〰〰〰〰〰〰〰〰
2. GroupManager :
!lock leave
اگر کسی از گروه برود نمیتواند برگردد
!lock tag
برای مجوز ندادن به اعضا از استفاده کردن @ و # برای تگ
!Creategp "GroupName"
you can Create group with this comman
با این دستور برای ساخت گروه استفاده بکنید
!lock member
For locking Inviting users
برای جلوگیری از آمدن اعضای جدید استفاده میشود
!lock bots
for Locking Bots invitation
برای جلوگیری از ادد کردن ربا استفاده میشود
!lock name ❤️
To lock the group name for every bodey
برای قفل کردن اسم استفاده میشود
!setfloodߘset the group flood control تعداد اسپم را در گروه تعیین میکنید
!settings ❌
Watch group settings
تنظیمات فعلی گروه را میبینید
!owner
watch group owner
آیدی سازنده گروه رو میبینید
!setowner user_id❗️
You can set someone to the group owner‼️
برای گروه سازنده تعیین میکنید
!modlist
catch Group mods
لیست مدیران گروه را میگیرید
!lock join
to lock joining the group by link
برای جلوگیری از وارد شدن به کروه با لینک
!lock flood⚠️
lock group flood
از اسپم دادن در گروه جلوگیری کنید
!unlock (bots-member-flood-photo-name-tag-link-join-Arabic)✅
Unlock Something
موارد بالا را با این دستور آزاد میسازید
!rules && !set rules
TO see group rules or set rules
برای دیدن قوانین گروه و یا انتخاب قوانین
!about or !set about
watch about group or set about
در مورد توضیحات گروه میدهد و یا توضیحات گروه رو تعیین کنید
!res @username
see Username INfo
در مورد اسم و ای دی شخص بهتون میده
!who♦️
Get Ids Chat
همه ی ای دی های موجود در چت رو بهتون میده
!log
get members id ♠️
تمامی فعالیت های انجام یافته توسط شما و یا مدیران رو نشون میده
!all
Says every thing he knows about a group
در مورد تمامی اطلاعات ثبت شده در مورد گروه میدهد
!newlink
Changes or Makes new group link
لینک گروه رو عوض میکنه
!link
gets The Group link
لینک گروه را در گروه نمایش میده
!linkpv
sends the group link to the PV
برای دریافت لینک در پیوی استفاده میشه
〰〰〰〰〰〰〰〰
Admins :®
!add
to add the group as knows
برای مجوز دادن به ربات برای استفاده در گروه
!rem
to remove the group and be unknown
برای ناشناس کردن گروه برای ربات توسط مدیران اصلی
!setgpowner (Gpid) user_id ⚫️
For Set a Owner of group from realm
برای تعیین سازنده ای برای گروه از گروه مادر
!addadmin [Username]
to add a Global admin to the bot
برای ادد کردن ادمین اصلی ربات
!removeadmin [username]
to remove an admin from global admins
برای صلب ادمینی از ادمینای اصلی
!plugins - [plugins]
To Disable the plugin
برای غیر فعال کردن پلاگین توسط سازنده
!plugins + [plugins]
To enable a plugins
برای فعال کردن پلاگین توسط سازنده
!plugins ?
To reload al plugins
برای تازه سازی تمامی پلاگین های فعال
!plugins
Shows the list of all plugins
لیست تمامی پلاگین هارو نشون میده
!sms [id] (text)
To send a message to an account by his/her ID
برای فرستادن متنی توسط ربات به شخصی با ای دی اون
〰〰〰〰〰〰〰〰〰〰〰
3.!stats
To see the group stats
برای دیدن آمار گروه
〰〰〰〰〰〰〰〰
4. Feedback⚫️
!feedback (text)
To send your ideas to the Moderation group
برای فرستادن انتقادات و پیشنهادات و حرف خود با مدیر ها استفاده میشه
〰〰〰〰〰〰〰〰〰〰〰
5. Tagall◻️
!tagall (text)
To tags the every one and sends your message at bottom
تگ کردن همه ی اعضای گروه و نوشتن پیام شما زیرش
You Can user both "!" & "/" for them
می توانید از دو شکلک ! و / برای دادن دستورات استفاده کنید
]]
}
serialize_to_file(config, './data/config.lua')
print('saved config into ./data/config.lua')
end
function on_our_id (id)
our_id = id
end
function on_user_update (user, what)
--vardump (user)
end
function on_chat_update (chat, what)
end
function on_secret_chat_update (schat, what)
--vardump (schat)
end
function on_get_difference_end ()
end
-- Enable plugins in config.json
function load_plugins()
for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v)
local ok, err = pcall(function()
local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t
end)
if not ok then
print('\27[31mError loading plugin '..v..'\27[39m')
print('\27[31m'..err..'\27[39m')
end
end
end
-- custom add
function load_data(filename)
local f = io.open(filename)
if not f then
return {}
end
local s = f:read('*all')
f:close()
local data = JSON.decode(s)
return data
end
function save_data(filename, data)
local s = JSON.encode(data)
local f = io.open(filename, 'w')
f:write(s)
f:close()
end
-- Call and postpone execution for cron plugins
function cron_plugins()
for name, plugin in pairs(plugins) do
-- Only plugins with cron function
if plugin.cron ~= nil then
plugin.cron()
end
end
-- Called again in 2 mins
postpone (cron_plugins, false, 120)
end
-- Start and load values
our_id = 0
now = os.time()
math.randomseed(now)
started = false
| gpl-2.0 |
wcjscm/JackGame | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/ComAttribute.lua | 19 | 2639 |
--------------------------------
-- @module ComAttribute
-- @extend Component
-- @parent_module ccs
--------------------------------
--
-- @function [parent=#ComAttribute] getFloat
-- @param self
-- @param #string key
-- @param #float def
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#ComAttribute] getString
-- @param self
-- @param #string key
-- @param #string def
-- @return string#string ret (return value: string)
--------------------------------
--
-- @function [parent=#ComAttribute] setFloat
-- @param self
-- @param #string key
-- @param #float value
-- @return ComAttribute#ComAttribute self (return value: ccs.ComAttribute)
--------------------------------
--
-- @function [parent=#ComAttribute] setString
-- @param self
-- @param #string key
-- @param #string value
-- @return ComAttribute#ComAttribute self (return value: ccs.ComAttribute)
--------------------------------
--
-- @function [parent=#ComAttribute] getBool
-- @param self
-- @param #string key
-- @param #bool def
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#ComAttribute] setInt
-- @param self
-- @param #string key
-- @param #int value
-- @return ComAttribute#ComAttribute self (return value: ccs.ComAttribute)
--------------------------------
--
-- @function [parent=#ComAttribute] parse
-- @param self
-- @param #string jsonFile
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#ComAttribute] getInt
-- @param self
-- @param #string key
-- @param #int def
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#ComAttribute] setBool
-- @param self
-- @param #string key
-- @param #bool value
-- @return ComAttribute#ComAttribute self (return value: ccs.ComAttribute)
--------------------------------
--
-- @function [parent=#ComAttribute] create
-- @param self
-- @return ComAttribute#ComAttribute ret (return value: ccs.ComAttribute)
--------------------------------
--
-- @function [parent=#ComAttribute] createInstance
-- @param self
-- @return Ref#Ref ret (return value: cc.Ref)
--------------------------------
--
-- @function [parent=#ComAttribute] init
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#ComAttribute] serialize
-- @param self
-- @param #void r
-- @return bool#bool ret (return value: bool)
return nil
| gpl-3.0 |
CYBORGAN/antispam | plugins/ingroup.lua | 10 | 53916 | do
-- Check Member
local function check_member_autorealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_join = 'no',
antilink = 'yes',
lock_name = 'yes',
lock_arabic = 'no',
lock_photo = 'yes',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'به گروه مادری خوش امدید')
end
end
end
local function check_member_realm_add(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Realm',
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_join = 'no',
antilink = 'yes',
lock_name = 'yes',
lock_arabic = 'no',
lock_photo = 'yes',
lock_member = 'no',
flood = 'yes'
}
}
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'گروه مادری اضافه شد')
end
end
end
function check_member_group(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_join = 'no',
antilink = 'yes',
lock_name = 'yes',
lock_arabic = 'no',
lock_photo = 'yes',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'شما مدیر شدید')
end
end
end
local function check_member_modadd(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration
data[tostring(msg.to.id)] = {
group_type = 'Group',
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.print_name, '_', ' '),
lock_join = 'no',
antilink = 'yes',
lock_name = 'yes',
lock_arabic = 'no',
lock_photo = 'yes',
lock_member = 'no',
flood = 'yes',
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'گروه اضافه شد و شما مدیر شدید')
end
end
end
local function automodadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_group,{receiver=receiver, data=data, msg = msg})
end
end
local function autorealmadd(msg)
local data = load_data(_config.moderation.data)
if msg.action.type == 'chat_created' then
receiver = get_receiver(msg)
chat_info(receiver, check_member_autorealm,{receiver=receiver, data=data, msg = msg})
end
end
local function check_member_realmrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Realm configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local realms = 'realms'
if not data[tostring(realms)] then
data[tostring(realms)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(realms)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'این گروه مادری حذف شد و ربات این گروه را به رسمیت نمیشناسد')
end
end
end
local function check_member_modrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result.members) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, 'این گروه حذف شد و ربات این گروه را به رسمیت نمیشناسد')
end
end
end
--End Check Member
local function show_group_settingsmod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
local bots_protection = "Yes"
if data[tostring(msg.to.id)]['settings']['lock_bots'] then
bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots']
end
local leave_ban = "no"
if data[tostring(msg.to.id)]['settings']['leave_ban'] then
leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
end
local settings = data[tostring(target)]['settings']
local text ="Group settings:\n•••Lock group join with link ⛔️: "..settings.lock_join.."\n•••Lock group ads 🛂 : "..settings.antilink.."\n•••Lock group name 🔤: "..settings.lock_name.."\n•••Lock group photo 🖼 : "..settings.lock_photo.."\n•••Lock new member 🚷 : "..settings.lock_member.."\n•••Lock group leave ban ❌: "..leave_ban.."\n•••set flood on 🔣: "..NUM_MSG_MAX.."\n•••Bot security 👾 : "..bots_protection.." •••Nod32 edited version v6 ͡° ͜ʖ ͡°"--bot nod 32 version 6 opened by @behroozyaghi
return text
end
local function set_descriptionmod(msg, data, target, about)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local data_cat = 'description'
data[tostring(target)][data_cat] = about
save_data(_config.moderation.data, data)
return 'توضیحات گروه تغییر داده شد به\n'..about
end
local function get_description(msg, data)
local data_cat = 'description'
if not data[tostring(msg.to.id)][data_cat] then
return 'هیچ توضیحی برای این گروه تعریف نشده است'
end
local about = data[tostring(msg.to.id)][data_cat]
local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about
return 'About '..about
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'چت ممنوع فعال شد و اگر کسی در این گروه حرف بزند اخراج میشود'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'چت ممنوع فعال شد و اگر کسی در این گروه حرف بزند اخراج میشود'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'چت ممنوع غیرفعال شد'
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'چت ممنوع غیرفعال شد'
end
end
local function lock_group_bots(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'yes' then
return 'ورود ربات ها ممنوع شد'
else
data[tostring(target)]['settings']['lock_bots'] = 'yes'
save_data(_config.moderation.data, data)
return 'ورود ربات ها ممنوع شد'
end
end
local function unlock_group_bots(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_bots_lock = data[tostring(target)]['settings']['lock_bots']
if group_bots_lock == 'no' then
return 'ورود ربات ها ازاد شد'
else
data[tostring(target)]['settings']['lock_bots'] = 'no'
save_data(_config.moderation.data, data)
return 'ورود ربات ها ازاد شد'
end
end
local function lock_group_tag(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
end
local function unlock_group_tag(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
end
local function lock_group_join(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_join_lock = data[tostring(target)]['settings']['lock_join']
if group_join_lock == 'yes' then
return 'ممنوع شدن ورود اعضا با لینک فعال شد'
else
data[tostring(target)]['settings']['lock_join'] = 'yes'
save_data(_config.moderation.data, data)
return 'ممنوع شدن ورود اعضا با لینک فعال شد'
end
end
local function unlock_group_join(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_join_lock = data[tostring(target)]['settings']['lock_join']
if group_join_lock == 'no' then
return 'ممنوع بودن ورود اعضا با لینک غیرفعال شد'
else
data[tostring(target)]['settings']['lock_join'] = 'no'
save_data(_config.moderation.data, data)
return 'ممنوع بودن ورود اعضا با لینک غیرفعال شد'
end
end
local function lock_group_link(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_link_lock = data[tostring(target)]['settings']['antilink']
if group_link_lock == 'yes' then
return 'انتی لینک فعال شد'
else
data[tostring(target)]['settings']['antilink'] = 'yes'
save_data(_config.moderation.data, data)
return 'انتی لینک فعال شد'
end
end
local function unlock_group_link(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_link_lock = data[tostring(target)]['settings']['antilink']
if group_link_lock == 'no' then
return 'انتی لینک غیرفعال شد'
else
data[tostring(target)]['settings']['antilink'] = 'no'
save_data(_config.moderation.data, data)
return 'انتی لینک غیرفعال شد'
end
end
local function lock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'yes' then
return 'اسم گروه قفل شد و کسی جز مدیر و ادمین قادر به تغییر ان نیست'
else
data[tostring(target)]['settings']['lock_name'] = 'yes'
save_data(_config.moderation.data, data)
rename_chat('chat#id'..target, group_name_set, ok_cb, false)
return 'اسم گروه قفل شد و کسی جز مدیر و ادمین قادر به تغییر ان نیست'
end
end
local function unlock_group_namemod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_name_set = data[tostring(target)]['settings']['set_name']
local group_name_lock = data[tostring(target)]['settings']['lock_name']
if group_name_lock == 'no' then
return 'قفل اسم گروه غیر فعال شد'
else
data[tostring(target)]['settings']['lock_name'] = 'no'
save_data(_config.moderation.data, data)
return 'قفل اسم گروه غیر فعال شد'
end
end
local function lock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "فقط مدیر میتواند از این دستور استفاده کند"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
return 'حساسیت به اسپم گروه فعال شد'
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
return 'حساسیت به اسپم گروه فعال شد'
end
end
local function unlock_group_floodmod(msg, data, target)
if not is_owner(msg) then
return "فقط مدیر میتواند از این دستور استفاده کند"
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
return 'حساسیت به اسپم گروه غیرفعال شد'
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
return 'حساسیت به اسپم گروه غیرفعال شد'
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'ممنوعیت ورود اعضا فعال شد از این پس کسی نمیتواند عضو گروه شود'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'ممنوعیت ورود اعضا فعال شد از این پس کسی نمیتواند عضو گروه شود'
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'ممنوعیت ورود اعضا به گروه غیرفعال شد'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'ممنوعیت ورود اعضا به گروه غیرفعال شد'
end
end
local function set_public_membermod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'yes' then
return 'این گروه عمومی است'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'وضعیت گروه عمومی است'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_member_lock = data[tostring(target)]['settings']['public']
if group_member_lock == 'no' then
return 'این گروه خصوصی است'
else
data[tostring(target)]['settings']['public'] = 'no'
save_data(_config.moderation.data, data)
return 'وضعیت گروه خصوصی است'
end
end
local function lock_group_leave(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'yes' then
return 'خروج=بن فعال شد اگر کسی از گروه خارج شود دیگر قادر به ورود مجدد نیست'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'خروج=بن فعال شد اگر کسی از گروه خارج شود دیگر قادر به ورود مجدد نیست'
end
local function unlock_group_leave(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban']
if leave_ban == 'no' then
return 'خروج=بن غیرفعال شد'
else
data[tostring(msg.to.id)]['settings']['leave_ban'] = 'no'
save_data(_config.moderation.data, data)
return 'خروج=بن غیرفعال شد'
end
end
local function unlock_group_photomod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_photo_lock = data[tostring(target)]['settings']['lock_photo']
if group_photo_lock == 'no' then
return 'قفل عکس گرو غیرفعال شد'
else
data[tostring(target)]['settings']['lock_photo'] = 'no'
save_data(_config.moderation.data, data)
return 'قفل عکس گرو غیرفعال شد'
end
end
local function set_rulesmod(msg, data, target)
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
return 'قوانین تغییر داده شد به\n'..rules
end
local function modadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "مجاز برای سازنده ربات"
end
local data = load_data(_config.moderation.data)
if is_group(msg) then
return 'این گروه از قبل اضافه شده بود'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg})
end
local function realmadd(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "شما سازنده ربات نیستید پس نمیتوانید از این دستور استفاده کنید"
end
local data = load_data(_config.moderation.data)
if is_realm(msg) then
return 'این گروه مادری از قبل اضافه شده بود'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realm_add,{receiver=receiver, data=data, msg = msg})
end
-- Global functions
function modrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "شما سازنده ربات نیستید پس نمیتوانید از این دستور استفاده کنید"
end
local data = load_data(_config.moderation.data)
if not is_group(msg) then
return 'این گروه به رسمیت شناخته نشده'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg})
end
function realmrem(msg)
-- superuser and admins only (because sudo are always has privilege)
if not is_admin(msg) then
return "شما سازنده ربات نیستید پس نمیتوانید از این دستور استفاده کنید"
end
local data = load_data(_config.moderation.data)
if not is_realm(msg) then
return 'این گروه مادری به رسمیت شناخته نشده'
end
receiver = get_receiver(msg)
chat_info(receiver, check_member_realmrem,{receiver=receiver, data=data, msg = msg})
end
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
return 'هیچ قانونی برای این گروه تعریف نشده است'
end
local rules = data[tostring(msg.to.id)][data_cat]
local rules = 'قوانین گروه\n'..rules
return rules
end
local function set_group_photo(msg, success, result)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
chat_set_photo (receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes'
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'عکس ذخیره و قفل شد', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'نشد.لطفا دوباره امتحان کنید', ok_cb, false)
end
end
local function promote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'این گروه به رسمیت شناخته نشده است')
end
if data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username..' این کاربر قبلا به لیست ادمین ها اضافه شده بود')
end
data[group]['moderators'][tostring(member_id)] = member_username
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username..'ادمین شد')
end
local function promote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'.. msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return promote(get_receiver(msg), member_username, member_id)
end
end
local function demote(receiver, member_username, member_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'chat#id', '')
if not data[group] then
return send_large_msg(receiver, 'این گروه به رسمیت شناخته نشده است')
end
if not data[group]['moderators'][tostring(member_id)] then
return send_large_msg(receiver, member_username.. 'کاربر مورد نظر از لیست ادمین ها حذف شد')
end
data[group]['moderators'][tostring(member_id)] = nil
save_data(_config.moderation.data, data)
return send_large_msg(receiver, member_username.. 'از ادمینی برکنار شد')
end
local function demote_by_reply(extra, success, result)
local msg = result
local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '')
if msg.from.username then
member_username = '@'..msg.from.username
else
member_username = full_name
end
local member_id = msg.from.id
if msg.to.type == 'chat' then
return demote(get_receiver(msg), member_username, member_id)
end
end
local function setowner_by_reply(extra, success, result)
local msg = result
local receiver = get_receiver(msg)
local data = load_data(_config.moderation.data)
local name_log = msg.from.print_name:gsub("_", " ")
data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] setted ["..msg.from.id.."] as owner")
local text = msg.from.print_name:gsub("_", " ").." این کاربر مدیر شد"
return send_large_msg(receiver, text)
end
local function promote_demote_res(extra, success, result)
--vardump(result)
--vardump(extra)
local member_id = result.id
local member_username = "@"..result.username
local chat_id = extra.chat_id
local mod_cmd = extra.mod_cmd
local receiver = "chat#id"..chat_id
if mod_cmd == 'promote' then
return promote(receiver, member_username, member_id)
elseif mod_cmd == 'demote' then
return demote(receiver, member_username, member_id)
end
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'این گروه به رسمیت شناخته نشده است'
end
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'هیچ ادمینی در گروه وجود ندارد'
end
local i = 1
local message = '\n لیست ادمین های گروه ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
local function callbackres(extra, success, result)
--vardump(result)
local user = result.id
local name = string.gsub(result.print_name, "_", " ")
local chat = 'chat#id'..extra.chatid
send_large_msg(chat, user..'\n'..name)
return user
end
local function help()
local help_text = tostring(_config.help_text)
return help_text
end
local function cleanmember(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user(v.id, result.id)
end
end
local function killchat(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function killrealm(cb_extra, success, result)
local receiver = cb_extra.receiver
local chat_id = "chat#id"..result.id
local chatname = result.print_name
for k,v in pairs(result.members) do
kick_user_any(v.id, result.id)
end
end
local function user_msgs(user_id, chat_id)
local user_info
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info = tonumber(redis:get(um_hash) or 0)
return user_info
end
local function kick_zero(cb_extra, success, result)
local chat_id = cb_extra.chat_id
local chat = "chat#id"..chat_id
local ci_user
local re_user
for k,v in pairs(result.members) do
local si = false
ci_user = v.id
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
for i = 1, #users do
re_user = users[i]
if tonumber(ci_user) == tonumber(re_user) then
si = true
end
end
if not si then
if ci_user ~= our_id then
if not is_momod2(ci_user, chat_id) then
chat_del_user(chat, 'user#id'..ci_user, ok_cb, true)
end
end
end
end
end
local function kick_inactive(chat_id, num, receiver)
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = user_msgs(user_id, chat_id)
local nmsg = user_info
if tonumber(nmsg) < tonumber(num) then
if not is_momod2(user_id, chat_id) then
chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true)
end
end
end
return chat_info(receiver, kick_zero, {chat_id = chat_id})
end
local function run(msg, matches)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
local name_log = user_print_name(msg.from)
local group = msg.to.id
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then
load_photo(msg.id, set_group_photo, msg)
end
end
if matches[1] == 'add' and not matches[2] then
if is_realm(msg) then
return 'اینجا قبلا گروه مادری بود'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added")
return modadd(msg)
end
if matches[1] == 'add' and matches[2] == 'realm' then
if is_group(msg) then
return 'اینجا قبلا به رسمیت شناخته شده بود'
end
print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm")
return realmadd(msg)
end
if matches[1] == 'rem' and not matches[2] then
print("group "..msg.to.print_name.."("..msg.to.id..") removed")
return modrem(msg)
end
if matches[1] == 'rem' and matches[2] == 'realm' then
print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm")
return realmrem(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then
return automodadd(msg)
end
if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then
return autorealmadd(msg)
end
if msg.to.id and data[tostring(msg.to.id)] then
local settings = data[tostring(msg.to.id)]['settings']
if matches[1] == 'chat_add_user' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_member_lock = settings.lock_member
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then
chat_del_user(chat, user, ok_cb, true)
elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then
return nil
elseif group_member_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_del_user' then
if not msg.service then
-- return "Are you trying to troll me?"
end
local user = 'user#id'..msg.action.user.id
local chat = 'chat#id'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user)
end
if matches[1] == 'chat_delete_photo' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then
if not msg.service then
return "Are you trying to troll me?"
end
local group_photo_lock = settings.lock_photo
if group_photo_lock == 'yes' then
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:incr(picturehash)
---
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
local picprotectionredis = redis:get(picturehash)
if picprotectionredis then
if tonumber(picprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(picprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id
redis:set(picturehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ")
chat_set_photo(receiver, settings.set_photo, ok_cb, false)
elseif group_photo_lock == 'no' then
return nil
end
end
if matches[1] == 'chat_rename' then
if not msg.service then
return "Are you trying to troll me?"
end
local group_name_set = settings.set_name
local group_name_lock = settings.lock_name
local to_rename = 'chat#id'..msg.to.id
if group_name_lock == 'yes' then
if group_name_set ~= tostring(msg.to.print_name) then
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:incr(namehash)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
local nameprotectionredis = redis:get(namehash)
if nameprotectionredis then
if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then
kick_user(msg.from.id, msg.to.id)
end
if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then
ban_user(msg.from.id, msg.to.id)
local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id
redis:set(namehash, 0)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ")
rename_chat(to_rename, group_name_set, ok_cb, false)
end
elseif group_name_lock == 'no' then
return nil
end
end
if matches[1] == 'setname' and is_momod(msg) then
local new_name = string.gsub(matches[2], '_', ' ')
data[tostring(msg.to.id)]['settings']['set_name'] = new_name
save_data(_config.moderation.data, data)
local group_name_set = data[tostring(msg.to.id)]['settings']['set_name']
local to_rename = 'chat#id'..msg.to.id
rename_chat(to_rename, group_name_set, ok_cb, false)
savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]")
end
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
return 'خب حالا عکس مورد نظر برای پروفایل گروه را بفرستید'
end
if matches[1] == 'promote' and not matches[2] then
if not is_owner(msg) then
return "فقط مدیر میتواند شخصی را ادمین این گروه کند"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, promote_by_reply, false)
end
end
if matches[1] == 'promote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "فقط مدیر میتواند شخصی را ادمین این گروه کند"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'promote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'demote' and not matches[2] then
if not is_owner(msg) then
return "فقط مدیر میتواند شخصی را ادمین این گروه کند"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, demote_by_reply, false)
end
end
if matches[1] == 'demote' and matches[2] then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
return "فقط مدیر میتواند شخصی را ادمین این گروه کند"
end
if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then
return "شما نمیتوانید خودتان را برکنار کنید"
end
local member = matches[2]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member)
local cbres_extra = {
chat_id = msg.to.id,
mod_cmd = 'demote',
from_id = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
return res_user(username, promote_demote_res, cbres_extra)
end
if matches[1] == 'modlist' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
end
if matches[1] == 'about' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description")
return get_description(msg, data)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'set' then
if matches[2] == 'rules' then
rules = matches[3]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] قوانین تغییر داده شد به ["..matches[3].."]")
return set_rulesmod(msg, data, target)
end
if matches[2] == 'about' then
local data = load_data(_config.moderation.data)
local target = msg.to.id
local about = matches[3]
savelog(msg.to.id, name_log.." ["..msg.from.id.."] توضیحات تغییر داده شد به ["..matches[3].."]")
return set_descriptionmod(msg, data, target, about)
end
end
if matches[1] == 'lock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ")
return lock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_floodmod(msg, data, target)
end
if matches[2] == 'chat' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked chat ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'botsbots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ")
return lock_group_bots(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ")
return lock_group_leave(msg, data, target)
end
if matches[2] == 'ads' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked ads ")
return lock_group_link(msg, data, target)
end
if matches[2] == 'join' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked joining link ")
return lock_group_join(msg, data, target)
end
end
if matches[1] == 'unlock' then
local target = msg.to.id
if matches[2] == 'name' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ")
return unlock_group_namemod(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
if matches[2] == 'photo' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ")
return unlock_group_photomod(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ")
return unlock_group_floodmod(msg, data, target)
end
if matches[2] == 'chat' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked chat ")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'ads' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked ads ")
return unlock_group_link(msg, data, target)
end
if matches[2] == 'botsbots' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ")
return unlock_group_bots(msg, data, target)
end
if matches[2] == 'join' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked joining link ")
return unlock_group_join(msg, data, target)
end
if matches[2] == 'leave' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ")
return unlock_group_leave(msg, data, target)
end
end
if matches[1] == 'settings' then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ")
return show_group_settingsmod(msg, data, target)
end
--[[if matches[1] == 'public' then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public")
return unset_public_membermod(msg, data, target)
end
end]]
if matches[1] == 'newlink' and not is_realm(msg) then
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local function callback (extra , success, result)
local receiver = 'chat#'..msg.to.id
if success == 0 then
return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.')
end
send_large_msg(receiver, "لینک جدید ساخته شد")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
local receiver = 'chat#'..msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] لینک گروه تغییر داده شد")
return export_chat_link(receiver, callback, true)
end
if matches[1] == 'link' then
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "اول باید لینک جدید ایجاد کنید /newlink"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
return "لینک گروه\n"..group_link
end
if matches[1] == 'linkpv' then
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
return "اول باید لینک جدید ایجاد کنید /newlink"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
send_large_msg('user#id'..msg.from.id, "لینک گروه:\n"..group_link)
end
if matches[1] == 'setowner' and matches[2] then
if not is_owner(msg) then
return "این دستور فقط برای مدیر مجاز است"
end
data[tostring(msg.to.id)]['set_owner'] = matches[2]
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = matches[2].." این کاربر مدیر شد"
return text
end
if matches[1] == 'setowner' and not matches[2] then
if not is_owner(msg) then
return "این دستور فقط برای مدیر مجاز است"
end
if type(msg.reply_id)~="nil" then
msgr = get_message(msg.reply_id, setowner_by_reply, false)
end
end
if matches[1] == 'owner' then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
return "no owner,ask admins in support groups to set owner for your group"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
return "Group owner is ["..group_owner..']'
end
if matches[1] == 'setgpowner' then
local receiver = "chat#id"..matches[2]
if not is_admin(msg) then
return "این دستور فقط برای مدیر مجاز است"
end
data[tostring(matches[2])]['set_owner'] = matches[3]
save_data(_config.moderation.data, data)
local text = matches[3].." کاربر مورد نظر مدیر ارشد گروه شد"
send_large_msg(receiver, text)
return
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return "این دستور را فقط مدیر و ادمین ها میتوانند استفاده کنند"
end
if tonumber(matches[2]) < 3 or tonumber(matches[2]) > 40 then
return "اشتباه است اعداد انتخوابی باید بین 3 تا 40 باشد"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
return 'حساسیت اسپم تنظیم شد روی '..matches[2]
end
if matches[1] == 'clean' then
if not is_owner(msg) then
return "فقط مدیر قادر به پاک کردن همه اعضا است. توجه کنید اگر از این دستور استفاده کنید همه اعضا پاک میشوند"
end
if matches[2] == 'member' then
if not is_owner(msg) then
return "فقط مدیر قادر به پاک کردن همه اعضا است. توجه کنید اگر از این دستور استفاده کنید همه اعضا پاک میشوند"
end
local receiver = get_receiver(msg)
chat_info(receiver, cleanmember, {receiver=receiver})
end
if matches[2] == 'modlist' then
if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way
return 'هیچ ادمینی در این گروه وجود ندارد'
end
local message = '\n لیست ادمین های گروه ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
end
if matches[2] == 'rules' then
local data_cat = 'rules'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
end
if matches[2] == 'about' then
local data_cat = 'description'
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
end
end
if matches[1] == 'kill' and matches[2] == 'chat' then
if not is_admin(msg) then
return nil
end
if not is_realm(msg) then
local receiver = get_receiver(msg)
return modrem(msg),
print("Closing Group..."),
chat_info(receiver, killchat, {receiver=receiver})
else
return 'اینجا گروه مادری است'
end
end
if matches[1] == 'kill' and matches[2] == 'realm' then
if not is_admin(msg) then
return nil
end
if not is_group(msg) then
local receiver = get_receiver(msg)
return realmrem(msg),
print("Closing Realm..."),
chat_info(receiver, killrealm, {receiver=receiver})
else
return 'اینجا گروه است'
end
end
if matches[1] == 'help' then
if not is_momod(msg) or is_realm(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help")
return help()
end
if matches[1] == 'res' and is_momod(msg) then
local cbres_extra = {
chatid = msg.to.id
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username)
return res_user(username, callbackres, cbres_extra)
end
if matches[1] == 'kickinactive' then
--send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]')
if not is_momod(msg) then
return 'فقط مدیر میتواند اقدام به پاک کردن اعضا غیرفعال کند'
end
local num = 1
if matches[2] then
num = matches[2]
end
local chat_id = msg.to.id
local receiver = get_receiver(msg)
return kick_inactive(chat_id, num, receiver)
end
end
end
return {
patterns = {
"^[!/](add)$",
"^[!/](add) (realm)$",
"^[!/](rem)$",
"^[!/](rem) (realm)$",
"^[!/](rules)$",
"^[!/](about)$",
"^[!/](setname) (.*)$",
"^[!/](setphoto)$",
"^[!/](promote) (.*)$",
"^[!/](promote)",
"^[!/](help)$",
"^[!/](clean) (.*)$",
"^[!/](kill) (chat)$",
"^[!/](kill) (realm)$",
"^[!/](demote) (.*)$",
"^[!/](demote)",
"^[!/](set) ([^%s]+) (.*)$",
"^[!/](lock) (.*)$",
"^[!/](setowner) (%d+)$",
"^[!/](setowner)",
"^[!/](owner)$",
"^[!/](res) (.*)$",
"^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^[!/](unlock) (.*)$",
"^[!/](setflood) (%d+)$",
"^[!/](settings)$",
"^[!/](public) (.*)$",
"^[!/](modlist)$",
"^[!/](newlink)$",
"^[!/](link)$",
"^[!/](linkpv)$",
"^[!/](kickinactive)$",
"^[!/](kickinactive) (%d+)$",
"^([Aa]dd)$",
"^([Rr]em)$",
"^([Rr]ules)$",
"^({Aa]bout)$",
"^([Ss]etname) (.*)$",
"^([Ss]etphoto)$",
"^([Pp]romote) (.*)$",
"^([Pp]romote)$",
"^([Hh]elp)$",
"^([Cc]lean) (.*)$",
"^([Dd]emote) (.*)$",
"^([Dd]emote)$",
"^([Ss]et) ([^%s]+) (.*)$",
"^([Ll]ock) (.*)$",
"^([Ss]etowner) (%d+)$",
"^([Ss]etowner)$",
"^([Oo]wner)$",
"^([Rr]es) (.*)$",
"^([Ss]etgpowner) (%d+) (%d+)$",-- (group id) (owner id)
"^([Uu]nlock) (.*)$",
"^([Ss]etflood) (%d+)$",
"^([Ss]ettings)$",
"^([Mm]odlist)$",
"^([Nn]ewlink)$",
"^([Ll]ink)$",
"%[(photo)%]",
"^!!tgservice (.+)$",
},
run = run
}
end
--Copyright and edit; @behroozyaghi
--Persian Translate; @behroozyaghi
--ch : @nod32team
--کپی بدون ذکر منبع حرام است
| gpl-2.0 |
kjoenth/naev | dat/factions/standing/skel.lua | 4 | 5025 | --[[
Simple skeleton for your standard faction. This is more or less what the
standard behaviour can be, but from here you can let your imagination go
wild.
--]]
-- Faction caps.
_fcap_kill = 20 -- Kill cap
_fdelta_distress = {-1, 0} -- Maximum change constraints
_fdelta_kill = {-5, 1} -- Maximum change constraints
_fcap_misn = 30 -- Starting mission cap, gets overwritten
_fcap_misn_var = nil -- Mission variable to use for limits
_fcap_mod_sec = 0.3 -- Modulation from secondary
lang = naev.lang()
_fstanding_names = {}
if lang == "es" then
else -- Default English
_fstanding_names[100] = "Legend"
_fstanding_names[90] = "Hero"
_fstanding_names[70] = "Comrade"
_fstanding_names[50] = "Ally"
_fstanding_names[30] = "Partner"
_fstanding_names[10] = "Associate"
_fstanding_names[0] = "Neutral"
_fstanding_names[-1] = "Outlaw"
_fstanding_names[-30] = "Criminal"
_fstanding_names[-50] = "Enemy"
end
--[[
@brief Clamps a value x between low and high.
--]]
function clamp( low, high, x )
return math.max( low, math.min( high, x ) )
end
--[[
@brief Linearly interpolates x between x1,y1 and x2,y2
--]]
function lerp( x, x1, y1, x2, y2 )
local m = (y1-y2)/(x1-x2)
local b = y1-m*x1
return m*x + b
end
--[[
@brief Same as lerp but clamps to [0,1].
--]]
function clerp( x, x1, y1, x2, y2 )
return clamp( 0, 1, lerp( x, x1, y1, x2, y2 ) )
end
--[[
@brief Duplicates a table to avoid clobbering.
--]]
function clone(t)
local new = {}
for k, v in pairs(t) do
new[k] = v
end
return new
end
--[[
@brief Handles a faction hit for a faction.
Possible sources:
- "kill" : Pilot death.
- "distress" : Pilot distress signal.
- "script" : Either a mission or an event.
@param current Current faction player has.
@param amount Amount of faction being changed.
@param source Source of the faction hit.
@param secondary Flag that indicates whether this is a secondary (through ally or enemy) hit.
@return The faction amount to set to.
--]]
function default_hit( current, amount, source, secondary )
-- Comfort macro
local f = current
local delta = {-200, 200}
-- Set caps and/or deltas based on source
local cap
local mod = 1
if source == "distress" then
delta = clone(_fdelta_distress)
-- Ignore positive distresses
if amount > 0 then
return f
end
elseif source == "kill" then
cap = _fcap_kill
delta = clone(_fdelta_kill)
else
if _fcap_misn_var == nil then
cap = _fcap_misn
else
cap = var.peek( _fcap_misn_var )
if cap == nil then
cap = _fcap_misn
var.push( _fcap_misn_var, cap )
end
end
end
-- Adjust for secondary hit
if secondary then mod = mod * _fcap_mod_sec end
amount = mod * amount
delta[1] = mod * delta[1]
delta[2] = mod * delta[2]
-- Faction gain
if amount > 0 then
-- Must be under cap
if f < cap then
if source == "kill" then
local has_planet
-- Positive kill, which means an enemy of this faction got killed.
-- We need to check if this happened in the faction's territory, otherwise it doesn't count.
-- NOTE: virtual assets are NOT counted when determining territory!
for _, planet in ipairs(system.cur():planets()) do
if planet:faction() == _fthis then
-- Planet belonging to this faction found. Modify reputation.
f = math.min( cap, f + math.min(delta[2], amount * clerp( f, 0, 1, cap, 0.2 )) )
has_planet = true
break
end
end
local witness = pilot.get( { _fthis } )
if not has_planet and witness then
for _, pilot in ipairs(witness) do
if player.pilot():pos():dist( pilot:pos() ) < 5000 then
-- Halve impact relative to a normal secondary hit.
f = math.min( cap, f + math.min(delta[2], amount * 0.5 * clerp( f, 0, 1, cap, 0.2 )) )
break
end
end
end
else
-- Script induced change. No diminishing returns on these.
f = math.min( cap, f + math.min(delta[2], amount) )
end
end
-- Faction loss.
else
-- No diminishing returns on loss.
f = math.max( -100, f + math.max(delta[1], amount) )
end
return f
end
--[[
@brief Returns a text representation of the player's standing.
@param standing Current standing of the player.
@return The text representation of the current standing.
--]]
function faction_standing_text( standing )
for i = math.floor( standing ), 0, ( standing < 0 and 1 or -1 ) do
if _fstanding_names[i] ~= nil then
return _fstanding_names[i]
end
end
return _fstanding_names[0]
end
| gpl-3.0 |
pydsigner/naev | dat/missions/pirate/hitman.lua | 5 | 4501 | --[[
Pirate Hitman
Corrupt Merchant wants you to destroy competition
Author: nloewen
--]]
-- Localization, choosing a language if naev is translated for non-english-speaking locales.
lang = naev.lang()
if lang == "es" then
else -- Default to English
-- Bar information
bar_desc = "You see a shifty looking man sitting in a darkened corner of the bar. He is trying to discreetly motion you to join him, but is only managing to make himself look suspicious. Perhaps he's watched too many holovideos."
-- Mission details
misn_title = "Pirate Hitman"
misn_reward = "Some easy money." -- Possibly some hard to get contraband once it is introduced
misn_desc = {}
misn_desc[1] = "Chase away merchant competition in the %s system."
misn_desc[2] = "Return to %s in the %s system for payment."
-- Text
title = {}
text = {}
title[1] = "Spaceport Bar"
text[1] = [[The man motions for you to take a seat next to him. Voice barely above a whisper, he asks, "How'd you like to earn some easy money? If you're comfortable with getting your hands dirty, that is."]]
title[3] = "Mission Complete"
text[2] = [[Apparently relieved that you've accepted his offer, he continues, "There're some new merchants edging in on my trade routes in %s. I want you to make sure they know they're not welcome." Pausing for a moment, he notes, "You don't have to kill anyone, just rough them up a bit."]]
text[3] = [[As you inform your acquaintance that you successfully scared off the traders, he grins. After transferring the payment, he comments, "That should teach them to stay out of my space."]]
-- Messages
msg = {}
msg[1] = "MISSION SUCCESS! Return for payment."
end
function create ()
-- Note: this mission does not make any system claims.
targetsystem = system.get("Delta Pavonis") -- Find target system
-- Spaceport bar stuff
misn.setNPC( "Shifty Trader", "neutral/unique/shifty_merchant")
misn.setDesc( bar_desc )
end
--[[
Mission entry point.
--]]
function accept ()
-- Mission details:
if not tk.yesno( title[1], string.format( text[1],
targetsystem:name() ) ) then
misn.finish()
end
misn.accept()
-- Some variables for keeping track of the mission
misn_done = false
attackedTraders = {}
attackedTraders["__save"] = true
fledTraders = 0
misn_base, misn_base_sys = planet.cur()
-- Set mission details
misn.setTitle( string.format( misn_title, targetsystem:name()) )
misn.setReward( string.format( misn_reward, credits) )
misn.setDesc( string.format( misn_desc[1], targetsystem:name() ) )
misn_marker = misn.markerAdd( targetsystem, "low" )
misn.osdCreate(misn_title, {misn_desc[1]:format(targetsystem:name())})
-- Some flavour text
tk.msg( title[1], string.format( text[2], targetsystem:name()) )
-- Set hooks
hook.enter("sys_enter")
end
-- Entering a system
function sys_enter ()
cur_sys = system.cur()
-- Check to see if reaching target system
if cur_sys == targetsystem then
hook.pilot(nil, "attacked", "trader_attacked")
hook.pilot(nil, "jump", "trader_jumped")
end
end
-- Attacked a trader
function trader_attacked (hook_pilot, hook_attacker, hook_arg)
if misn_done then
return
end
if hook_pilot:faction() == faction.get("Trader") and hook_attacker == pilot.player() then
attackedTraders[#attackedTraders + 1] = hook_pilot
end
end
-- An attacked Trader Jumped
function trader_jumped (hook_pilot, hook_arg)
if misn_done then
return
end
for i, array_pilot in ipairs(attackedTraders) do
if array_pilot:exists() then
if array_pilot == hook_pilot then
fledTraders = fledTraders + 1
if fledTraders >= 5 then
attack_finished()
end
end
end
end
end
-- attack finished
function attack_finished()
if misn_done then
return
end
misn_done = true
player.msg( msg[1] )
misn.setDesc( string.format( misn_desc[2], misn_base:name(), misn_base_sys:name() ) )
misn.markerRm( misn_marker )
misn_marker = misn.markerAdd( misn_base_sys, "low" )
misn.osdCreate(misn_title, {misn_desc[2]:format(misn_base:name(), misn_base_sys:name())})
hook.land("landed")
end
-- landed
function landed()
if planet.cur() == misn_base then
tk.msg(title[3], text[3])
player.pay(45000)
faction.modPlayerSingle("Pirate",5)
misn.finish(true)
end
end
| gpl-3.0 |
salorium/awesome | spec/gears/cache_spec.lua | 22 | 1875 | ---------------------------------------------------------------------------
-- @author Uli Schlachter
-- @copyright 2015 Uli Schlachter
---------------------------------------------------------------------------
local cache = require("gears.cache")
describe("gears.cache", function()
-- Make sure no cache is cleared during the tests
before_each(function()
collectgarbage("stop")
end)
after_each(function()
collectgarbage("restart")
end)
describe("Zero arguments", function()
it("Creation cb is called", function()
local called = false
local c = cache(function()
called = true
end)
local res = c:get()
assert.is_nil(res)
assert.is_true(called)
end)
end)
describe("Two arguments", function()
it("Cache works", function()
local num_calls = 0
local c = cache(function(a, b)
num_calls = num_calls + 1
return a + b
end)
local res1 = c:get(1, 2)
local res2 = c:get(1, 3)
local res3 = c:get(1, 2)
assert.is.equal(res1, 3)
assert.is.equal(res2, 4)
assert.is.equal(res3, 3)
assert.is.equal(num_calls, 2)
end)
it("Cache invalidation works", function()
local num_calls = 0
local c = cache(function(a, b)
num_calls = num_calls + 1
return a + b
end)
local res1 = c:get(1, 2)
collectgarbage("collect")
local res2 = c:get(1, 2)
assert.is.equal(res1, 3)
assert.is.equal(res2, 3)
assert.is.equal(num_calls, 2)
end)
end)
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
| gpl-2.0 |
secondwtq/MarXsCube | Externals/Scripts/Test.lua | 1 | 2559 | Import("mapdef.lua")
Helpers = require 'Helpers'
-- global variables
OBJ_DOTS = { }
OBJ_EDGES = { }
TECHNO_SELECTED = nil
TERRAIN_CHUNKS = { }
CURRENT_TERRAIN_TILE = 1
WL_BUFFER = nil
function acheroncube_test()
local start = Utility.CubePoint(0, 0)
local eend = Utility.CubePoint(1024, 0)
print(Utility.GetTime_Clock())
local vec = Acheron.find_path_async(start, eend, function (vec) print('path got', Utility.GetTime_Clock()) print(vec:size()) end)
print(Utility.GetTime_Clock())
end
function grit_find_path(start, eend)
local a, b = Utility.CubePoint(start[1], start[2]), Utility.CubePoint(eend[1], eend[2])
local vec = Grit.instance():find_path(a, b)
local len, ret = vec:size(), { }
-- print('path length', len)
for i = 0, len-1 do
local pos = vec:at(i)
-- print(pos.x, pos.y)
end
for i = len-1, 1, -1 do
local pos = vec:at(i-1)
table.insert(ret, { pos.x, pos.y, 0 })
end
return ret, Utility.Path.pathway_from_gritpath(vec)
end
-- run when game started
function Functions.TestManger_onTestInit()
for i, chunk in ipairs(map.default.chunks) do
local terrain = Tesla.TeslaChunkObject.create()
terrain:location(Utility.CoordStruct(unpack(chunk.location)))
terrain:set_heightfield(Helpers.texture(chunk.heightfield))
terrain:set_tileset(Helpers.texture(chunk.tileset))
terrain:set_background(Helpers.texture(chunk.background_tex))
terrain:load_objfile(chunk.source, chunk.bullet_model)
if chunk.serialized then
local fp = io.open(chunk.cbdata, 'r')
local s = fp:read('*a')
Wonderland.deserialize_chunk(s, terrain:get_data())
end
terrain:load_shader()
terrain:create_bullet()
terrain:load_buffer()
Generic.TeslaManger():add_chunk(terrain)
table.insert(TERRAIN_CHUNKS, terrain)
end
-- local background = ModEnvironment.Functions.createTechno(OBJECTS.SATELITE_BG, Utility.CoordStruct(64*27+56, -36, 0))
local cycle = ModEnvironment.Functions.createTechno(OBJECTS.TESTTECHNO, Utility.CoordStruct(256, 0, 64), true)
local rail = ModEnvironment.Functions.createTechno(OBJECTS.TESTTECHNO_PHY, Utility.CoordStruct(256, 256, 128), true)
local building = ModEnvironment.Functions.createTechno(OBJECTS.TESTBUILDING, Utility.CoordStruct(512, 384, 0), true)
-- local rail2 = ModEnvironment.Functions.createTechno(OBJECTS.TESTTECHNO_PHY, Utility.CoordStruct(1024, 0, 128), true)
ModEnvironment.Functions.createAnim(OBJECTS.TESTANIM, Utility.CoordStruct(1024, 512, 512))
WL_BUFFER = Evan.DrawBuffer(2048, 2048)
end | gpl-3.0 |
gogolll/flowergirl | plugins/plugins.lua | 3 | 5851 | do
-- Returns the key (index) in the config.enabled_plugins table
local function plugin_enabled( name )
for k,v in pairs(_config.enabled_plugins) do
if name == v then
return k
end
end
-- If not found
return false
end
-- Returns true if file exists in plugins folder
local function plugin_exists( name )
for k,v in pairs(plugins_names()) do
if name..'.lua' == v then
return true
end
end
return false
end
local function list_all_plugins(only_enabled)
local text = ''
local nsum = 0
for k, v in pairs( plugins_names( )) do
-- ✅ enabled, ⛔️ disabled
local status = '⛔️'
nsum = nsum+1
nact = 0
-- Check if is enabled
for k2, v2 in pairs(_config.enabled_plugins) do
if v == v2..'.lua' then
status = '✅'
end
nact = nact+1
end
if not only_enabled or status == '✅' then
-- get the name
v = string.match (v, "(.*)%.lua")
text = text..nsum..'. '..v..' '..status..'\n'
end
end
local text = text..'\nThere are '..nsum..' plugins installed.\n'..nact..' plugins enabled and '..nsum-nact..' disabled'
return text
end
local function list_plugins(only_enabled)
local text = ''
local nsum = 0
for k, v in pairs( plugins_names( )) do
-- ✅ enabled, ⛔️ disabled
local status = '⛔️'
nsum = nsum+1
nact = 0
-- Check if is enabled
for k2, v2 in pairs(_config.enabled_plugins) do
if v == v2..'.lua' then
status = '✅'
end
nact = nact+1
end
if not only_enabled or status == '✅' then
-- get the name
v = string.match (v, "(.*)%.lua")
text = text..v..' '..status..'\n'
end
end
local text = text..'\n'..nact..' plugins enabled from '..nsum..' plugins installed.'
return text
end
local function reload_plugins( )
plugins = {}
load_plugins()
return list_plugins(true)
end
local function enable_plugin( plugin_name )
print('checking if '..plugin_name..' exists')
-- Check if plugin is enabled
if plugin_enabled(plugin_name) then
return 'Plugin '..plugin_name..' is enabled'
end
-- Checks if plugin exists
if plugin_exists(plugin_name) then
-- Add to the config table
table.insert(_config.enabled_plugins, plugin_name)
print(plugin_name..' added to _config table')
save_config()
-- Reload the plugins
return reload_plugins( )
else
return 'Plugin '..plugin_name..' does not exists'
end
end
local function disable_plugin( name, chat )
-- Check if plugins exists
if not plugin_exists(name) then
return 'Plugin '..name..' does not exists'
end
local k = plugin_enabled(name)
-- Check if plugin is enabled
if not k then
return 'Plugin '..name..' not enabled'
end
-- Disable and reload
table.remove(_config.enabled_plugins, k)
save_config( )
return reload_plugins(true)
end
local function disable_plugin_on_chat(receiver, plugin)
if not plugin_exists(plugin) then
return "Plugin doesn't exists"
end
if not _config.disabled_plugin_on_chat then
_config.disabled_plugin_on_chat = {}
end
if not _config.disabled_plugin_on_chat[receiver] then
_config.disabled_plugin_on_chat[receiver] = {}
end
_config.disabled_plugin_on_chat[receiver][plugin] = true
save_config()
return 'Plugin '..plugin..' disabled on this chat'
end
local function reenable_plugin_on_chat(receiver, plugin)
if not _config.disabled_plugin_on_chat then
return 'There aren\'t any disabled plugins'
end
if not _config.disabled_plugin_on_chat[receiver] then
return 'There aren\'t any disabled plugins for this chat'
end
if not _config.disabled_plugin_on_chat[receiver][plugin] then
return 'This plugin is not disabled'
end
_config.disabled_plugin_on_chat[receiver][plugin] = false
save_config()
return 'Plugin '..plugin..' is enabled again'
end
local function run(msg, matches)
-- Show the available plugins
if matches[1] == 'پلاگین' and is_sudo(msg) then --after changed to moderator mode, set only sudo
return list_all_plugins()
end
-- Re-enable a plugin for this chat
if matches[1] == '+' and matches[3] == 'chat' then
local receiver = get_receiver(msg)
local plugin = matches[2]
print("enable "..plugin..' on this chat')
return reenable_plugin_on_chat(receiver, plugin)
end
-- Enable a plugin
if matches[1] == '+' and is_sudo(msg) then --after changed to moderator mode, set only sudo
local plugin_name = matches[2]
print("enable: "..matches[2])
return enable_plugin(plugin_name)
end
-- Disable a plugin on a chat
if matches[1] == '-' and matches[3] == 'chat' then
local plugin = matches[2]
local receiver = get_receiver(msg)
print("disable "..plugin..' on this chat')
return disable_plugin_on_chat(receiver, plugin)
end
-- Disable a plugin
if matches[1] == '-' and is_sudo(msg) then --after changed to moderator mode, set only sudo
if matches[2] == 'پلاگین' then
return 'This plugin can\'t be disabled'
end
print("disable: "..matches[2])
return disable_plugin(matches[2])
end
-- Reload all the plugins!
if matches[1] == '?' and is_sudo(msg) then --after changed to moderator mode, set only sudo
return reload_plugins(true)
end
end
return {
description = "Plugin to manage other plugins. Enable, disable or reload.",
usage = {
sudo = {
"!plugins : list all plugins.",
"!plugins + [plugin] : enable plugin.",
"!plugins - [plugin] : disable plugin.",
"!plugins ? : reloads all plugins." },
},
patterns = {
"^پلاگین$",
"^!plugins? (+) ([%w_%.%-]+)$",
"^!plugins? (-) ([%w_%.%-]+)$",
"^!plugins? (?)$" },
run = run,
moderated = true, -- set to moderator mode
--privileged = true
}
end
| gpl-2.0 |
pirate/snabbswitch | src/lib/protocol/udp.lua | 7 | 2026 | module(..., package.seeall)
local ffi = require("ffi")
local C = ffi.C
local header = require("lib.protocol.header")
local ipsum = require("lib.checksum").ipsum
local udp_header_t = ffi.typeof[[
struct {
uint16_t src_port;
uint16_t dst_port;
uint16_t len;
uint16_t checksum;
} __attribute__((packed))
]]
local udp = subClass(header)
-- Class variables
udp._name = "udp"
udp._header_type = udp_header_t
udp._header_ptr_type = ffi.typeof("$*", udp_header_t)
udp._ulp = { method = nil }
-- Class methods
function udp:new (config)
local o = udp:superClass().new(self)
o:src_port(config.src_port)
o:dst_port(config.dst_port)
o:length(8)
o:header().checksum = 0
return o
end
-- Instance methods
function udp:src_port (port)
local h = self:header()
if port ~= nil then
h.src_port = C.htons(port)
end
return C.ntohs(h.src_port)
end
function udp:dst_port (port)
local h = self:header()
if port ~= nil then
h.dst_port = C.htons(port)
end
return C.ntohs(h.dst_port)
end
function udp:length (len)
local h = self:header()
if len ~= nil then
h.len = C.htons(len)
end
return C.ntohs(h.len)
end
function udp:checksum (payload, length, ip)
local h = self:header()
if payload then
local csum = 0
if ip then
-- Checksum IP pseudo-header
local ph = ip:pseudo_header(length + self:sizeof(), 17)
csum = ipsum(ffi.cast("uint8_t *", ph), ffi.sizeof(ph), 0)
end
-- Add UDP header
h.checksum = 0
csum = ipsum(ffi.cast("uint8_t *", h),
self:sizeof(), bit.bnot(csum))
-- Add UDP payload
h.checksum = C.htons(ipsum(payload, length, bit.bnot(csum)))
end
return C.ntohs(h.checksum)
end
-- override the default equality method
function udp:eq (other)
--compare significant fields
return (self:src_port() == other:src_port()) and
(self:dst_port() == other:dst_port()) and
(self:length() == other:length())
end
return udp
| apache-2.0 |
crazyboy11/bot122 | plugins/imggoogle.lua | 660 | 3196 | do
local mime = require("mime")
local google_config = load_from_file('data/google.lua')
local cache = {}
--[[
local function send_request(url)
local t = {}
local options = {
url = url,
sink = ltn12.sink.table(t),
method = "GET"
}
local a, code, headers, status = http.request(options)
return table.concat(t), code, headers, status
end]]--
local function get_google_data(text)
local url = "http://ajax.googleapis.com/ajax/services/search/images?"
url = url.."v=1.0&rsz=5"
url = url.."&q="..URL.escape(text)
url = url.."&imgsz=small|medium|large"
if google_config.api_keys then
local i = math.random(#google_config.api_keys)
local api_key = google_config.api_keys[i]
if api_key then
url = url.."&key="..api_key
end
end
local res, code = http.request(url)
if code ~= 200 then
print("HTTP Error code:", code)
return nil
end
local google = json:decode(res)
return google
end
-- Returns only the useful google data to save on cache
local function simple_google_table(google)
local new_table = {}
new_table.responseData = {}
new_table.responseDetails = google.responseDetails
new_table.responseStatus = google.responseStatus
new_table.responseData.results = {}
local results = google.responseData.results
for k,result in pairs(results) do
new_table.responseData.results[k] = {}
new_table.responseData.results[k].unescapedUrl = result.unescapedUrl
new_table.responseData.results[k].url = result.url
end
return new_table
end
local function save_to_cache(query, data)
-- Saves result on cache
if string.len(query) <= 7 then
local text_b64 = mime.b64(query)
if not cache[text_b64] then
local simple_google = simple_google_table(data)
cache[text_b64] = simple_google
end
end
end
local function process_google_data(google, receiver, query)
if google.responseStatus == 403 then
local text = 'ERROR: Reached maximum searches per day'
send_msg(receiver, text, ok_cb, false)
elseif google.responseStatus == 200 then
local data = google.responseData
if not data or not data.results or #data.results == 0 then
local text = 'Image not found.'
send_msg(receiver, text, ok_cb, false)
return false
end
-- Random image from table
local i = math.random(#data.results)
local url = data.results[i].unescapedUrl or data.results[i].url
local old_timeout = http.TIMEOUT or 10
http.TIMEOUT = 5
send_photo_from_url(receiver, url)
http.TIMEOUT = old_timeout
save_to_cache(query, google)
else
local text = 'ERROR!'
send_msg(receiver, text, ok_cb, false)
end
end
function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local text_b64 = mime.b64(text)
local cached = cache[text_b64]
if cached then
process_google_data(cached, receiver, text)
else
local data = get_google_data(text)
process_google_data(data, receiver, text)
end
end
return {
description = "Search image with Google API and sends it.",
usage = "!img [term]: Random search an image with Google API.",
patterns = {
"^!img (.*)$"
},
run = run
}
end
| gpl-2.0 |
MrCerealGuy/Stonecraft | games/stonecraft_game/mods/mesecons/mesecons/services.lua | 2 | 4049 | -- Dig and place services
mesecon.on_placenode = function(pos, node)
mesecon.execute_autoconnect_hooks_now(pos, node)
-- Receptors: Send on signal when active
if mesecon.is_receptor_on(node.name) then
mesecon.receptor_on(pos, mesecon.receptor_get_rules(node))
end
-- Conductors: Send turnon signal when powered or replace by respective offstate conductor
-- if placed conductor is an onstate one
if mesecon.is_conductor(node.name) then
local sources = mesecon.is_powered(pos)
if sources then
-- also call receptor_on if itself is powered already, so that neighboring
-- conductors will be activated (when pushing an on-conductor with a piston)
for _, s in ipairs(sources) do
local rule = vector.subtract(pos, s)
mesecon.turnon(pos, rule)
end
--mesecon.receptor_on (pos, mesecon.conductor_get_rules(node))
elseif mesecon.is_conductor_on(node) then
node.name = mesecon.get_conductor_off(node)
minetest.swap_node(pos, node)
end
end
-- Effectors: Send changesignal and activate or deactivate
if mesecon.is_effector(node.name) then
local powered_rules = {}
local unpowered_rules = {}
-- for each input rule, check if powered
for _, r in ipairs(mesecon.effector_get_rules(node)) do
local powered = mesecon.is_powered(pos, r)
if powered then table.insert(powered_rules, r)
else table.insert(unpowered_rules, r) end
local state = powered and mesecon.state.on or mesecon.state.off
mesecon.changesignal(pos, node, r, state, 1)
end
if (#powered_rules > 0) then
for _, r in ipairs(powered_rules) do
mesecon.activate(pos, node, r, 1)
end
else
for _, r in ipairs(unpowered_rules) do
mesecon.deactivate(pos, node, r, 1)
end
end
end
end
mesecon.on_dignode = function(pos, node)
if mesecon.is_conductor_on(node) then
mesecon.receptor_off(pos, mesecon.conductor_get_rules(node))
elseif mesecon.is_receptor_on(node.name) then
mesecon.receptor_off(pos, mesecon.receptor_get_rules(node))
end
mesecon.execute_autoconnect_hooks_queue(pos, node)
end
function mesecon.on_blastnode(pos, intensity)
local node = minetest.get_node(pos)
minetest.remove_node(pos)
mesecon.on_dignode(pos, node)
return minetest.get_node_drops(node.name, "")
end
minetest.register_on_placenode(mesecon.on_placenode)
minetest.register_on_dignode(mesecon.on_dignode)
-- Overheating service for fast circuits
local OVERHEAT_MAX = mesecon.setting("overheat_max", 20)
local COOLDOWN_TIME = mesecon.setting("cooldown_time", 2.0)
local COOLDOWN_STEP = mesecon.setting("cooldown_granularity", 0.5)
local COOLDOWN_MULTIPLIER = OVERHEAT_MAX / COOLDOWN_TIME
local cooldown_timer = 0.0
local object_heat = {}
-- returns true if heat is too high
function mesecon.do_overheat(pos)
local id = minetest.hash_node_position(pos)
local heat = (object_heat[id] or 0) + 1
object_heat[id] = heat
if heat >= OVERHEAT_MAX then
minetest.log("action", "Node overheats at " .. minetest.pos_to_string(pos))
object_heat[id] = nil
return true
end
return false
end
function mesecon.do_cooldown(pos)
local id = minetest.hash_node_position(pos)
object_heat[id] = nil
end
function mesecon.get_heat(pos)
local id = minetest.hash_node_position(pos)
return object_heat[id] or 0
end
function mesecon.move_hot_nodes(moved_nodes)
local new_heat = {}
for _, n in ipairs(moved_nodes) do
local old_id = minetest.hash_node_position(n.oldpos)
local new_id = minetest.hash_node_position(n.pos)
new_heat[new_id] = object_heat[old_id]
object_heat[old_id] = nil
end
for id, heat in pairs(new_heat) do
object_heat[id] = heat
end
end
local function global_cooldown(dtime)
cooldown_timer = cooldown_timer + dtime
if cooldown_timer < COOLDOWN_STEP then
return -- don't overload the CPU
end
local cooldown = COOLDOWN_MULTIPLIER * cooldown_timer
cooldown_timer = 0
for id, heat in pairs(object_heat) do
heat = heat - cooldown
if heat <= 0 then
object_heat[id] = nil -- free some RAM
else
object_heat[id] = heat
end
end
end
minetest.register_globalstep(global_cooldown)
| gpl-3.0 |
badboyam/crazy_bot | plugins/domaintools.lua | 359 | 1494 | local ltn12 = require "ltn12"
local https = require "ssl.https"
-- Edit data/mashape.lua with your Mashape API key
-- http://docs.mashape.com/api-keys
local mashape = load_from_file('data/mashape.lua', {
api_key = ''
})
local function check(name)
local api = "https://domainsearch.p.mashape.com/index.php?"
local param = "name="..name
local url = api..param
local api_key = mashape.api_key
if api_key:isempty() then
return 'Configure your Mashape API Key'
end
local headers = {
["X-Mashape-Key"] = api_key,
["Accept"] = "application/json"
}
local respbody = {}
local body, code = https.request{
url = url,
method = "GET",
headers = headers,
sink = ltn12.sink.table(respbody),
protocol = "tlsv1"
}
if code ~= 200 then return code end
local body = table.concat(respbody)
local body = json:decode(body)
--vardump(body)
local domains = "List of domains for '"..name.."':\n"
for k,v in pairs(body) do
print(k)
local status = " ❌ "
if v == "Available" then
status = " ✔ "
end
domains = domains..k..status.."\n"
end
return domains
end
local function run(msg, matches)
if matches[1] == "check" then
local name = matches[2]
return check(name)
end
end
return {
description = "Domain tools",
usage = {"!domain check [domain] : Check domain name availability.",
},
patterns = {
"^!domain (check) (.*)$",
},
run = run
}
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.