Beispiel #1
0
def genetic_algorithm(args):

    minmax = (args.min, args.max)
    N = args.N
    gens = args.gens

    solution = common.initialize(N,minmax)
    best_fitness = common.fitness(solution[0])

    for gen in range(1, gens):
        if gen % 10 == 0:
            print("Generation :#%d" % gen)

        mutated = mutation.ga_mutation(solution, minmax)
        fitness = common.fitness(mutated[0])

        if fitness <= best_fitness:
            best_fitness = fitness
            solution = mutated
            common.write_data(gen, fitness, 'ga.dat')

        if fitness == 0:
            break

    print("#########################")
    print("# Strategy              : Genetic Algorithms")
    print("# Generations           : " + str(gens))
    print("# Best Solution Fitness : %.3f" % best_fitness)
    print("# Log File              : ./ga.dat")
    print("# Graph                 : Genetic_Algorithm_Ackleys_Function.png")
    print("#########################")
    
    common.plot('Genetic Algorithm: Ackleys Function', 'ga.dat')
Beispiel #2
0
def evolutionary_strategies(args):

    minmax = (args.min, args.max)
    N = args.N
    gens = args.gens

    solution = common.initialize(N,minmax)
    best_fitness = common.fitness(solution[0])

    p = 1.5
    
    for gen in range(1, gens):
        if gen % 10 == 0:
            print("Generation :#%d" % gen)

        mutated = mutation.es_mutation(solution, minmax, p)
        #print(solution[0])
        #print(mutated[0])
        #print(list(map(operator.sub, mutated[0], solution[0])))

        fitness = common.fitness(mutated[0])

        if fitness <= best_fitness:
            best_fitness = fitness
            solution = mutated
            p = 1.5
            common.write_data(gen, fitness, 'es.dat')
        #elif fitness == best_fitness:
        #    p = 1
        else:
            p = 1.5 ** (-1/4)
        
        if fitness == 0:
            break

    print("#########################")
    print("# Strategy              : Evolutionary Strategies")
    print("# Generations           : " + str(gens))
    print("# Best Solution Fitness : %.3f" % best_fitness)
    print("# Log File              : ./es.dat")
    print("# Graph                 : Evolutionary_Strategies_Ackleys_Function.png")
    print("#########################")
    
    common.plot('Evolutionary Strategies: Ackleys Function', 'es.dat')
Beispiel #3
0
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionFinish():
    os.kill(gdb.selected_inferior().pid, 12)  # Send USR2 for collecting log
    return True


common.initialize("OnGarbageCollectionFinish", Cond_GarbageCollectionFinish,
                  "intervalSigProcForLog", common.return_true, True)
Beispiel #4
0
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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionFinish():
    frame = gdb.newest_frame()
    while frame is not None:
        if(frame.name().find("VM_GenCollectForAllocation::doit") != -1):
            return True
        frame = frame.older();
    return False


common.initialize("OnResourceExhausted", common.return_true, "JvmtiExport::post_garbage_collection_finish", common.return_true, False)
Beispiel #5
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("TSnapShotProcessor::entryPoint:RACE_COND_DEBUG_POINT",
                  common.return_true, "VM_GenCollectForAllocation::doit",
                  common.return_true, False)
Beispiel #6
0
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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionFinish():
    frame = gdb.newest_frame()
    while frame is not None:
        if (frame.name().find("VM_CMS_Final_Remark::doit") != -1):
            return True
        frame = frame.older()
    return False


common.initialize("intervalLogProc", common.return_true,
                  "JvmtiExport::post_garbage_collection_finish",
                  Cond_GarbageCollectionFinish, True)
Beispiel #7
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


common.initialize("TTrapSender::sendTrap", common.return_true, "CollectedHeap::accumulate_statistics_all_tlabs", common.return_true, False)
Beispiel #8
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common


common.initialize("TTrapSender::sendTrap", common.return_true, "OnResourceExhausted", common.return_true, False)
Beispiel #9
0
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionStart():
    os.kill(gdb.selected_inferior().pid, 12)  # Send USR2 for collecting log
    return True


common.initialize("callbackForG1Full", Cond_GarbageCollectionStart,
                  "intervalSigProcForLog", common.return_true, True)
Beispiel #10
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common


