Exemple #1
0
    def save_kthreads_tunings(self, a):
        dialog = gtk.FileChooserDialog(_("Save As"), None,
                                       gtk.FILE_CHOOSER_ACTION_SAVE,
                                       (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OK, gtk.RESPONSE_OK))
        dialog.set_default_response(gtk.RESPONSE_OK)

        try:
            dialog.set_do_overwrite_confirmation(True)
        except:
            pass

        filter = gtk.FileFilter()
        filter.set_name("rtctl config files")
        filter.add_pattern("*.rtctl")
        filter.add_pattern("*.tuna")
        filter.add_pattern("*rtgroup*")
        dialog.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("All files")
        filter.add_pattern("*")
        dialog.add_filter(filter)

        response = dialog.run()

        filename = dialog.get_filename()
        dialog.destroy()

        if response != gtk.RESPONSE_OK:
            return

        self.refresh()
        kthreads = tuna.get_kthread_sched_tunings(self.ps)
        tuna.generate_rtgroups(filename, kthreads, self.nr_cpus)

        if filename != "/etc/rtgroups":
            dialog = gtk.MessageDialog(
                None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                gtk.MESSAGE_INFO, gtk.BUTTONS_YES_NO,
                "Kernel thread tunings saved!\n\n"
                "Now you can use it with rtctl:\n\n"
                "rtctl --file %s reset\n\n"
                "If you want the changes to be in "
                "effect every time you boot the system "
                "please move %s to /etc/rtgroups\n\n"
                "Do you want to do that now?" % (filename, filename))
            response = dialog.run()
            dialog.destroy()
            if response == gtk.RESPONSE_YES:
                filename = "/etc/rtgroups"
                tuna.generate_rtgroups(filename, kthreads, self.nr_cpus)

        dialog = gtk.MessageDialog(
            None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
            _("Kernel thread tunings saved to %s!") % filename)
        dialog.run()
        dialog.destroy()
Exemple #2
0
def save(cpu_list, thread_list, filename):
	kthreads = tuna.get_kthread_sched_tunings()
	for name in kthreads.keys():
		kt = kthreads[name]
		if (cpu_list and not set(kt.affinity).intersection(set(cpu_list))) or \
		   (thread_list and kt.pid not in thread_list) :
			del kthreads[name]
	tuna.generate_rtgroups(filename, kthreads, get_nr_cpus())
Exemple #3
0
def save(cpu_list, thread_list, filename):
	kthreads = tuna.get_kthread_sched_tunings()
	for name in kthreads.keys():
		kt = kthreads[name]
		if (cpu_list and not set(kt.affinity).intersection(set(cpu_list))) or \
		   (thread_list and kt.pid not in thread_list) :
			del kthreads[name]
	tuna.generate_rtgroups(filename, kthreads, get_nr_cpus())
Exemple #4
0
	def save_kthreads_tunings(self, a):
		dialog = gtk.FileChooserDialog(_("Save As"),
					       None,
					       gtk.FILE_CHOOSER_ACTION_SAVE,
					       (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
						gtk.STOCK_OK, gtk.RESPONSE_OK))
		dialog.set_default_response(gtk.RESPONSE_OK)

		try:
			dialog.set_do_overwrite_confirmation(True)
		except:
			pass

		filter = gtk.FileFilter()
		filter.set_name("rtctl config files")
		filter.add_pattern("*.rtctl")
		filter.add_pattern("*.tuna")
		filter.add_pattern("*rtgroup*")
		dialog.add_filter(filter)

		filter = gtk.FileFilter()
		filter.set_name("All files")
		filter.add_pattern("*")
		dialog.add_filter(filter)

		response = dialog.run()

		filename = dialog.get_filename()
		dialog.destroy()

		if response != gtk.RESPONSE_OK:
			return

		self.refresh()
		kthreads = tuna.get_kthread_sched_tunings(self.ps)
		tuna.generate_rtgroups(filename, kthreads, self.nr_cpus)

		if filename != "/etc/rtgroups":
			dialog = gtk.MessageDialog(None,
						   gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
						   gtk.MESSAGE_INFO,
						   gtk.BUTTONS_YES_NO,
						   "Kernel thread tunings saved!\n\n"
						   "Now you can use it with rtctl:\n\n"
						   "rtctl --file %s reset\n\n"
						   "If you want the changes to be in "
						   "effect every time you boot the system "
						   "please move %s to /etc/rtgroups\n\n"
						   "Do you want to do that now?" % (filename, filename))
			response = dialog.run()
			dialog.destroy()
			if response == gtk.RESPONSE_YES:
				filename = "/etc/rtgroups"
				tuna.generate_rtgroups(filename, kthreads, self.nr_cpus)

		dialog = gtk.MessageDialog(None,
					   gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
					   gtk.MESSAGE_INFO,
					   gtk.BUTTONS_OK,
					   _("Kernel thread tunings saved to %s!") % filename)
		dialog.run()
		dialog.destroy()