common.initialize("OnResourceExhausted", common.return_true, "JVM_SleepPrologue", common.return_true, True, at_safepoint=True, jcmd_for_safepoint=False)
Beispiel #11
0
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.
'''

import sys, os

sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionStart():
    os.kill(gdb.selected_inferior().pid,
            1)  # Send HUP for reloading configuration
    return True


common.initialize("VM_CMS_Final_Remark::doit", Cond_GarbageCollectionStart,
                  "ReloadConfigProc", common.return_true, True)
Beispiel #12
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os

sys.path.append(os.pardir + "/../")

import common

common.initialize("OnResourceExhausted", common.return_true,
                  "UnsafeParkPrologue", common.return_true, True)
Beispiel #13
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common

common.initialize("callbackForG1FullReturn", common.return_true,
                  "intervalLogProc", common.return_true, True)
Beispiel #14
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("TGCWatcher::entryPoint:RACE_COND_DEBUG_POINT", common.return_true, "OnResourceExhausted", common.return_true, True)
Beispiel #15
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common

common.initialize("OnResourceExhausted",
                  common.return_true,
                  "intervalLogProc",
                  common.return_true,
                  False,
                  at_safepoint=True)
Beispiel #16
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os

sys.path.append(os.pardir + "/../")

import common

common.initialize("callbackForG1Cleanup", common.return_true,
                  "OnResourceExhausted", common.return_true, True)
Beispiel #17
0
'''
Copyright (C) 2018 Yasumasa Suenaga

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common

common.initialize("dldetector::OnMonitorContendedEntered",
                  common.return_true,
                  "dldetector::OnMonitorContendedEnter",
                  common.return_true,
                  True,
                  at_safepoint=True)
Beispiel #18
0
'''
Copyright (C) 2017 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

def Cond_OnClassPrepare():
    gdb.newest_frame().older().select()
    symbol = gdb.execute("p (char *)klass->_name->_body", False, True)
    return (symbol.find("DynLoad") != -1)


common.initialize("OnClassPrepare", Cond_OnClassPrepare, "OnMonitorWaited", common.return_true, True)
Beispiel #19
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("intervalLogProc", common.return_true, "OnResourceExhausted",
                  common.return_true, True)
Beispiel #20
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common

common.initialize("OnVMDeath", common.return_true,
                  "TGCWatcher::entryPoint:RACE_COND_DEBUG_POINT",
                  common.return_true, True)
Beispiel #21
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("TTrapSender::sendTrap", common.return_true,
                  "callbackForSweep", common.return_true, False)
Beispiel #22
0
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.
'''

import sys, os

sys.path.append(os.pardir + "/../")

import common


def Cond_ResourceExhausted():
    os.kill(gdb.selected_inferior().pid,
            1)  # Send HUP for reloading configuration
    return True


common.initialize("OnResourceExhausted",
                  Cond_ResourceExhausted,
                  "ReloadConfigProc",
                  common.return_true,
                  True,
                  True,
                  at_safepoint=True)
Beispiel #23
0
            .filter(db.Repository.full_name == obj['repository']['full_name'])\
            .one()
    except NoResultFound:
        L.info('POST ignored (not a repo we care about)')
        return ('not a repo we care about', 404)

    if bool(int(conf.web.github.verify)):
        signature = F.request.headers['X-Hub-Signature']
        if not verify_github_signature(payload, repository.secret, signature):
            return ('unauthorized signature', 401)

    notify.notify_github(event, repository, obj)

    return ('got it!', 200)

def verify_github_signature(payload, secret, provided_signature):
    m = hmac.new(str(secret), str(payload), hashlib.sha1)
    computed_signature = 'sha1=' + m.hexdigest()
    print(computed_signature)
    print(provided_signature)
    return hmac.compare_digest(computed_signature, str(provided_signature))

common.initialize('web')
L.info('flask version: %s', F.__version__)

if __name__ == '__main__':
    app.run(
        debug=bool(int(conf.web.server.debug)),
        host=str(conf.web.server.host),
        )
Beispiel #24
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common


def Cond_ResourceExhausted():
    os.kill(gdb.selected_inferior().pid, 12)  # Send USR2 for collecting log
    return True


common.initialize("OnResourceExhausted", Cond_ResourceExhausted, "intervalSigProcForLog", common.return_true, True, True, at_safepoint=True, jcmd_for_safepoint=False)
Beispiel #25
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common

common.initialize("callbackForG1Cleanup", common.return_true,
                  "intervalLogProc", common.return_true, True)
Beispiel #26
0

class BreakAtDataDump(gdb.Breakpoint):
    def __init__(self):
        super(BreakAtDataDump, self).__init__("data_dump")

    def stop(self):
        gdb.execute("set var ReduceSignalUsage=true")
        gdb.write("set true to ReduceSignalUsage\n")


class BreakAtShouldPostDataDump(gdb.Breakpoint):
    def __init__(self):
        super(BreakAtShouldPostDataDump,
              self).__init__("JvmtiExport::should_post_data_dump")

    def stop(self):
        gdb.execute("set var ReduceSignalUsage=false")
        gdb.write("set false to ReduceSignalUsage\n")


common.initialize("OnResourceExhausted",
                  common.return_true,
                  "OnDataDumpRequestForSnapShot",
                  common.return_true,
                  True,
                  at_safepoint=True,
                  jcmd_for_safepoint=False)
BreakAtDataDump()
BreakAtShouldPostDataDump()
Beispiel #27
0
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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common


def Cond_OnClassPrepare():
    gdb.newest_frame().older().select()
    symbol = gdb.execute("p (char *)klass->_name->_body", False, True)
    return (symbol.find("DynLoad") != -1)


common.initialize("TSnapShotProcessor::entryPoint:RACE_COND_DEBUG_POINT",
                  common.return_true, "OnClassPrepare", Cond_OnClassPrepare,
                  True, False, True)
Beispiel #28
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("TTrapSender::sendTrap", common.return_true, "TGCWatcher::entryPoint:RACE_COND_DEBUG_POINT", common.return_true, False)
Beispiel #29
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os

sys.path.append(os.pardir + "/../")

import common

common.initialize("GenCollectedHeap::gc_prologue", common.return_true,
                  "intervalLogProc", common.return_true, True)
Beispiel #30
0
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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common
import re

# from jvmti.h
JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP = 0x0002
JVMTI_RESOURCE_EXHAUSTED_THREADS = 0x0004

def flagToInt():
    m = re.search("\d+$", gdb.execute("p flags", False, True))
    return int(m.group(0))

def Cond_MemoryExhausted():
  return ((flagToInt() & JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP) != 0)

def Cond_ThreadExhausted():
  return ((flagToInt() & JVMTI_RESOURCE_EXHAUSTED_THREADS) != 0)

common.initialize("OnResourceExhausted", Cond_ThreadExhausted, "OnResourceExhausted", Cond_MemoryExhausted, True, at_safepoint=True, jcmd_for_safepoint=False)
Beispiel #31
0
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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionStart():
    os.kill(gdb.selected_inferior().pid,
            1)  # Send HUP for reloading configuration
    return True


common.initialize("ParallelScavengeHeap::accumulate_statistics_all_tlabs",
                  Cond_GarbageCollectionStart, "ReloadConfigProc",
                  common.return_true, True)
Beispiel #32
0
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.
'''

import sys, os
sys.path.append(os.pardir + "/../")

import common


def Cond_GarbageCollectionStart():
    os.kill(gdb.selected_inferior().pid,
            1)  # Send HUP for reloading configuration
    return True


common.initialize("VM_GenCollectForAllocation::doit",
                  Cond_GarbageCollectionStart, "ReloadConfigProc",
                  common.return_true, True)
Beispiel #33
0
'''
Copyright (C) 2018 Nippon Telegraph and Telephone Corporation

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.
'''

import sys, os, time
sys.path.append(os.pardir + "/../")

import common

common.initialize("OnResourceExhausted",
                  common.return_true,
                  "TSnapShotProcessor::entryPoint:RACE_COND_DEBUG_POINT",
                  common.return_true,
                  False,
                  at_safepoint=True,
                  jcmd_for_safepoint=False)
Beispiel #34
0
            out('no repositories yet')

    elif args['add'] and args['github']:
        name = args['<name>'].split('/')[-1]
        full_name = args['<name>']
        secret = args['<secret>']
        r = logic.create_repository(name, full_name, secret)
        db.session.add(r)
        db.session.commit()
        out('successfully added repository: {}', url('r', r.name))

    elif args['notify']:
        repo = find_repository(args['<name>'])
        if repo is None:
            return
        repo.notify = args['<buffer>']
        db.session.commit()
        out('set the notify buffer for {} to {}', repo.name, repo.notify)

def main(args):
    global QUIET
    if '--quiet' in args and args['--quiet']:
        QUIET = True

    if args['repo']:
        c_repo(args)

if __name__ == '__main__':
    common.initialize('tool')
    main(DO.docopt(__doc__, version='bob cli 0.1'))
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('-n', help="N value for Ackley Function",
                        dest='N', type=int)
    parser.add_argument("--min", help="Minimal value", type=int)
    parser.add_argument("--max", help="Maximum value", type=int)
    parser.add_argument('-g', "--generations", help="Number of Generations",
                        dest='gens', type=int)

    args = parser.parse_args()
    
    minmax = (args.min, args.max)
    N = args.N
    gens = args.gens

    solution = common.initialize(N,minmax)
    best_fitness = common.fitness(solution[0])

    p = 1.5
    
    for gen in range(1, gens):
        mutated = mutation.es_mutation(solution, minmax, p)
        fitness = common.fitness(mutated[0])

        if fitness <= best_fitness:
            best_fitness = fitness
            solution = mutated
            p = 1.5
            common.write_data(gen, fitness, 'data.dat')
        else:
            p = 1.5 ** (-1/4)